dylanwuzh / flutter-cupertino-date-picker Goto Github PK
View Code? Open in Web Editor NEWFlutter cupertino style date picker.
License: Apache License 2.0
Flutter cupertino style date picker.
License: Apache License 2.0
怎么获取未来几天的日期信息,比如未来五天日期多少,每天是周几
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
there is packages instead of package in
'import 'packages:flutter_cupertino_date_picker/flutter_cupertino_date_picker.dart';'
如题。
如果不能支持一个时间段的选择,那么用户在选择时间段的时候,就需要点两次弹出时间窗口。如果插件能实现选时间段的功能,就可以比较好的优化一个用户交互。
谢谢。
You cannot set the minute divider when creating the DatePicker to use on the bottom sheet.
I used the library to integrate the DatePickerWidget and everything is fine.
But unfortunately I need to do the integration tests, but unfortunately I couldn't do them on the DatePickerWidget object.
I wanted to ask but is there any documentation to do this kind of test on the DatePickerWidget?
Please add Italian language
const List<String> IT_WEEKS_SHORT = [ "Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do", ];
const List<String> IT_WEEKS = [ "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato", "Domenica", ];
const List<String> IT_MONTHS = [ "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre" ];
const Map<DateTimePickerLocale, String> CANCEL = { DateTimePickerLocale.it: 'Annulla', }
const Map<DateTimePickerLocale, String> DONE = { DateTimePickerLocale.it: 'Salva', }
Thanks
能否只选择年月?showDatePicker默认可以选择年月日
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'.
i would like to implement dual time picker in my app where the user can pick the date & time in one model though I haven't seen documentation for that, any suggestions?
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
现在有onChanged事件和onConfirm事件,能不能加上取消按钮的事件,也就是onCancel事件
Hello, thank you for your codes. What should I do if I want to support "yyyy-MM-dd HH: mm"
如年月 月日等。
有没有办法去控制分钟只显示指定的几个值呢
const String MIN_DATETIME = '2019-08-25';
const String MAX_DATETIME = '2029-08-29';
const String INIT_DATETIME = '2019-05-17';
const String DATE_FORMAT = 'MM月|d日,yyyy年';
DatePickerWidget 滑动月一格,选择为9月25日,onChange回调为9月07日
可以标题跟取消和确定按钮同时存在吗?
I have added french translation which we could add to the package
打开工程的时候报错:
FAILURE: Build failed with an exception.
Where:
Build file 'D:\demo_flutter\flutter-cupertino-date-picker-master\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 0s
Command: D:\demo_flutter\flutter-cupertino-date-picker-master\example\android\gradlew.bat app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Version
6.1.7601], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.
2)
[√] Android Studio (version 3.5)
[√] Connected device (1 available)
• No issues found!
When locale is switched to 'us', there is no Confirm/Done button.
Change month to 11, date to 30, then change month to 12, but the date of 31 isn't shown automatically.
No major issues on flutter web so far. Nice work.
I need minimum month and minimum day, because i am using for reservation hotel.
so if my customer order, choose the date that has passed.
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
I know there is a onConfirm callback, but using it doesn't solve my problem. :(
I'm using the widget with locale = DateTimePickerLocale.es, and the name of month "january" (must appear like enero) is not appearing well. Instead, the name is like a concatenation of "day of week" with month's name.
For example:
My widget:
FlatButton(
onPressed: () {
DatePicker.showDatePicker(context,
onConfirm: _onConfirm;
}, onClose: _onCLose,
pickerMode: DateTimePickerMode.datetime,
initialDateTime: DateTime.now(),
locale: DateTimePickerLocale.es,
dateFormat: 'EEE dd MMMM yyyy HH mm'
);
},
child: .... }
I expected to see: "Sab 04 Enero 2020 17 55" but i got "Sab 04 Sabnero 2020 17 55"
That's happening only with that month, the others seem to be fine
自定义title里面有确定按钮,怎么绑定自定义title里面的确定按钮走show方法里面的onConfirm方法?如果不能,怎么用自定义的按钮获取到pick的当前值?
Hi,
thanks for this package!
Could you provide a feature to only show / allow minutes in steps?
Instead of every minute (0-59) just every 5th minute. E.g. (0, 5, 10, 15) or (0, 15, 30, 45)
Would this be possible?
Thanks.
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 !
Here are the steps performed over the example app:
en
If I scroll days down a bit the correct numbers appear but initially they are absent.
Is there any way to change the color of the text from Blue to my own color for DONE which comes for actions. Thanks
i.e.:
Make it possible to keep the picker displayed despite page clicks
Let the Picker displace the Page content so as to not hide fields which are under it (like the keyboard). To keep the field in focus when the Picker is opened.
There may be an easy way to do that, I'm still fairly new to Flutter and trying to get my hangs around it.
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 ?
Please add support for 12 hours format in the DateTimePicker
能否限制,点击屏幕,点在控件外部范围时,是否取消显示?
目前点击控件外是直接取消控件,能否加一个,只能点击自定义取消按钮,才能关闭?
Can you give me a simple example? Thanks
please update pubspec.yaml to set flutter with out <1.0.0
These two fields are not playing nice together.
DatePicker.showDatePicker(
context,
minDateTime: _startTime,
initialDateTime: _endTime,
pickerMode: DateTimePickerMode.time,
pickerTheme: DateTimePickerTheme(
showTitle: true,
),
dateFormat: 'H:mm',
locale: DateTimePickerLocale.en_us,
onCancel: (){
deselectInput();
},
onClose: (){
deselectInput();
},
onChange: (dateTime, List<int> index) {
deselectInput();
},
onConfirm: (dateTime, List<int> index) {
handleEndChange(dateTime);
deselectInput();
},
)
With this setup, If I pass 18:10 into a second time picker, it will return 18:<00 -> 50> rather is should be returning range from 10 -> 59
This is de Code i'm executing:
FormField(
builder: (state) {
return FlatButton(
child: Text("OPEN BOTTOM SHEET"),
onPressed: () {
showModalBottomSheet(
context: context,
builder: (context) {
// return Text('HELLO WORLD');
return DatePickerWidget();
});
},
);
},
),
If i replace the DatePickerWidget with a simple Text, the white bottom sheet adjust to the content perfectly and no white space is between the text and the bottom of the screen
We use the TimePicker a lot. It would be great if it could support numeric keyboard input to type a specific HH:mm time faster.
Example:
I also requested this for the Cupertino Datepicker from Flutter, however they are not going to implement it because its not a specific iOS (Cupertino) feature. See: @flutter/flutter#28633
Maybe this is something you want to implement?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.