Flutter cupertino style date picker.

Overview

Flutter Cupertino Date Picker

[pub packages] | 中文说明

Flutter cupertino date picker.

Example

Usage

1. Depend

Add this to you package's pubspec.yaml file:

dependencies:
  flutter_cupertino_date_picker: ^1.0.26+2

2. Install

Run command:

$ flutter packages get

3. Import

Import in Dart code:

import 'package:flutter_cupertino_date_picker/flutter_cupertino_date_picker.dart';

4. Display DatePicker

Bottom Sheet DatePicker
/// Display date picker in bottom sheet.
///
/// context: [BuildContext]
/// minDateTime: [DateTime] minimum date time
/// maxDateTime: [DateTime] maximum date time
/// initialDateTime: [DateTime] initial date time for selected
/// dateFormat: [String] date format pattern
/// locale: [DateTimePickerLocale] internationalization
/// pickerMode: [DateTimePickerMode] display mode: date(DatePicker)、time(TimePicker)、datetime(DateTimePicker)
/// pickerTheme: [DateTimePickerTheme] the theme of date time picker
/// onCancel: [DateVoidCallback] pressed title cancel widget event
/// onClose: [DateVoidCallback] date picker closed event
/// onChange: [DateValueCallback] selected date time changed event
/// onConfirm: [DateValueCallback] pressed title confirm widget event
DatePicker.showDatePicker(
  BuildContext context,
  DateTime minDateTime,
  DateTime maxDateTime,
  DateTime initialDateTime,
  String dateFormat,
  DateTimePickerLocale locale: DATETIME_PICKER_LOCALE_DEFAULT,
  DateTimePickerMode pickerMode: DateTimePickerMode.date,
  DateTimePickerTheme pickerTheme: DatePickerTheme.Default,
  DateVoidCallback onCancel,
  DateVoidCallback onClose,
  DateValueCallback onChange,
  DateValueCallback onConfirm,
});
DatePicker Widget
/// Display date picker widget.
///
/// minDateTime: [DateTime] minimum date time
/// maxDateTime: [DateTime] maximum date time
/// initialDateTime: [DateTime] initial date time for selected
/// dateFormat: [String] date format pattern
/// locale: [DateTimePickerLocale] internationalization
/// pickerTheme: [DateTimePickerTheme] the theme of date time picker
/// onCancel: [DateVoidCallback] pressed title cancel widget event
/// onChange: [DateValueCallback] selected date time changed event
/// onConfirm: [DateValueCallback] pressed title confirm widget event
DatePickerWidget({
  DateTime minDateTime,
  DateTime maxDateTime,
  DateTime initialDateTime,
  String dateFormat: DATETIME_PICKER_DATE_FORMAT,
  DateTimePickerLocale locale: DATETIME_PICKER_LOCALE_DEFAULT,
  DateTimePickerTheme pickerTheme: DatePickerTheme.Default,
  DateVoidCallback onCancel,
  DateValueCallback onChange,
  DateValueCallback onConfirm,
})
TimePicker Widget
/// Display time picker widget.
///
/// minDateTime: [DateTime] minimum date time
/// maxDateTime: [DateTime] maximum date time
/// initialDateTime: [DateTime] initial date time for selected
/// dateFormat: [String] date format pattern
/// locale: [DateTimePickerLocale] internationalization
/// pickerTheme: [DateTimePickerTheme] the theme of date time picker
/// minuteDivider: [int] minute restriction, e.g. 5: every 5th minute will be shown (0, 5, 10, 15 ...)
/// onCancel: [DateVoidCallback] pressed title cancel widget event
/// onChange: [DateValueCallback] selected date time changed event
/// onConfirm: [DateValueCallback] pressed title confirm widget event
TimePickerWidget({
  DateTime minDateTime,
  DateTime maxDateTime,
  DateTime initialDateTime,
  String dateFormat: DATETIME_PICKER_DATE_FORMAT,
  DateTimePickerLocale locale: DATETIME_PICKER_LOCALE_DEFAULT,
  DateTimePickerTheme pickerTheme: DatePickerTheme.Default,
  int minuteDivider: 1,
  DateVoidCallback onCancel,
  DateValueCallback onChange,
  DateValueCallback onConfirm,
})
DateTimePicker Widget
/// Display date time picker widget.
///
/// minDateTime: [DateTime] minimum date time
/// maxDateTime: [DateTime] maximum date time
/// initialDateTime: [DateTime] initial date time for selected
/// dateFormat: [String] date format pattern
/// locale: [DateTimePickerLocale] internationalization
/// pickerTheme: [DateTimePickerTheme] the theme of date time picker
/// onCancel: [DateVoidCallback] pressed title cancel widget event
/// onChange: [DateValueCallback] selected date time changed event
/// onConfirm: [DateValueCallback] pressed title confirm widget event
DateTimePickerWidget({
  DateTime minDateTime,
  DateTime maxDateTime,
  DateTime initialDateTime,
  String dateFormat: DATETIME_PICKER_DATE_FORMAT,
  DateTimePickerLocale locale: DATETIME_PICKER_LOCALE_DEFAULT,
  DateTimePickerTheme pickerTheme: DatePickerTheme.Default,
  DateVoidCallback onCancel,
  DateValueCallback onChange,
  DateValueCallback onConfirm,
})

