如何在Flutter中更改CupertinoDatePicker的字体大小?
问题描述:
我需要更改CupertinoDatePicker的字体大小,使其看起来更像本机字体.与ios datepicker相比,该字体很小.
对于高度为MediaQuery.of(context).copyWith().size.height / 3
的Container中的高度包装,应使高度类似于本机高度.
I need to change the font size of CupertinoDatePicker so it looks more like native one. The font is small compared to ios datepicker.
For the height wrapping in a Container with height of MediaQuery.of(context).copyWith().size.height / 3
makes the height to be similar to native one.
答
另一种方法是将CupertinoDatePicker
包装在CupertinoTheme
中.
Another way to do this, is to wrap the CupertinoDatePicker
in CupertinoTheme
.
CupertinoTheme(
data: CupertinoThemeData(
textTheme: CupertinoTextThemeData(
dateTimePickerTextStyle: TextStyle(
fontSize: 16,
),
),
),
child: CupertinoDatePicker(
...