junso 6 роки тому
батько
коміт
40d5384888
2 змінених файлів з 13 додано та 13 видалено
  1. 13 13
      lib/flutter_datetime_picker.dart
  2. 0 0
      res/values/strings_en.arb

+ 13 - 13
lib/flutter_datetime_picker.dart

@@ -17,7 +17,7 @@ class DatePicker {
   ///
   /// Display date picker bottom sheet.
   ///
-  static Future showDatePicker(
+  static Future<DateTime> showDatePicker(
     BuildContext context, {
     bool showTitleActions: true,
     DateTime minTime,
@@ -27,8 +27,8 @@ class DatePicker {
     locale: LocaleType.en,
     DateTime currentTime,
     DatePickerTheme theme,
-  }) {
-    return Navigator.push(
+  }) async {
+    return await Navigator.push(
         context,
         new _DatePickerRoute(
             showTitleActions: showTitleActions,
@@ -48,7 +48,7 @@ class DatePicker {
   ///
   /// Display time picker bottom sheet.
   ///
-  static Future showTimePicker(
+  static Future<DateTime> showTimePicker(
     BuildContext context, {
     bool showTitleActions: true,
     DateChangedCallback onChanged,
@@ -56,8 +56,8 @@ class DatePicker {
     locale: LocaleType.en,
     DateTime currentTime,
     DatePickerTheme theme,
-  }) {
-    return Navigator.push(
+  }) async {
+    return await Navigator.push(
         context,
         new _DatePickerRoute(
             showTitleActions: showTitleActions,
@@ -74,7 +74,7 @@ class DatePicker {
   ///
   /// Display date&time picker bottom sheet.
   ///
-  static Future showDateTimePicker(
+  static Future<DateTime> showDateTimePicker(
     BuildContext context, {
     bool showTitleActions: true,
     DateChangedCallback onChanged,
@@ -82,8 +82,8 @@ class DatePicker {
     locale: LocaleType.en,
     DateTime currentTime,
     DatePickerTheme theme,
-  }) {
-    return Navigator.push(
+  }) async {
+    return await Navigator.push(
         context,
         new _DatePickerRoute(
             showTitleActions: showTitleActions,
@@ -100,7 +100,7 @@ class DatePicker {
   ///
   /// Display date picker bottom sheet witch custom picker model.
   ///
-  static Future showPicker(
+  static Future<DateTime> showPicker(
     BuildContext context, {
     bool showTitleActions: true,
     DateChangedCallback onChanged,
@@ -108,8 +108,8 @@ class DatePicker {
     locale: LocaleType.en,
     BasePickerModel pickerModel,
     DatePickerTheme theme,
-  }) {
-    return Navigator.push(
+  }) async {
+    return await Navigator.push(
         context,
         new _DatePickerRoute(
             showTitleActions: showTitleActions,
@@ -413,7 +413,7 @@ class _DatePickerState extends State<_DatePickerComponent> {
                 style: theme.doneStyle,
               ),
               onPressed: () {
-                Navigator.pop(context);
+                Navigator.pop(context, widget.pickerModel.finalTime());
                 if (widget.route.onConfirm != null) {
                   widget.route.onConfirm(widget.pickerModel.finalTime());
                 }

+ 0 - 0
res/values/strings_en.arb