Skip to content

Commit 32a6914

Browse files
committed
[animations] Refactor Radio widgets in example
Refactors the `shared_axis_transition.dart` example to use a new `RadioGroup` widget. This removes the deprecated `groupValue` and `onChanged` properties from each individual `Radio` button
1 parent 287739d commit 32a6914

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

packages/animations/example/lib/shared_axis_transition.dart

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -76,34 +76,28 @@ class _SharedAxisTransitionDemoState extends State<SharedAxisTransitionDemo> {
7676
),
7777
),
7878
const Divider(thickness: 2.0),
79-
Row(
80-
mainAxisAlignment: MainAxisAlignment.center,
81-
children: <Widget>[
82-
Radio<SharedAxisTransitionType>(
83-
value: SharedAxisTransitionType.horizontal,
84-
groupValue: _transitionType,
85-
onChanged: (SharedAxisTransitionType? newValue) {
86-
_updateTransitionType(newValue);
87-
},
88-
),
89-
const Text('X'),
90-
Radio<SharedAxisTransitionType>(
91-
value: SharedAxisTransitionType.vertical,
92-
groupValue: _transitionType,
93-
onChanged: (SharedAxisTransitionType? newValue) {
94-
_updateTransitionType(newValue);
95-
},
96-
),
97-
const Text('Y'),
98-
Radio<SharedAxisTransitionType>(
99-
value: SharedAxisTransitionType.scaled,
100-
groupValue: _transitionType,
101-
onChanged: (SharedAxisTransitionType? newValue) {
102-
_updateTransitionType(newValue);
103-
},
104-
),
105-
const Text('Z'),
106-
],
79+
RadioGroup<SharedAxisTransitionType>(
80+
groupValue: _transitionType,
81+
onChanged: (SharedAxisTransitionType? newValue) {
82+
_updateTransitionType(newValue);
83+
},
84+
child: Row(
85+
mainAxisAlignment: MainAxisAlignment.center,
86+
children: <Widget>[
87+
Radio<SharedAxisTransitionType>(
88+
value: SharedAxisTransitionType.horizontal,
89+
),
90+
const Text('X'),
91+
Radio<SharedAxisTransitionType>(
92+
value: SharedAxisTransitionType.vertical,
93+
),
94+
const Text('Y'),
95+
Radio<SharedAxisTransitionType>(
96+
value: SharedAxisTransitionType.scaled,
97+
),
98+
const Text('Z'),
99+
],
100+
),
107101
),
108102
],
109103
),

0 commit comments

Comments
 (0)