Flutter学习之旅-RadioListTitle

1.简介

Material Design 风格的单选按钮附加文字label
点击文字同时,将会触发Radio的点击效果

2.示例代码

class DemoA extends StatefulWidget {
 _Demo createState() => _Demo();
}

class _Demo extends State {
 String value = '';

 onChange(v){
   this.setState((){
     value = v;
   });
 }
 
 @override
   Widget build(BuildContext context) {
     return Column(
       children: [
         RadioListTile(
           title: Text('A'),
           value: "A",
           groupValue: this.value,
           isThreeLine: false,
           subtitle: Text('subtitleA'),
           onChanged: onChange,
         ),
         RadioListTile(
           title: Text('B'),
           value: "B",
           groupValue: this.value,
           isThreeLine: false,
           subtitle: Text('subtitleB'),
           onChanged: onChange,
         )
       ],
     );
   }
} 

你可能感兴趣的:(Flutter学习之旅-RadioListTitle)