如何在Flutter中更改CupertinoDatePicker的字体大小? [英] How to change font size for CupertinoDatePicker in Flutter?

查看:968
本文介绍了如何在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(
          ...

这篇关于如何在Flutter中更改CupertinoDatePicker的字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