Flutter showTimePicker height

544 Views Asked by At

I use flutter and showTimePicker. The code below works correctly on most phones. But on some phones the height is not enough.

              TimeOfDay pickedTime = await showTimePicker(
                        context: context,
                        helpText: AppLocalizations.of(context)
                            .translate('select_time'),
                        cancelText: AppLocalizations.of(context)
                            .translate('not_now'),
                        confirmText:
                            AppLocalizations.of(context).translate('done'),
                        initialTime: TimeOfDay.now().add(),
                        initialEntryMode: TimePickerEntryMode.input,
                        builder: (context, childWidget) {
                          return MediaQuery(
                              data: MediaQuery.of(context)
                                  .copyWith(alwaysUse24HourFormat: true),
                              child: childWidget);
                        });

Corrupt image as below. enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

I solved this question below code.

return MediaQuery(
       data: MediaQuery.of(context).copyWith(
             alwaysUse24HourFormat: true,
             textScaleFactor: 1),
       child: childWidget);