Auto-format Framework (#160545)
This auto-formats all *.dart files in the repository outside of the `engine` subdirectory and enforces that these files stay formatted with a presubmit check. **Reviewers:** Please carefully review all the commits except for the one titled "formatted". The "formatted" commit was auto-generated by running `dev/tools/format.sh -a -f`. The other commits were hand-crafted to prepare the repo for the formatting change. I recommend reviewing the commits one-by-one via the "Commits" tab and avoiding Github's "Files changed" tab as it will likely slow down your browser because of the size of this PR. --------- Co-authored-by: Kate Lovett <katelovett@google.com> Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8e0993eda8
commit
5491c8c146
@@ -10,11 +10,7 @@ const List<Widget> fruits = <Widget>[Text('Apple'), Text('Banana'), Text('Orange
|
||||
|
||||
const List<Widget> vegetables = <Widget>[Text('Tomatoes'), Text('Potatoes'), Text('Carrots')];
|
||||
|
||||
const List<Widget> icons = <Widget>[
|
||||
Icon(Icons.sunny),
|
||||
Icon(Icons.cloud),
|
||||
Icon(Icons.ac_unit),
|
||||
];
|
||||
const List<Widget> icons = <Widget>[Icon(Icons.sunny), Icon(Icons.cloud), Icon(Icons.ac_unit)];
|
||||
|
||||
void main() => runApp(const ToggleButtonsExampleApp());
|
||||
|
||||
@@ -75,10 +71,7 @@ class _ToggleButtonsSampleState extends State<ToggleButtonsSample> {
|
||||
selectedColor: Colors.white,
|
||||
fillColor: Colors.red[200],
|
||||
color: Colors.red[400],
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: 40.0,
|
||||
minWidth: 80.0,
|
||||
),
|
||||
constraints: const BoxConstraints(minHeight: 40.0, minWidth: 80.0),
|
||||
isSelected: _selectedFruits,
|
||||
children: fruits,
|
||||
),
|
||||
@@ -99,10 +92,7 @@ class _ToggleButtonsSampleState extends State<ToggleButtonsSample> {
|
||||
selectedColor: Colors.white,
|
||||
fillColor: Colors.green[200],
|
||||
color: Colors.green[400],
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: 40.0,
|
||||
minWidth: 80.0,
|
||||
),
|
||||
constraints: const BoxConstraints(minHeight: 40.0, minWidth: 80.0),
|
||||
isSelected: _selectedVegetables,
|
||||
children: vegetables,
|
||||
),
|
||||
|
||||
@@ -16,14 +16,13 @@ class ToggleButtonsApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const Scaffold(
|
||||
body: ToggleButtonsExample(),
|
||||
),
|
||||
home: const Scaffold(body: ToggleButtonsExample()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
enum ShirtSize { extraSmall, small, medium, large, extraLarge }
|
||||
|
||||
const List<(ShirtSize, String)> shirtSizeOptions = <(ShirtSize, String)>[
|
||||
(ShirtSize.extraSmall, 'XS'),
|
||||
(ShirtSize.small, 'S'),
|
||||
@@ -40,7 +39,8 @@ class ToggleButtonsExample extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ToggleButtonsExampleState extends State<ToggleButtonsExample> {
|
||||
final List<bool> _toggleButtonsSelection = ShirtSize.values.map((ShirtSize e) => e == ShirtSize.medium).toList();
|
||||
final List<bool> _toggleButtonsSelection =
|
||||
ShirtSize.values.map((ShirtSize e) => e == ShirtSize.medium).toList();
|
||||
Set<ShirtSize> _segmentedButtonSelection = <ShirtSize>{ShirtSize.medium};
|
||||
|
||||
@override
|
||||
@@ -62,14 +62,9 @@ class _ToggleButtonsExampleState extends State<ToggleButtonsExample> {
|
||||
});
|
||||
},
|
||||
// Constraints are used to determine the size of each child widget.
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: 32.0,
|
||||
minWidth: 56.0,
|
||||
),
|
||||
constraints: const BoxConstraints(minHeight: 32.0, minWidth: 56.0),
|
||||
// ToggleButtons uses a List<Widget> to build its children.
|
||||
children: shirtSizeOptions
|
||||
.map(((ShirtSize, String) shirt) => Text(shirt.$2))
|
||||
.toList(),
|
||||
children: shirtSizeOptions.map(((ShirtSize, String) shirt) => Text(shirt.$2)).toList(),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Text('SegmentedButton'),
|
||||
@@ -92,11 +87,10 @@ class _ToggleButtonsExampleState extends State<ToggleButtonsExample> {
|
||||
},
|
||||
// SegmentedButton uses a List<ButtonSegment<T>> to build its children
|
||||
// instead of a List<Widget> like ToggleButtons.
|
||||
segments: shirtSizeOptions
|
||||
.map<ButtonSegment<ShirtSize>>(((ShirtSize, String) shirt) {
|
||||
return ButtonSegment<ShirtSize>(value: shirt.$1, label: Text(shirt.$2));
|
||||
})
|
||||
.toList(),
|
||||
segments:
|
||||
shirtSizeOptions.map<ButtonSegment<ShirtSize>>(((ShirtSize, String) shirt) {
|
||||
return ButtonSegment<ShirtSize>(value: shirt.$1, label: Text(shirt.$2));
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user