selectedDateTime != null //if true
? Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.grey, Colors.black87],
),
color: Colors.white70,
borderRadius: BorderRadius.circular(20),
),
height: 50,
width: 300,
child: Row(
children: [
Container(
height: 40,
width: 30,
child: Image.asset('lib/icons/hourglass.png'),
),
SizedBox(width: 15,),
Text(selectedDateTime!.day.toString()+"/"+selectedDateTime!.month.toString()+selectedDateTime!.year.toString()
+" - "+selectedDateTime!.hour.toString()+":"+selectedDateTime!.minute.toString()
, style: GoogleFonts.outfit(fontSize: 20),),
SizedBox(width: 45,),
GestureDetector(
onTap: (){
setState(() {
selectedDateTime=null;
});
},
child: Container(
height: 40,
width: 30,
child: Image.asset('lib/icons/remove.png'),
),
),
],
),
)//if false
: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.deepPurple, Colors.greenAccent],
),
color: Colors.white70,
borderRadius: BorderRadius.circular(20),
),
height: 50,
width: 300,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text('Set Reminder', style: GoogleFonts.outfit(fontSize: 20),),
Container(
height: 40,
width: 40,
child: Image.asset('lib/icons/clock.png'),
),
],
),
),
),
When I change the selecteddatetime
variable it does not chang the container on the first go but when I click on the textfield
above it , the container changes