GitHub

    Table of contents

  1. 示例
  2. 相关链接

RadioListTile

Edit this page

A ListTile with a Radio. In other words, a radio button with a label.

示例

enum SingingCharacter { lafayette, jefferson }

// ...

SingingCharacter _character = SingingCharacter.lafayette;


Widget build(BuildContext context) {
  return Column(
    children: <Widget>[
      RadioListTile<SingingCharacter>(
        title: const Text('Lafayette'),
        value: SingingCharacter.lafayette,
        groupValue: _character,
        onChanged: (SingingCharacter value) { setState(() { _character = value; }); },
      ),
      RadioListTile<SingingCharacter>(
        title: const Text('Thomas Jefferson'),
        value: SingingCharacter.jefferson,
        groupValue: _character,
        onChanged: (SingingCharacter value) { setState(() { _character = value; }); },
      ),
    ],
  );
}

相关链接