我需要创建一个位于 TextFormField
旁边的自定义小部件s,所以我必须设置它的标签样式以匹配 TextFormField
的标签样式。
这不起作用:
Theme.of(ctx).inputDecorationTheme.labelStyle
因为,根据其文档:
If null, defaults to a value derived from the base [TextStyle] for the input field and the current [Theme].
问题是,我不知道如何获得这种基本风格。
最佳答案
您正确地获得了基本样式。就我而言 labelStyle
和 hintStyle
来自 InputDecorationTheme
无法更新 热重载 ,但它们在 时起作用重新运行 应用程序。
关于flutter - 获取 TextFormField 的 InputDecoration 标签的默认主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55687252/