5. DateTimePickerLocale

Support:

  • en_us: English (EN) United States [Default locale]
  • ar: Arabic (ar)
  • ar_eg: Arabic (ar) Egypt
  • bn: Bengali (BN)
  • bs: Bosnian (BS)
  • de: German (DE)
  • es: Spanish (ES)
  • fr: French (FR)
  • hr: Croatian (HR)
  • hu: Hungarian (HU)
  • in_id: Bahasa (IN) Indonesia
  • it: Italian (IT)
  • jp: Japanese (JP)
  • ko: Korea (KO)
  • nl: Dutch (NL)
  • pt_br: Portuguese (PT) Brazil
  • ro: Romanian (RO)
  • ru: Russian (RU)
  • sr_cyrl: Serbia (sr) Cyrillic
  • sr_latn: Serbia (sr) Latin
  • tr: Turkish (TR)
  • uk: Ukraine (UK)
  • vi: Vietnamese (VI) Vietnam
  • zh_cn: Chinese (ZH) Simplified
Add more language
1. Add language i18n file

Fork this project, add language file in lib/src/i18n/ directory, e.g. strings_en_us.dart.

/// English (EN) United States
class _StringsEnUs extends _StringsI18n {
  const _StringsEnUs();

  @override
  String getCancelText() {
    // TODO return cancel widget's text
    return null;
  }

  @override
  String getDoneText() {
    // TODO return done widget's text
    return null;
  }

  @override
  List<String> getMonths() {
    // TODO return the array of month's full name [January, February ... December]
    return null;
  }

  @override
  List<String> getMonthsShort() {
    // TODO return the array of month's short name [Jan, Feb ... Dec]. If return null, will substring the full name (max length is 3)
    return null;
  }

  @override
  List<String> getWeeksFull() {
    // TODO return the array of week's full name [Monday, Tuesday ... Sunday]
    return null;
  }

  @override
  List<String> getWeeksShort() {
    // TODO return the array of week's short name [Mon, Tue ... Sun]
    return null;
  }
}
2. Add Locale

Add language locale in lib/src/i18n/date_picker_i18n.dart file.

enum DateTimePickerLocale {
  /// English (EN) United States
  en_us,
}
3. Add Locale-Language relationship

Add language-locale relationship in lib/src/i18n/date_picker_i18n.dart file.

const Map<DateTimePickerLocale, _StringsI18n> datePickerI18n = {
  DateTimePickerLocale.en_us: const _StringsEnUs(),
};

6. dateFormat

Pattern Meaning e.g.
yyyy year 2019, 2020
yy year, 2 digits 19, 20
MMMM month January(en_us), 01(zh_cn)
MMM month, abbreviated Jan(en_us), 01(zh_cn)
MM month, 2 digits 01、11
M month 1, 11
dd day in month, 2 digits 05, 25
d day in month 5, 25
EEEE day of week Monday(en_us), 星期一(zh_cn)
EEE day of week, abbreviated Mon(en_us), 周一(zh_cn)
HH hour (0~23), 2 digits 04, 12, 20
H hour (0~23) 4, 12, 20
mm minute, 2 digits 05, 40
m minute 5, 40
ss second, 2 digits 06, 55
s second 6, 55
yyyy年 format 2019年, 2020年
H时 format 5时, 21时
Date Format Separator

Support separator: |,-/\._: .

7. DateTimePickerTheme

/// DateTimePicker theme.
///
/// [backgroundColor] DatePicker's background color.
/// [cancelTextStyle] Default cancel widget's [TextStyle].
/// [confirmTextStyle] Default confirm widget's [TextStyle].
/// [cancel] Custom cancel widget.
/// [confirm] Custom confirm widget.
/// [title] Custom title widget. If specify a title widget, the cancel and confirm widgets will not display. Must set [titleHeight] value for custom title widget.
/// [showTitle] Whether display title widget or not. If set false, the default cancel and confirm widgets will not display, but the custom title widget will display if had specified one custom title widget.
/// [pickerHeight] The value of DatePicker's height.
/// [titleHeight] The value of DatePicker's title height.
/// [itemHeight] The value of DatePicker's column height.
/// [itemTextStyle] The value of DatePicker's column [TextStyle].
const DateTimePickerTheme({
  this.backgroundColor: DATETIME_PICKER_BACKGROUND_COLOR,
  this.cancelTextStyle,
  this.confirmTextStyle,
  this.cancel,
  this.confirm,
  this.title,
  this.showTitle: DATETIME_PICKER_SHOW_TITLE_DEFAULT,
  this.pickerHeight: DATETIME_PICKER_HEIGHT,
  this.titleHeight: DATETIME_PICKER_TITLE_HEIGHT,
  this.itemHeight: DATETIME_PICKER_ITEM_HEIGHT,
  this.itemTextStyle: DATETIME_PICKER_ITEM_TEXT_STYLE,
});

