@@ -736,16 +736,16 @@ Widget build(BuildContext context) {
736736
737737### Radio
738738
739- A group of ` Radio ` buttons that allows the user to
739+ A ` RadioGroup ` contains ` Radio ` buttons that allow the user to
740740select between mutually exclusive values.
741741When the user selects a radio button in a group,
742742the other radio buttons are unselected.
743743
744- - A particular ` Radio ` button's ` value ` represent that button's value,
745- - The selected value for a group of radio buttons is identified by
744+ - A particular ` Radio ` button's ` value ` represent that button's value.
745+ - The selected value for a ` RadioGroup ` is identified by
746746 the ` groupValue ` parameter.
747- - ` Radio ` also has an ` onChanged ` callback that
748- gets triggered when users click it, like ` Switch ` and ` Checkbox `
747+ - ` RadioGroup ` has an ` onChanged ` callback that
748+ gets triggered when users click it, like ` Switch ` and ` Checkbox ` .
749749
750750{% render "docs/code-and-image.md",
751751image:"fwe/user-input/Radio.webp",
@@ -775,41 +775,29 @@ class _RadioExampleState extends State<RadioExample> {
775775
776776 @override
777777 Widget build(BuildContext context) {
778- return Column (
779- children: <Widget>[
780- ListTile(
781- title: const Text('Musician'),
782- leading: Radio<Character>(
783- value: Character.musician,
784- groupValue: _character ,
785- onChanged: setCharacter ,
778+ return RadioGroup (
779+ groupValue: _character,
780+ onChanged: setCharacter,
781+ child: Column(
782+ children: <Widget>[
783+ ListTile(
784+ title: const Text('Musician') ,
785+ leading: Radio<Character>(value: Character.musician) ,
786786 ),
787- ),
788- ListTile(
789- title: const Text('Chef'),
790- leading: Radio<Character>(
791- value: Character.chef,
792- groupValue: _character,
793- onChanged: setCharacter,
787+ ListTile(
788+ title: const Text('Chef'),
789+ leading: Radio<Character>(value: Character.chef),
794790 ),
795- ),
796- ListTile(
797- title: const Text('Firefighter'),
798- leading: Radio<Character>(
799- value: Character.firefighter,
800- groupValue: _character,
801- onChanged: setCharacter,
791+ ListTile(
792+ title: const Text('Firefighter'),
793+ leading: Radio<Character>(value: Character.firefighter),
802794 ),
803- ),
804- ListTile(
805- title: const Text('Artist'),
806- leading: Radio<Character>(
807- value: Character.artist,
808- groupValue: _character,
809- onChanged: setCharacter,
795+ ListTile(
796+ title: const Text('Artist'),
797+ leading: Radio<Character>(value: Character.artist),
810798 ),
811- ) ,
812- ] ,
799+ ] ,
800+ ) ,
813801 );
814802 }
815803}
0 commit comments