Radio

String _character = 'A';
 
Radio<String>(
  value: 'A', // 代表的值
  groupValue: _character, // 当前radio group选中的值,当该值与value值匹配时则被选中
  onChanged: (String newValue) {
    setState(() { // 点击当前控件时更新状态
      _character = newValue;
    });
  },
),
Radio<String>(
  value: 'B',
  groupValue: _character,
  onChanged: (String newValue) {
    setState(() {
      _character = newValue;
    });
  },
),
Radio<String>(
  value: 'C',
  groupValue: _character,
  onChanged: (String newValue) {
    setState(() {
      _character = newValue;
    });
  },
)

 

posted @ 2020-03-13 15:39  lai1322  阅读(178)  评论(0编辑  收藏  举报