美文网首页工作生活
Flutter学习之旅-RadioListTitle

Flutter学习之旅-RadioListTitle

作者: Self_Time | 来源:发表于2019-07-01 14:01 被阅读0次

1.简介

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

2.示例代码

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

class _Demo extends State<DemoA> {
 String value = '';

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

相关文章

网友评论

    本文标题:Flutter学习之旅-RadioListTitle

    本文链接:https://www.haomeiwen.com/subject/ugrgcctx.html