flutter控件之RadioButton import 'package:flutter/material.dart';
class LearnRadioButton extends StatefulWidget{
@override
State<StatefulWidget> createState() {
return new _LearnRadioButton();
}
}
class _LearnRadioButton extends State<LearnRadioButton>{
int groupValue=1;
@override
htmlradio设置默认的按钮Widget build(BuildContext context) {
return new Scaffold(
body: new Column(
mainAxisAlignment: ,
children: <Widget>[
new Radio(value: 0, groupValue: 0, onChanged: null),//onChanged为null表⽰按钮不可⽤
new Radio(
value: 1,
groupValue: groupValue,//当value和groupValue⼀致的时候则选中
activeColor: d,
onChanged: (T){
updateGroupValue(T);
}
),
new Radio(
value: 2,
groupValue: groupValue,
onChanged: (T){
updateGroupValue(T);
}
),
new Radio(
value: 3,
groupValue: groupValue,
onChanged: (T){
updateGroupValue(T);
}
),
new Radio(
value: 4,
groupValue: groupValue,
onChanged: (T){
updateGroupValue(T);
}
)
,
new Radio(
value: 5,
groupValue: groupValue,
onChanged: (T){
updateGroupValue(T);
}
),
new Radio(
value: 6,
groupValue: groupValue,
onChanged: (T){
updateGroupValue(T);
}
),
new RadioListTile(
value: 7,
groupValue: groupValue,
title: new Text('⼩张'),
onChanged: (T){
updateGroupValue(T);
}),
new RadioListTile(
value: 8,
groupValue: groupValue,

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。