Handle cancellation of the date/time picker in the Gallery full screen dialog demo (#12248)

This commit is contained in:
Jason Simmons 2017-09-25 13:59:05 -07:00 committed by GitHub
parent 48e644057a
commit 6420c75f26

View File

@ -51,7 +51,8 @@ class DateTimeItem extends StatelessWidget {
lastDate: date.add(const Duration(days: 30))
)
.then<Null>((DateTime value) {
onChanged(new DateTime(value.year, value.month, value.day, time.hour, time.minute));
if (value != null)
onChanged(new DateTime(value.year, value.month, value.day, time.hour, time.minute));
});
},
child: new Row(
@ -77,7 +78,8 @@ class DateTimeItem extends StatelessWidget {
initialTime: time
)
.then<Null>((TimeOfDay value) {
onChanged(new DateTime(date.year, date.month, date.day, value.hour, value.minute));
if (value != null)
onChanged(new DateTime(date.year, date.month, date.day, value.hour, value.minute));
});
},
child: new Row(