How to change font size for CupertinoDatePicker in

2020-04-18 09:17发布

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.

2条回答
家丑人穷心不美
2楼-- · 2020-04-18 09:54

Another way to do this, is to wrap the CupertinoDatePicker in CupertinoTheme.

CupertinoTheme(
    data: CupertinoThemeData(
        textTheme: CupertinoTextThemeData(
            dateTimePickerTextStyle: TextStyle(
                fontSize: 16,
            ),
        ),
     ),
     child: CupertinoDatePicker(
          ...
查看更多
趁早两清
3楼-- · 2020-04-18 10:09

Finally got it, works as expected.

DefaultTextStyle.merge(
      style: TextStyle(fontSize: 20),
      child: CupertinoDatePicker(....)
)
查看更多
登录 后发表回答