From 6420c75f2623ea24fc63cce91e322f2f27a96638 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 25 Sep 2017 13:59:05 -0700 Subject: [PATCH] Handle cancellation of the date/time picker in the Gallery full screen dialog demo (#12248) --- .../lib/demo/material/full_screen_dialog_demo.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart b/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart index 2131dd113c..94c9d09a41 100644 --- a/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart @@ -51,7 +51,8 @@ class DateTimeItem extends StatelessWidget { lastDate: date.add(const Duration(days: 30)) ) .then((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((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(