- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我一直在尝试通过单击 RaisedButton
为 RadioListTile
提供背景颜色,并创建一个函数将该颜色分配给 RadioListTile
包含特定的 value
,例如 value: 2
。我正在使用 StatefulWidget
。
代码:
int _radioValue = 0;
int _answer = 2;
void _handleRadioValueChange(int value) {
setState(() {
_radioValue = value;
});
}
Scaffold(
appBar: AppBar(
title: Text('Question #1'),
backgroundColor: Colors.teal,
),
body: ListTileTheme(
child: ListView(
children: <Widget>[
Container(
padding: EdgeInsets.all(20.0),
margin: EdgeInsets.all(10.0),
color: Colors.tealAccent,
child: Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec porttitor laoreet volutpat. Suspendisse malesuada ante. ',
textAlign: TextAlign.center,
),
),
RadioListTile(
title: Text('Option #1'),
value: 0,
groupValue: _radioValue,
onChanged: _handleRadioValueChange,
),
RadioListTile(
title: Text('Option #2'),
value: 1,
groupValue: _radioValue,
onChanged: _handleRadioValueChange,
),
RadioListTile(
title: Text('Option #3'),
value: 2,
groupValue: _radioValue,
onChanged: _handleRadioValueChange,
),
RadioListTile(
title: Text('Option #4'),
value: 3,
groupValue: _radioValue,
onChanged: _handleRadioValueChange,
),
RadioListTile(
title: Text('Option #5'),
value: 4,
groupValue: _radioValue,
onChanged: _handleRadioValueChange,
),
RaisedButton(
child: Text('Show Answer'),
onPressed: (){},
color: Colors.tealAccent,
splashColor: Colors.teal,
),
],
),
),
);
最佳答案
关于flutter - 如何使用 RaisedButton 为 RadioListTile 提供背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52390623/
我对 Flutter 和 Dart 很陌生,我似乎找不到任何关于这个特定主题的提示。我正在尝试将 3 个 RadioListTiles 放在 Row 中,如下所示: Row( chil
几天来,我一直试图弄清楚我的错误在哪里,但仍然无法解决。 Flutter 的绝对新手,我正在构建多项选择测验应用程序。我有多项选择问题屏幕,它从如下所示的 radio_button.dart 文件中导
我正在尝试使用 RadioListTile 做多项选择题。 RadioListTile( value: 1, groupValue: 1, onChanged: (val) { p
我正在尝试使用 RadioListTile 做多项选择题。 RadioListTile( value: 1, groupValue: 1, onChanged: (val) { p
我在RadioLisTile中设置了激活颜色 RadioListTile( title: Text(item.itemName, style: TextStyle(color: Color
我正在使用 RadioListTile我的应用程序中的小部件,我想在满足某些条件后禁用更改值。并且没有isButtonDisabled就像 Radio 中的 Prop 小部件。如何禁用此小部件(阻止值
我正在尝试制作一个可选择的 ListView 。 我选择了 RadioListTile ,但它不需要与 Radios 一起使用,我会很高兴 ListTile 的背景颜色变化> 点击项目。所以在我当前的
我一直在尝试通过单击 RaisedButton 为 RadioListTile 提供背景颜色,并创建一个函数将该颜色分配给 RadioListTile包含特定的 value,例如 value: 2。我
我正在尝试进行一些 ui 自定义,但我不知道如何减少 Flutter 中 Radio 或 RadioList 的填充。 我们能做到吗? 最佳答案 如果您正在使用 RadioListTile,则将 de
我是一名优秀的程序员,十分优秀!