|
|
@@ -35,10 +35,13 @@ class HomePage extends StatelessWidget {
|
|
|
maxTime: DateTime(2019, 6, 7),
|
|
|
theme: DatePickerTheme(
|
|
|
backgroundColor: Colors.blue,
|
|
|
- itemStyle: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
|
|
- doneStyle: TextStyle(color: Colors.white, fontSize: 16)),
|
|
|
+ itemStyle: TextStyle(
|
|
|
+ color: Colors.white, fontWeight: FontWeight.bold),
|
|
|
+ doneStyle:
|
|
|
+ TextStyle(color: Colors.white, fontSize: 16)),
|
|
|
onChanged: (date) {
|
|
|
- print('change $date');
|
|
|
+ print('change $date in time zone ' +
|
|
|
+ date.timeZoneOffset.inHours.toString());
|
|
|
}, onConfirm: (date) {
|
|
|
print('confirm $date');
|
|
|
}, currentTime: DateTime.now(), locale: LocaleType.en);
|
|
|
@@ -49,11 +52,13 @@ class HomePage extends StatelessWidget {
|
|
|
)),
|
|
|
FlatButton(
|
|
|
onPressed: () {
|
|
|
- DatePicker.showTimePicker(context, showTitleActions: true, onChanged: (date) {
|
|
|
- print('change $date ' + date.timeZoneOffset.toString());
|
|
|
+ DatePicker.showTimePicker(context, showTitleActions: true,
|
|
|
+ onChanged: (date) {
|
|
|
+ print('change $date in time zone ' +
|
|
|
+ date.timeZoneOffset.inHours.toString());
|
|
|
}, onConfirm: (date) {
|
|
|
print('confirm $date');
|
|
|
- }, currentTime: DateTime.now().toUtc());
|
|
|
+ }, currentTime: DateTime.now());
|
|
|
},
|
|
|
child: Text(
|
|
|
'show time picker',
|
|
|
@@ -61,11 +66,15 @@ class HomePage extends StatelessWidget {
|
|
|
)),
|
|
|
FlatButton(
|
|
|
onPressed: () {
|
|
|
- DatePicker.showDateTimePicker(context, showTitleActions: true, onChanged: (date) {
|
|
|
- print('change $date');
|
|
|
+ DatePicker.showDateTimePicker(context, showTitleActions: true,
|
|
|
+ onChanged: (date) {
|
|
|
+ print('change $date in time zone ' +
|
|
|
+ date.timeZoneOffset.inHours.toString());
|
|
|
}, onConfirm: (date) {
|
|
|
print('confirm $date');
|
|
|
- }, currentTime: DateTime(2008, 12, 31, 23, 12, 34), locale: LocaleType.zh);
|
|
|
+ },
|
|
|
+ currentTime: DateTime(2008, 12, 31, 23, 12, 34),
|
|
|
+ locale: LocaleType.zh);
|
|
|
},
|
|
|
child: Text(
|
|
|
'show date time picker (Chinese)',
|
|
|
@@ -73,8 +82,10 @@ class HomePage extends StatelessWidget {
|
|
|
)),
|
|
|
FlatButton(
|
|
|
onPressed: () {
|
|
|
- DatePicker.showDateTimePicker(context, showTitleActions: true, onChanged: (date) {
|
|
|
- print('change $date');
|
|
|
+ DatePicker.showDateTimePicker(context, showTitleActions: true,
|
|
|
+ onChanged: (date) {
|
|
|
+ print('change $date in time zone ' +
|
|
|
+ date.timeZoneOffset.inHours.toString());
|
|
|
}, onConfirm: (date) {
|
|
|
print('confirm $date');
|
|
|
}, currentTime: DateTime(2008, 12, 31, 23, 12, 34));
|
|
|
@@ -85,11 +96,15 @@ class HomePage extends StatelessWidget {
|
|
|
)),
|
|
|
FlatButton(
|
|
|
onPressed: () {
|
|
|
- DatePicker.showDateTimePicker(context, showTitleActions: true, onChanged: (date) {
|
|
|
- print('change $date');
|
|
|
+ DatePicker.showDateTimePicker(context, showTitleActions: true,
|
|
|
+ onChanged: (date) {
|
|
|
+ print('change $date in time zone ' +
|
|
|
+ date.timeZoneOffset.inHours.toString());
|
|
|
}, onConfirm: (date) {
|
|
|
print('confirm $date');
|
|
|
- }, currentTime: DateTime(2008, 12, 31, 23, 12, 34), locale: LocaleType.nl);
|
|
|
+ },
|
|
|
+ currentTime: DateTime(2008, 12, 31, 23, 12, 34),
|
|
|
+ locale: LocaleType.nl);
|
|
|
},
|
|
|
child: Text(
|
|
|
'show date time picker (Dutch)',
|
|
|
@@ -97,11 +112,15 @@ class HomePage extends StatelessWidget {
|
|
|
)),
|
|
|
FlatButton(
|
|
|
onPressed: () {
|
|
|
- DatePicker.showDateTimePicker(context, showTitleActions: true, onChanged: (date) {
|
|
|
- print('change $date');
|
|
|
+ DatePicker.showDateTimePicker(context, showTitleActions: true,
|
|
|
+ onChanged: (date) {
|
|
|
+ print('change $date in time zone ' +
|
|
|
+ date.timeZoneOffset.inHours.toString());
|
|
|
}, onConfirm: (date) {
|
|
|
print('confirm $date');
|
|
|
- }, currentTime: DateTime(2008, 12, 31, 23, 12, 34), locale: LocaleType.ru);
|
|
|
+ },
|
|
|
+ currentTime: DateTime(2008, 12, 31, 23, 12, 34),
|
|
|
+ locale: LocaleType.ru);
|
|
|
},
|
|
|
child: Text(
|
|
|
'show date time picker (Russian)',
|
|
|
@@ -109,14 +128,18 @@ class HomePage extends StatelessWidget {
|
|
|
)),
|
|
|
FlatButton(
|
|
|
onPressed: () {
|
|
|
- DatePicker.showDateTimePicker(context, showTitleActions: true, onChanged: (date) {
|
|
|
- print('change $date');
|
|
|
+ DatePicker.showDateTimePicker(context, showTitleActions: true,
|
|
|
+ onChanged: (date) {
|
|
|
+ print('change $date in time zone ' +
|
|
|
+ date.timeZoneOffset.inHours.toString());
|
|
|
}, onConfirm: (date) {
|
|
|
print('confirm $date');
|
|
|
- }, currentTime: DateTime(2019, 12, 31, 23, 12, 34), locale: LocaleType.de);
|
|
|
+ },
|
|
|
+ currentTime: DateTime.utc(2019, 12, 31, 23, 12, 34),
|
|
|
+ locale: LocaleType.de);
|
|
|
},
|
|
|
child: Text(
|
|
|
- 'show date time picker (German)',
|
|
|
+ 'show date time picker in UTC (German)',
|
|
|
style: TextStyle(color: Colors.blue),
|
|
|
)),
|
|
|
],
|