forked from firka/flutter
Add toggleable attribute to Radio (#53846)
This adds a new toggleable attribute to the Radio widget. This allows a radio group to be set back to an indeterminate state if the selected radio button is selected again. Fixes #53791
This commit is contained in:
@@ -40,8 +40,10 @@ bool _isRadioSelected(int index) =>
|
||||
List<Radio<Location>> get _radios => List<Radio<Location>>.from(
|
||||
_radioFinder.evaluate().map<Widget>((Element e) => e.widget));
|
||||
|
||||
// [find.byType] and [find.widgetWithText] do not match subclasses; `Radio` is not sufficient to find a `Radio<_Location>`.
|
||||
// Another approach is to grab the `runtimeType` of a dummy instance; see packages/flutter/test/material/control_list_tile_test.dart.
|
||||
// [find.byType] and [find.widgetWithText] do not match subclasses; `Radio` is
|
||||
// not sufficient to find a `Radio<_Location>`. Another approach is to grab the
|
||||
// `runtimeType` of a dummy instance; see
|
||||
// packages/flutter/test/material/radio_list_tile_test.dart.
|
||||
Finder get _radioFinder =>
|
||||
find.byWidgetPredicate((Widget w) => w is Radio<Location>);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user