Make the focus node on SelectableRegion optional. (#158994)
## Description This makes the `focusNode` for `SelectableRegion` optional so that: - Users of the widget are no longer required to use `SelectableRegion` from within a `StatefulWidget` - They aren't likely to forget to dispose of a node they didn't supply. - Simpler to use, and the node is not used very often anyhow. Also made the `SelectableRegion` sample actually use `SelectableRegion`. ## Tests - Modified all the `SelectableRegion` tests to remove 3 identical lines of boilerplate from each (except 2, which actually used their focus nodes).
This commit is contained in:
@@ -15,7 +15,8 @@ class SelectableRegionExampleApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: SelectionArea(
|
||||
home: SelectableRegion(
|
||||
selectionControls: materialTextSelectionControls,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(title: const Text('SelectableRegion Sample')),
|
||||
body: const Center(
|
||||
|
||||
Reference in New Issue
Block a user