如何设置 Flutter Form Builder Radio Group 选项的样式?
我正在使用 Flutter Form Builder 和 FormBuilderRadioGroup
但我不知道了解如何设置始终为黑色的选项的样式。更改应用程序的主要样本没有任何区别。下面代码中的颜色选项也不起作用。标签样式有效,但选项内容样式无效。所选选项始终为蓝色。
我的表单有深色背景,我需要选项内容为白色。
FormBuilderRadioGroup(
name: "role",
decoration: InputDecoration(
labelText: "Role",
labelStyle: TextStyle(color: personLabelColor, fontSize: _user.fontsize, fontWeight: FontWeight.normal),
fillColor: Colors.red,
focusColor: Colors.blue,
hoverColor: Colors.yellow,
),
options: const [
FormBuilderFieldOption(value: 0),
FormBuilderFieldOption(value: 1),
FormBuilderFieldOption(value: 2),
FormBuilderFieldOption(value: 3),
FormBuilderFieldOption(value: 4),
FormBuilderFieldOption(value: 5),
],
initialValue: _person.role,
),
I am using Flutter Form Builder with a FormBuilderRadioGroup
but I can't figure out how to style the options which are always black. Changing the app's primary swatch makes no difference. The color options in the code below also have no effect. The label style works but not the options content style. The selected option is always blue.
My form has a dark background and I need the options content to be white.
FormBuilderRadioGroup(
name: "role",
decoration: InputDecoration(
labelText: "Role",
labelStyle: TextStyle(color: personLabelColor, fontSize: _user.fontsize, fontWeight: FontWeight.normal),
fillColor: Colors.red,
focusColor: Colors.blue,
hoverColor: Colors.yellow,
),
options: const [
FormBuilderFieldOption(value: 0),
FormBuilderFieldOption(value: 1),
FormBuilderFieldOption(value: 2),
FormBuilderFieldOption(value: 3),
FormBuilderFieldOption(value: 4),
FormBuilderFieldOption(value: 5),
],
initialValue: _person.role,
),
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用主题中的
unselectedWidgetColor
更改单选按钮上的默认黑色/灰色。或者您可以使用
radioTheme
的fillColor
来更改此设置。FormBuilderRadioGroup
上的activeColor
更改所选单选按钮的默认蓝色。Using
unselectedWidgetColor
from theme, change the default black/gray color on radio button.Or you can use
radioTheme
'sfillColor
to change this.activeColor
onFormBuilderRadioGroup
change the default blue color of selected radio button.