Example

Example sources

Example APK

Example APK Download

DatePicker

Example: DatePicker

Example: DatePickerWidget

TimePicker

Example: TimePicker

Example: TimePickerWidget

DateTimePicker

Example: DateTimePicker

Example: DateTimePickerWidget

License

Copyright 2018 wuzhen

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Error: The type 'Diagnosticable' can't be used as supertype.

    Error: The type 'Diagnosticable' can't be used as supertype.

    Compiler message:
    ../../.pub-cache/hosted/pub.flutter-io.cn/flutter_cupertino_date_picker-1.0.12/lib/src/date_picker_theme.dart:23:7: Error: The type 'Diagnosticable' can't be used as supertype.
    class DateTimePickerTheme extends Diagnosticable {
    

    Flutter 1.15.22-pre.21 flutter-cupertino-date-picker 1.0.12

    opened by wasabia 11
  • Internation­alizing issue

    Internation­alizing issue

    Hi !

    After I added Localizations into my app(following this tutorial ) I got this issue when I interact with the Picker:

    [VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The method 'call' was called on null.
    Receiver: null
    Tried calling: call()
    #0      _rootRun  (dart:async/zone.dart:1120:38)
    #1      _CustomZone.run  (dart:async/zone.dart:1021:19)
    #2      _FutureListener.handleWhenComplete  (dart:async/future_impl.dart:150:18)
    #3      Future._propagateToListeners.handleWhenCompleteCallback  (dart:async/future_impl.dart:609:39)
    #4      Future._propagateToListeners  (dart:async/future_impl.dart:665:37)
    #5      Future._completeWithValue  (dart:async/future_impl.dart:483:5)
    #6      Future._asyncComplete.<anonymous closure>  (dart:async/future_impl.dart:513:7)
    #7      _rootRun  (dart:async/zone.dart:1124:13)
    #8      _CustomZone.run  (dart:async/zone.dart:1021:19)
    

    Do I need to implement something else ?

    My app supported languages:

    MaterialApp(
              localizationsDelegates: [
                AppLocalizationsDelegate(),
                GlobalMaterialLocalizations.delegate,
                GlobalWidgetsLocalizations.delegate,
                GlobalCupertinoLocalizations.delegate,
              ],
              supportedLocales: [
                const Locale('pt', 'BR'),
                const Locale('en', 'US'),
              ],
    

    My AppLocalization`s load method:

      static Future<AppLocalizations> load(Locale locale) async {
        final String name =
            (locale.countryCode != null && locale.countryCode.isEmpty)
                ? locale.languageCode
                : locale.toString();
        final String localeName = Intl.canonicalizedLocale(name);
        await initializeMessages(localeName);
    
        Intl.defaultLocale = localeName;
        return AppLocalizations();
      }
    

    flutter doctor:

    [✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.6 18G87, locale pt-BR)
        • Flutter version 1.7.8+hotfix.4 at /Users/alefcarlos/development/flutter
        • Framework revision 20e59316b8 (5 weeks ago), 2019-07-18 20:04:33 -0700
        • Engine revision fee001c93f
        • Dart version 2.4.0
    
     
    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
        • Android SDK at /Users/alefcarlos/Library/Android/sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-28, build-tools 28.0.3
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 10.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 10.3, Build version 10G8
        • CocoaPods version 1.7.5
    
    [✓] iOS tools - develop for iOS devices
        • ios-deploy 1.9.4
    
    [✓] Android Studio (version 3.3)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 33.4.1
        • Dart plugin version 182.5215
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    
    [✓] VS Code (version 1.37.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.3.0
    
    [✓] Connected device (1 available)
        • iPhone Xʀ • 5023658E-C713-4EC6-9792-56D738EBB720 • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)
    
    • No issues found!
    

    Thank you for this amazing plugin !

    opened by alefcarlos 8
  • 更新最新flutter后会报错

    更新最新flutter后会报错

    Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments. const DateTimePickerTheme({ ^^^^^^^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception: Errors during snapshot creation: null build failed.

    opened by super-yolin 6
  • Error: The type 'DiagnosticableMixin' can't be mixed in. class DateTimePickerTheme with DiagnosticableMixin

    Error: The type 'DiagnosticableMixin' can't be mixed in. class DateTimePickerTheme with DiagnosticableMixin

    Flutter 1.22.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision 8874f21e79 (9 days ago) • 2020-10-29 14:14:35 -0700 Engine • revision a1440ca392 Tools • Dart 2.10.3

    The following problems occur after import: ../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_cupertino_date_picker-1.0.26+2/lib/src/date_picker_theme.dart:23:32: Error: Type 'DiagnosticableMixin' not found. class DateTimePickerTheme with DiagnosticableMixin { ^^^^^^^^^^^^^^^^^^^ ../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_cupertino_date_picker-1.0.26+2/lib/src/date_picker_theme.dart:23:7: Error: The type 'DiagnosticableMixin' can't be mixed in. class DateTimePickerTheme with DiagnosticableMixin {

    The solution is: Removed ‘with DiagnosticableMixin’ or change 'DiagnosticableMixin' to 'Diagnosticable' and it work well for me.

    opened by MarkBurt 5
  • Failed assertion: boolean expression must not be null

    Failed assertion: boolean expression must not be null

    Hi, I got an error when I pick the date, it only appears until April, and this error is showing up.

    image

    Flutter doctor

    
    [✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287, locale en-ID)
     
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    [✓] Xcode - develop for iOS and macOS (Xcode 11.4)
    [✓] Android Studio (version 3.6)
    [✓] VS Code (version 1.44.2)
    [✓] VS Code (version 1.42.1)
    [✓] Connected device (1 available)
    
    • No issues found!
    
    opened by Zersya 3
  • Import don't work

    Import don't work

    When I add the import statement import 'packages:flutter_cupertino_date_picker/flutter_cupertino_date_picker.dart'; an compilatio error appears:

    Target of URI doesn't exist: 'packages:flutter_cupertino_date_picker/flutter_cupertino_date_picker.dart'.

    opened by luizjacomn 2
  • Build error with Flutter beta channel,  No named parameter with the name 'shadowThemeOnly'.

    Build error with Flutter beta channel, No named parameter with the name 'shadowThemeOnly'.

    ../../development/flutter/.pub-cache/git/flutter-cupertino-date-picker-38630701b92a4fd0b753f9ab38b3581a5645a629/lib/src/date_picker.dart:103:34: Error: No named parameter with the name 'shadowThemeOnly'. theme: Theme.of(context, shadowThemeOnly: true), ^^^^^^^^^^^^^^^ ../../development/flutter/packages/flutter/lib/src/material/theme.dart:107:20: Context: Found this candidate, but the arguments don't match. static ThemeData of(BuildContext context) { ^^

    Command PhaseScriptExecution failed with a nonzero exit code

    opened by jerry-cai 1
  • NoSuchMethodError was thrown building DatePickerWidget(dirty, state: _DatePickerWidgetState#3ec38):

    NoSuchMethodError was thrown building DatePickerWidget(dirty, state: _DatePickerWidgetState#3ec38):

    By some strange circumstances your code in examples not working in my project.

    [✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.14.6 18G103, locale en-RU)

    Future<void> _selectDate(BuildContext context) async {
        DatePicker.showDatePicker(
          context,
          locale: DateTimePickerLocale.en_us,
          initialDateTime: DateTime.now(),
          dateFormat: 'dd-mm-yyyy',
          onMonthChangeStartWithFirstDate: true,
          pickerTheme: DateTimePickerTheme(
            showTitle: true,
            confirm: Text('Done', style: TextStyle(color: Colors.black)),
          ),
          minDateTime: DateTime.parse(MIN_DATETIME),
          maxDateTime: DateTime.parse(MAX_DATETIME),
          onConfirm: (dateTime, List<int> index) {
            if (mounted)
              setState(() {
                selectedDate = dateTime;
                widget.controller.text = formatter.format(selectedDate);
              });
          },
        );
      }
    
    flutter: 2010, 2021
    
    ════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
    The following NoSuchMethodError was thrown building DatePickerWidget(dirty, state: _DatePickerWidgetState#3ec38):
    The getter 'last' was called on null.
    Receiver: null
    Tried calling: last
    
    The relevant error-causing widget was: 
      MaterialApp file:///Users/sss/Documents/Projects/sss/lib/main.dart:43:12
    When the exception was thrown, this was the stack: 
    #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
    #1      _DatePickerWidgetState._renderDatePickerColumnComponent (package:flutter_cupertino_date_picker/src/widget/date_picker_widget.dart:220:34)
    #2      _DatePickerWidgetState._renderDatePickerWidget.<anonymous closure> (package:flutter_cupertino_date_picker/src/widget/date_picker_widget.dart:183:29)
    #3      List.forEach (dart:core-patch/growable_array.dart:282:8)
    #4      _DatePickerWidgetState._renderDatePickerWidget (package:flutter_cupertino_date_picker/src/widget/date_picker_widget.dart:180:15)
    ...
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    
    opened by JSBmanD 1
  • The getter 'last' was called on null

    The getter 'last' was called on null

    Hi! In a widget in an onPressed i use

    DatePicker.showDatePicker(context, dateFormat: 'HH/mm/ss');

    When I press the button I get this error: The following NoSuchMethodError was thrown building DatePickerWidget(dirty, state: _DatePickerWidgetState#7c286): The getter 'last' was called on null. Receiver: null Tried calling: last The relevant error-causing widget was MaterialApp When the exception was thrown, this was the stack #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5) #1 _DatePickerWidgetState._renderDatePickerColumnComponent #2 _DatePickerWidgetState._renderDatePickerWidget. #4 _DatePickerWidgetState._renderDatePickerWidget

    opened by gripzyyy 1
  • i18n support for date and time Numbers ie Arabic and Farsi numbers

    i18n support for date and time Numbers ie Arabic and Farsi numbers

    The _StringsI18n class contains translation for the weeks and the month's names only. Some languages like Arabic and Farsi require i18n for the numbers itself.

    To get the idea, these are the numbers in English, Farsi, and Arabic

    english = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; farsi = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; arabic = ['۰', '۱', '۲', '۳', '٦', '٥', '٤', '۷', '۸', '۹'];

    You can find all available languages here https://en.wikipedia.org/wiki/Hindu%E2%80%93Arabic_numeral_system#Glyph_comparison

    How to allow that in _StringsI18n ?

    opened by shadyshrif 1
  • exception when building example

    exception when building example

    steve@tr4:~/google/flutter-cupertino-date-picker/example$ flutter run Running "flutter pub get" in example... 3.1s Launching lib/main.dart on ONEPLUS A5010 in debug mode... [!] Your app isn't using AndroidX. To avoid potential build failures, you can quickly migrate your app by following the steps on https://goo.gl/CP92wY. E/flutter (10053): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: setState() called after dispose(): _LoadStuffButtonState#fb94d(lifecycle state: defunct, not mounted) E/flutter (10053): This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback. E/flutter (10053): The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree. E/flutter (10053): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose(). E/flutter (10053): #0 State.setState. (package:flutter/src/widgets/framework.dart:1112:9) E/flutter (10053): #1 State.setState (package:flutter/src/widgets/framework.dart:1147:6) E/flutter (10053): #2 _LoadStuffButtonState._clickLoadStuff. (package:simple_animations_example_app/examples/load_stuff_button.dart:83:7) E/flutter (10053): #3 _rootRunUnary (dart:async/zone.dart:1134:38) E/flutter (10053): #4 _CustomZone.runUnary (dart:async/zone.dart:1031:19) E/flutter (10053): #5 _FutureListener.handleValue (dart:async/future_impl.dart:139:18) E/flutter (10053): #6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45) E/flutter (10053): #7 Future._propagateToListeners (dart:async/future_impl.dart:709:32) E/flutter (10053): #8 Future._complete (dart:async/future_impl.dart:514:7) E/flutter (10053): #9 new Future.delayed. (dart:async/future.dart:313:16) E/flutter (10053): #10 _rootRun (dart:async/zone.dart:1122:38)
    E/flutter (10053): #11 _CustomZone.run (dart:async/zone.dart:1023:19) E/flutter (10053): #12 _CustomZone.runGuarded (dart:async/zone.dart:925:7) E/flutter (10053): #13 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:965:23) E/flutter (10053): #14 _rootRun (dart:async/zone.dart:1126:13)
    E/flutter (10053): #15 _CustomZone.run (dart:async/zone.dart:1023:19) E/flutter (10053): #16 _CustomZone.bindCallback. (dart:async/zone.dart:949:23) E/flutter (10053): #17 Timer._createTimer. (dart:async-patch/timer_patch.dart:23:15) E/flutter (10053): #18 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19) E/flutter (10053): #19 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5) E/flutter (10053): #20 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12) E/flutter (10053):
    Running Gradle task 'assembleDebug'...
    Checking the license for package Android SDK Build-Tools 26.0.2 in /home/steve/Android/Sdk/licenses License for package Android SDK Build-Tools 26.0.2 accepted.
    Preparing "Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)".
    "Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)" ready.
    Installing Android SDK Build-Tools 26.0.2 in /home/steve/Android/Sdk/build-tools/26.0.2
    "Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)" complete.
    "Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)" finished.
    Checking the license for package Android SDK Platform 27 in /home/steve/Android/Sdk/licenses
    License for package Android SDK Platform 27 accepted.
    Preparing "Install Android SDK Platform 27 (revision: 3)".
    "Install Android SDK Platform 27 (revision: 3)" ready.
    Installing Android SDK Platform 27 in /home/steve/Android/Sdk/platforms/android-27
    "Install Android SDK Platform 27 (revision: 3)" complete.
    "Install Android SDK Platform 27 (revision: 3)" finished.

    FAILURE: Build failed with an exception.

    • Where:
      Build file '/home/steve/google/flutter-cupertino-date-picker/example/android/app/build.gradle' line: 43

    • What went wrong:
      A problem occurred evaluating project ':app'.

    path may not be null or empty string. path='null'

    • Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    • Get more help at https://help.gradle.org

    BUILD FAILED in 3m 13s
    Running Gradle task 'assembleDebug'...
    Running Gradle task 'assembleDebug'... Done 194.2s (!) Gradle task assembleDebug failed with exit code 1

    opened by sgehrman 1
  • Rendering error. setState() was called from a layout or paint call back

    Rendering error. setState() was called from a layout or paint call back

    This freezes up and throws the below area when I'm using web app in chrome in debug mode. Any ideas?

    My Code:

    // Cupertino Date Picker
    CupertinoDatePicker(
                      initialDateTime: initialDateTime,
                      minimumDate: initialDateTime,
                      onDateTimeChanged: (val) {
                        if (val != null && val != _chosenDateTime) {
                          setState(() {
                            _chosenDateTime = val;
                          });
                        }
                        // RendererBinding.instance
                        //     .addPostFrameCallback((_) => setState(() {
                        //           _chosenDateTime = val;
                        //         }));
                        // setState(() {
                        //   _chosenDateTime = val;
                        // });
                      }),
                ),
    
                // Close the modal
                CupertinoButton(
                  child: const Text('OK'),
                  onPressed: () {
                    var formattedTime = DateFormat('EEE, MMM. d, y - h:mm a')
                        .format(_chosenDateTime!);
                    dateInput.text = formattedTime;
                    Navigator.of(ctx).pop();
                  },
                )
    

    ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════ The following assertion was thrown during performLayout(): Build scheduled during frame. While the widget tree was being built, laid out, and painted, a new frame was scheduled to rebuild the widget tree. This might be because setState() was called from a layout or paint callback. If a change is needed to the widget tree, it should be applied as the tree is being built. Scheduling a change for the subsequent frame instead results in an interface that lags behind by one frame. If this was done to make your build dependent on a size measured at layout time, consider using a LayoutBuilder, CustomSingleChildLayout, or CustomMultiChildLayout. If, on the other hand, the one frame delay is the desired effect, for example because this is an animation, consider scheduling the frame in a post-frame callback using SchedulerBinding.addPostFrameCallback or using an AnimationController to trigger the animation.

    The relevant error-causing widget was: CupertinoDatePicker CupertinoDatePicker:file:///Users/jonathanvu/development/RideRuta/flutter/rutaV1/lib/pages/ create_page.dart:69:22

    When the exception was thrown, this was the stack: dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49 throw packages/flutter/src/widgets/binding.dart 756:9 packages/flutter/src/widgets/binding.dart 778:14 [_handleBuildScheduled] packages/flutter/src/widgets/framework.dart 2482:7 scheduleBuildFor packages/flutter/src/widgets/framework.dart 4495:5 markNeedsBuild packages/flutter/src/widgets/framework.dart 1129:5 setState packages/flutter/src/cupertino/date_picker.dart 921:5 [_pickerDidStopScrolling] packages/flutter/src/cupertino/date_picker.dart 693:11 packages/flutter/src/widgets/notification_listener.dart 130:22 onNotification packages/flutter/src/widgets/framework.dart 3078:18 dispatchNotification packages/flutter/src/widgets/framework.dart 3081:13 dispatchNotification packages/flutter/src/widgets/framework.dart 3081:13 dispatchNotification packages/flutter/src/widgets/framework.dart 4375:24 dispatchNotification packages/flutter/src/widgets/notification_listener.dart 60:13 dispatch packages/flutter/src/widgets/scroll_activity.dart 104:61 dispatchScrollEndNotification packages/flutter/src/widgets/scroll_position.dart 907:5 didEndScroll packages/flutter/src/widgets/scroll_position.dart 876:23 beginActivity packages/flutter/src/widgets/scroll_position_with_single_context.dart 114:11 beginActivity packages/flutter/src/widgets/scroll_position_with_single_context.dart 129:5 goIdle packages/flutter/src/widgets/scroll_position_with_single_context.dart 148:7 goBallistic packages/flutter/src/widgets/scroll_activity.dart 549:14 applyNewDimensions packages/flutter/src/widgets/scroll_position.dart 623:5 applyNewDimensions packages/flutter/src/widgets/scroll_position_with_single_context.dart 104:11 applyNewDimensions packages/flutter/src/widgets/scroll_position.dart 553:7 applyContentDimensions packages/flutter/src/rendering/list_wheel_viewport.dart 669:12 performLayout packages/flutter/src/rendering/object.dart 1757:7 [_layoutWithoutResize] packages/flutter/src/rendering/object.dart 887:17 flushLayout packages/flutter/src/rendering/binding.dart 504:19 drawFrame packages/flutter/src/widgets/binding.dart 892:13 drawFrame packages/flutter/src/rendering/binding.dart 370:5 [_handlePersistentFrameCallback] packages/flutter/src/scheduler/binding.dart 1146:15 [_invokeFrameCallback] packages/flutter/src/scheduler/binding.dart 1083:9 handleDrawFrame packages/flutter/src/scheduler/binding.dart 997:5 [_handleDrawFrame] lib/_engine/engine/platform_dispatcher.dart 1090:13 invoke lib/_engine/engine/platform_dispatcher.dart 160:5 invokeOnDrawFrame lib/_engine/engine/initialization.dart 194:45

    The following RenderObject was being processed when the exception was fired: RenderListWheelViewport#7835c NEEDS-LAYOUT: needs compositing creator: ListWheelViewport ← IgnorePointer-[GlobalKey#1a0b2] ← Semantics ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey#bd4b6] ← Listener ← _ScrollableScope ← _ScrollSemantics-[GlobalKey#dd7d4] ← NotificationListener ← _FixedExtentScrollable ← NotificationListener ← ⋯ parentData: (can use size) constraints: BoxConstraints(w=297.0, h=400.0) layer: OffsetLayer#e9131 size: Size(297.0, 400.0) This RenderObject had the following descendants (showing up to depth 5): child 1: RenderIndexedSemantics#3f899 relayoutBoundary=up1 child: RenderPadding#4bcb3 relayoutBoundary=up2 child: RenderPositionedBox#abfa7 relayoutBoundary=up3 child: RenderPositionedBox#cc2e5 relayoutBoundary=up4 child: RenderParagraph#de66e relayoutBoundary=up5 child 2: RenderIndexedSemantics#c4c55 relayoutBoundary=up1 child: RenderPadding#fadc5 relayoutBoundary=up2 child: RenderPositionedBox#51df8 relayoutBoundary=up3 child: RenderPositionedBox#e0bcc relayoutBoundary=up4 child: RenderParagraph#e53e1 relayoutBoundary=up5 child 3: RenderIndexedSemantics#5a811 relayoutBoundary=up1 child: RenderPadding#7bb56 relayoutBoundary=up2 child: RenderPositionedBox#c54f9 relayoutBoundary=up3 child: RenderPositionedBox#3bfbf relayoutBoundary=up4 child: RenderParagraph#31919 relayoutBoundary=up5 child 4: RenderIndexedSemantics#217e2 relayoutBoundary=up1 child: RenderPadding#b06f8 relayoutBoundary=up2 child: RenderPositionedBox#260fd relayoutBoundary=up3 child: RenderPositionedBox#8ad49 relayoutBoundary=up4 child: RenderParagraph#802e8 relayoutBoundary=up5 child 5: RenderIndexedSemantics#26093 relayoutBoundary=up1 child: RenderPadding#09418 relayoutBoundary=up2 child: RenderPositionedBox#673ee relayoutBoundary=up3 child: RenderPositionedBox#a353c relayoutBoundary=up4 child: RenderParagraph#f33e1 relayoutBoundary=up5 ...(descendants list truncated after 25 lines) ═════════════════════════════════════════════════════════════════════════════════════════════ ═══════

    opened by jonathandvu 0
  • 当我设置一个最小时间后,选择日期是 只改变年份,导致选择的时间不对

    当我设置一个最小时间后,选择日期是 只改变年份,导致选择的时间不对

    ![image](https://user-images.githubusercontent.com/55102972/143430249-27674357-7038-4908-b789-010c3e5ed03b.png![image](https://user-images.githubusercontent.com/55102972/143430298-9d393e3a-05f9-4787-92b0-3e38badac9fb.pngimageimage

    opened by chenchen0206 2
  • No named parameter with the name 'shadowThemeOnly'.

    No named parameter with the name 'shadowThemeOnly'.

    ../../flutter/.pub-cache/git/flutter-cupertino-date-picker-3a6b1513d77636976794b6c64630b7ae219fb371/lib/src/date_picker.dart:103:34: Error: No named parameter with the name 'shadowThemeOnly'. theme: Theme.of(context, shadowThemeOnly: true), ^^^^^^^^^^^^^^^ ../../flutter/packages/flutter/lib/src/material/theme.dart:107:20: Context: Found this candidate, but the arguments don't match.

    static ThemeData of(BuildContext context) { ^^

    FAILURE: Build failed with an exception.

    opened by him123 2
  • error with Flutter 2

    error with Flutter 2

    I got the below error after upgrading to flutter2

    any help please

    Xcode's output: ↳ ../../../../Flutter_dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_cupertino_date_picker-1.0.26+2/lib/src/date_picker_theme.dart:23:32: Error: Type 'DiagnosticableMixin' not found. class DateTimePickerTheme with DiagnosticableMixin { ^^^^^^^^^^^^^^^^^^^ ../../../../Flutter_dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_cupertino_date_picker-1.0.26+2/lib/src/date_picker_theme.dart:23:7: Error: The type 'DiagnosticableMixin' can't be mixed in. class DateTimePickerTheme with DiagnosticableMixin { ^ ../../../../Flutter_dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_cupertino_date_picker-1.0.26+2/lib/src/date_picker.dart:103:34: Error: No named parameter with the name 'shadowThemeOnly'. theme: Theme.of(context, shadowThemeOnly: true), ^^^^^^^^^^^^^^^ ../../../../Flutter_dev/flutter/packages/flutter/lib/src/material/theme.dart:107:20: Context: Found this candidate, but the arguments don't match. static ThemeData of(BuildContext context) {

    opened by monammedoz 8
Owner
Dylan Wu
just coding
Dylan Wu
Flutter cupertino style date picker.

Flutter Cupertino Date Picker [pub packages] | 中文说明 Flutter cupertino date picker. Usage 1. Depend Add this to you package's pubspec.yaml file: depend

Dylan Wu 333 Dec 26, 2022
Flutter cupertino style date picker.

Flutter Cupertino Date Picker [pub packages] | 中文说明 Flutter cupertino date picker. Usage 1. Depend Add this to you package's pubspec.yaml file: depend

Dylan Wu 333 Dec 26, 2022
Cupertino app codelab - Building a Cupertino App with Flutter

Building a Cupertino App with Flutter Flutter allows us creating Cupertino (iOS-

Abdulaziz Malikov 5 Nov 30, 2022
Flutter Cupertino text box which can be used to select a date with CupertinoDatePicker

Flutter Cupertino Date Text Box A text box with an attached CupertinoDatePicker which opens when the text box is tapped. With this library the followi

Christoph Rothermel 5 Feb 13, 2022
Neumorphic style - Example app with Flutter that displays a neumorphic style container

Flutter Neumorphic Style Example App Example app with Flutter that displays a ne

Piyush Nagpal 2 Mar 24, 2022
Color picker for Flutter, based on the Google Docs color picker.

Material ColorPicker Color picker for Flutter, based on the Google Docs color picker. Getting Started You can embed into your material app or use it o

Razvan Lung 103 Oct 30, 2022
Form builder image picker - Form builder image picker for flutter

form_builder_image_picker Field for picking image(s) from Gallery or Camera for

Ferri Sutanto 0 Jan 28, 2022
Cupertino version of the Material Stepper in Flutter

Cupertino Stepper for Flutter Cupertino version of the stock Material Stepper in Flutter. NOTE: This is not the same as the UIStepper control on iOS.

J-P Nurmi 18 Oct 13, 2022
Cupertino back gesture - Flutter package to set custom width of iOS back swipe gesture area

cupertino_back_gesture A Flutter package to set custom width of iOS back swipe gesture area. Usage To use this package, add cupertino_back_gesture as

null 28 Dec 7, 2022
Material & Cupertino SpinBox for Flutter

SpinBox for Flutter SpinBox for Flutter is a numeric input widget with an input field for entering a specific value, and spin buttons for quick, conve

J-P Nurmi 26 Nov 30, 2022
Target the specific design of Material for Android and Cupertino for iOS widgets through a common set of Platform aware widgets

Flutter Platform Widgets This project is an attempt to see if it is possible to create widgets that are platform aware. Currently in order to render t

null 1.3k Jan 4, 2023
Target the specific design of Material for Android and Cupertino for iOS widgets through a common set of Platform aware widgets

Flutter Platform Widgets This project is an attempt to see if it is possible to create widgets that are platform aware. Currently in order to render t

null 1.3k Jan 4, 2023
Custom calendar dialog widget for flutter with (multi select, single select, date range) mode

some calendar Custom calendar with Multi-select & range configurable calendar New Features Added View Mode Somecalendar #15 Help Maintenance I've take

Irvan Lutfi Gunawan 69 Jan 3, 2023
A lightweight flutter plugin to check if your app is up-to-date on Google Play Store or Apple App Store

App Version Checker this package is used to check if your app has a new version on playstore or apple app store. or you can even check what is the lat

Iheb Briki 6 Dec 14, 2022
Z time ago - A simple Flutter z time ago package used to change date to time ago for english, arabic and kurdish languages

This package is used to get time duration from now and given time for kurdish, a

Zakarya Muhammad 2 May 19, 2022
👉 A light-weight Emoji 📦 for Flutter and Dart-based applications with all up-to-date emojis 😄. Made from 💯% ☕ with ❤️!

flutter_emoji ?? A light-weight Emoji ?? for Flutter and Dart-based applications with all up-to-date emojis ?? . Made from ?? % ☕ with ❤️ ! Inspired f

Pete Houston 67 Nov 4, 2022
Dart library for parsing relative date and time.

Dateparser Dart library for parsing relative date and time. Examples just now a moment ago tomorrow today yesterday 10 days remaining 2 hours ago 2 mo

Mensch272 5 Sep 20, 2022
🎮 Style your flutter game with a beautiful splash screen.

Flame Splash Screen Style your flame game with a beautiful splash screen. This package includes a FlameSplashScreen widget. Install Add flame_splash_s

Flame Engine 38 Sep 13, 2022
Flutter page widget that is dismissed by swipe gestures, with Hero style animations, Inspired by Facebook and Instagram stories.

dismissible_page ?? ?? Creates page that is dismissed by swipe gestures, with Hero style animations, Inspired by FB, IG stories. Live Demo Contents Su

Tornike 76 Dec 22, 2022