简体   繁体   中英

Flutter showTimePicker height

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. 在此处输入图像描述

I solved this question below code.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM