Update time picker to use 24-hour format (#1821)

master_archived
Qun Cheng 2 years ago committed by GitHub
parent 4d5acf97ca
commit 13cf346c1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1464,6 +1464,14 @@ class _TimePickersState extends State<TimePickers> {
final TimeOfDay? time = await showTimePicker( final TimeOfDay? time = await showTimePicker(
context: context, context: context,
initialTime: selectedTime ?? TimeOfDay.now(), initialTime: selectedTime ?? TimeOfDay.now(),
builder: (context, child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(
alwaysUse24HourFormat: true,
),
child: child!,
);
},
); );
setState(() { setState(() {
selectedTime = time; selectedTime = time;

@ -1464,6 +1464,14 @@ class _TimePickersState extends State<TimePickers> {
final TimeOfDay? time = await showTimePicker( final TimeOfDay? time = await showTimePicker(
context: context, context: context,
initialTime: selectedTime ?? TimeOfDay.now(), initialTime: selectedTime ?? TimeOfDay.now(),
builder: (context, child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(
alwaysUse24HourFormat: true,
),
child: child!,
);
},
); );
setState(() { setState(() {
selectedTime = time; selectedTime = time;

Loading…
Cancel
Save