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
@@ -16,9 +16,7 @@ class AbsorbPointerApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('AbsorbPointer Sample')),
|
||||
body: const Center(
|
||||
child: AbsorbPointerExample(),
|
||||
),
|
||||
body: const Center(child: AbsorbPointerExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -32,22 +30,13 @@ class AbsorbPointerExample extends StatelessWidget {
|
||||
return Stack(
|
||||
alignment: AlignmentDirectional.center,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 200.0,
|
||||
height: 100.0,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: null,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 200.0, height: 100.0, child: ElevatedButton(onPressed: () {}, child: null)),
|
||||
SizedBox(
|
||||
width: 100.0,
|
||||
height: 200.0,
|
||||
child: AbsorbPointer(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.blue.shade200,
|
||||
),
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.blue.shade200),
|
||||
onPressed: () {},
|
||||
child: null,
|
||||
),
|
||||
|
||||
@@ -32,12 +32,7 @@ class AspectRatioExample extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
width: double.infinity,
|
||||
height: 100.0,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 16 / 9,
|
||||
child: Container(
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
child: AspectRatio(aspectRatio: 16 / 9, child: Container(color: Colors.green)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,7 @@ class AspectRatioExample extends StatelessWidget {
|
||||
height: 100.0,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 2.0,
|
||||
child: Container(
|
||||
width: 100.0,
|
||||
height: 50.0,
|
||||
color: Colors.green,
|
||||
),
|
||||
child: Container(width: 100.0, height: 50.0, color: Colors.green),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,11 +34,7 @@ class AspectRatioExample extends StatelessWidget {
|
||||
height: 100.0,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 0.5,
|
||||
child: Container(
|
||||
width: 100.0,
|
||||
height: 50.0,
|
||||
color: Colors.green,
|
||||
),
|
||||
child: Container(width: 100.0, height: 50.0, color: Colors.green),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -35,10 +35,7 @@ class ClipRRectExample extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 300,
|
||||
maxHeight: 100,
|
||||
),
|
||||
constraints: const BoxConstraints(maxWidth: 300, maxHeight: 100),
|
||||
color: Colors.blue,
|
||||
child: const Text('No ClipRRect', style: style),
|
||||
),
|
||||
@@ -46,10 +43,7 @@ class ClipRRectExample extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 300,
|
||||
maxHeight: 100,
|
||||
),
|
||||
constraints: const BoxConstraints(maxWidth: 300, maxHeight: 100),
|
||||
color: Colors.green,
|
||||
child: const Text('ClipRRect', style: style),
|
||||
),
|
||||
@@ -63,10 +57,7 @@ class ClipRRectExample extends StatelessWidget {
|
||||
),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 300,
|
||||
maxHeight: 100,
|
||||
),
|
||||
constraints: const BoxConstraints(maxWidth: 300, maxHeight: 100),
|
||||
color: Colors.purple,
|
||||
child: const Text('ClipRRect', style: style),
|
||||
),
|
||||
|
||||
@@ -32,10 +32,7 @@ class ClipRRectExample extends StatelessWidget {
|
||||
constraints: const BoxConstraints.expand(),
|
||||
// Add a FittedBox to make ClipRRect sized accordingly to the image it contains
|
||||
child: FittedBox(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(40.0),
|
||||
child: const _FakedImage(),
|
||||
),
|
||||
child: ClipRRect(borderRadius: BorderRadius.circular(40.0), child: const _FakedImage()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,9 +18,7 @@ class CustomMultiChildLayoutApp extends StatelessWidget {
|
||||
// TRY THIS: Try changing the direction here and hot-reloading to
|
||||
// see the layout change.
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Scaffold(
|
||||
body: CustomMultiChildLayoutExample(),
|
||||
),
|
||||
child: Scaffold(body: CustomMultiChildLayoutExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,7 @@ class ExpandedApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Expanded Column Sample'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Expanded Column Sample')),
|
||||
body: const ExpandedExample(),
|
||||
),
|
||||
);
|
||||
@@ -32,22 +30,9 @@ class ExpandedExample extends StatelessWidget {
|
||||
return Center(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
color: Colors.blue,
|
||||
height: 100,
|
||||
width: 100,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
color: Colors.amber,
|
||||
width: 100,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
color: Colors.blue,
|
||||
height: 100,
|
||||
width: 100,
|
||||
),
|
||||
Container(color: Colors.blue, height: 100, width: 100),
|
||||
Expanded(child: Container(color: Colors.amber, width: 100)),
|
||||
Container(color: Colors.blue, height: 100, width: 100),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -15,9 +15,7 @@ class ExpandedApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Expanded Row Sample'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Expanded Row Sample')),
|
||||
body: const ExpandedExample(),
|
||||
),
|
||||
);
|
||||
@@ -32,24 +30,9 @@ class ExpandedExample extends StatelessWidget {
|
||||
return Center(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
color: Colors.amber,
|
||||
height: 100,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
color: Colors.blue,
|
||||
height: 100,
|
||||
width: 50,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
color: Colors.amber,
|
||||
height: 100,
|
||||
),
|
||||
),
|
||||
Expanded(flex: 2, child: Container(color: Colors.amber, height: 100)),
|
||||
Container(color: Colors.blue, height: 100, width: 50),
|
||||
Expanded(child: Container(color: Colors.amber, height: 100)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -16,9 +16,7 @@ class FittedBoxApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('FittedBox Sample')),
|
||||
body: const Center(
|
||||
child: FittedBoxExample(),
|
||||
),
|
||||
body: const Center(child: FittedBoxExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,12 +14,7 @@ class FlowApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Flow Example'),
|
||||
),
|
||||
body: const FlowMenu(),
|
||||
),
|
||||
home: Scaffold(appBar: AppBar(title: const Text('Flow Example')), body: const FlowMenu()),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -51,10 +46,7 @@ class _FlowMenuState extends State<FlowMenu> with SingleTickerProviderStateMixin
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
menuAnimation = AnimationController(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
vsync: this,
|
||||
);
|
||||
menuAnimation = AnimationController(duration: const Duration(milliseconds: 250), vsync: this);
|
||||
}
|
||||
|
||||
Widget flowMenuItem(IconData icon) {
|
||||
@@ -68,13 +60,11 @@ class _FlowMenuState extends State<FlowMenu> with SingleTickerProviderStateMixin
|
||||
constraints: BoxConstraints.tight(Size(buttonDiameter, buttonDiameter)),
|
||||
onPressed: () {
|
||||
_updateMenu(icon);
|
||||
menuAnimation.status == AnimationStatus.completed ? menuAnimation.reverse() : menuAnimation.forward();
|
||||
menuAnimation.status == AnimationStatus.completed
|
||||
? menuAnimation.reverse()
|
||||
: menuAnimation.forward();
|
||||
},
|
||||
child: Icon(
|
||||
icon,
|
||||
color: Colors.white,
|
||||
size: 45.0,
|
||||
),
|
||||
child: Icon(icon, color: Colors.white, size: 45.0),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -103,14 +93,7 @@ class FlowMenuDelegate extends FlowDelegate {
|
||||
double dx = 0.0;
|
||||
for (int i = 0; i < context.childCount; ++i) {
|
||||
dx = context.getChildSize(i)!.width * i;
|
||||
context.paintChild(
|
||||
i,
|
||||
transform: Matrix4.translationValues(
|
||||
dx * menuAnimation.value,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
);
|
||||
context.paintChild(i, transform: Matrix4.translationValues(dx * menuAnimation.value, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +33,7 @@ class FractionallySizedBoxExample extends StatelessWidget {
|
||||
heightFactor: 0.5,
|
||||
alignment: FractionalOffset.center,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.blue,
|
||||
width: 4,
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(border: Border.all(color: Colors.blue, width: 4)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -15,10 +15,7 @@ class IgnorePointerApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: const Text('IgnorePointer Sample'),
|
||||
),
|
||||
appBar: AppBar(centerTitle: true, title: const Text('IgnorePointer Sample')),
|
||||
body: const Center(child: IgnorePointerExample()),
|
||||
),
|
||||
);
|
||||
@@ -49,9 +46,7 @@ class _IgnorePointerExampleState extends State<IgnorePointerExample> {
|
||||
IgnorePointer(
|
||||
ignoring: ignoring,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(padding: const EdgeInsets.all(24.0)),
|
||||
onPressed: () {},
|
||||
child: const Text('Click me!'),
|
||||
),
|
||||
@@ -60,9 +55,7 @@ class _IgnorePointerExampleState extends State<IgnorePointerExample> {
|
||||
onPressed: () {
|
||||
setIgnoring(!ignoring);
|
||||
},
|
||||
child: Text(
|
||||
ignoring ? 'Set ignoring to false' : 'Set ignoring to true',
|
||||
),
|
||||
child: Text(ignoring ? 'Set ignoring to false' : 'Set ignoring to true'),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -77,7 +77,7 @@ class _IndexedStackExampleState extends State<IndexedStackExample> {
|
||||
IndexedStack(
|
||||
index: index,
|
||||
children: <Widget>[for (final String name in names) PersonTracker(name: name)],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
@@ -93,7 +93,7 @@ class _IndexedStackExampleState extends State<IndexedStackExample> {
|
||||
child: const Icon(Icons.chevron_right, key: Key('gesture2')),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -131,7 +131,7 @@ class _PersonTrackerState extends State<PersonTracker> {
|
||||
});
|
||||
},
|
||||
label: const Text('Increment'),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -16,9 +16,7 @@ class ListenerApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('Listener Sample')),
|
||||
body: const Center(
|
||||
child: ListenerExample(),
|
||||
),
|
||||
body: const Center(child: ListenerExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -76,9 +74,7 @@ class _ListenerExampleState extends State<ListenerExample> {
|
||||
'$_downCounter presses\n$_upCounter releases',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
Text(
|
||||
'The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})',
|
||||
),
|
||||
Text('The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -16,9 +16,7 @@ class MouseRegionApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('MouseRegion Sample')),
|
||||
body: const Center(
|
||||
child: MouseRegionExample(),
|
||||
),
|
||||
body: const Center(child: MouseRegionExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -74,9 +72,7 @@ class _MouseRegionExampleState extends State<MouseRegionExample> {
|
||||
'$_enterCounter Entries\n$_exitCounter Exits',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
Text(
|
||||
'The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})',
|
||||
),
|
||||
Text('The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -16,9 +16,7 @@ class MouseRegionApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('MouseRegion.onExit Sample')),
|
||||
body: const Center(
|
||||
child: MouseRegionExample(),
|
||||
),
|
||||
body: const Center(child: MouseRegionExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,7 @@ class MouseRegionApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('MouseRegion.onExit Sample')),
|
||||
body: const Center(
|
||||
child: MouseRegionExample(),
|
||||
),
|
||||
body: const Center(child: MouseRegionExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -60,24 +58,25 @@ class _MyTimedButton extends State<MyTimedButton> {
|
||||
width: 100,
|
||||
height: 100,
|
||||
child: MouseRegion(
|
||||
child: regionIsHidden
|
||||
? null
|
||||
: MouseRegion(
|
||||
onEnter: (_) {
|
||||
widget.onEnterButton();
|
||||
setState(() {
|
||||
hovered = true;
|
||||
});
|
||||
startCountdown();
|
||||
},
|
||||
onExit: (_) {
|
||||
setState(() {
|
||||
hovered = false;
|
||||
});
|
||||
widget.onExitButton();
|
||||
},
|
||||
child: Container(color: Colors.red),
|
||||
),
|
||||
child:
|
||||
regionIsHidden
|
||||
? null
|
||||
: MouseRegion(
|
||||
onEnter: (_) {
|
||||
widget.onEnterButton();
|
||||
setState(() {
|
||||
hovered = true;
|
||||
});
|
||||
startCountdown();
|
||||
},
|
||||
onExit: (_) {
|
||||
setState(() {
|
||||
hovered = false;
|
||||
});
|
||||
widget.onExitButton();
|
||||
},
|
||||
child: Container(color: Colors.red),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,7 @@ class OffstageApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('Offstage Sample')),
|
||||
body: const Center(
|
||||
child: OffstageExample(),
|
||||
),
|
||||
body: const Center(child: OffstageExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -45,13 +43,7 @@ class _OffstageExampleState extends State<OffstageExample> {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Offstage(
|
||||
offstage: _offstage,
|
||||
child: FlutterLogo(
|
||||
key: _key,
|
||||
size: 150.0,
|
||||
),
|
||||
),
|
||||
Offstage(offstage: _offstage, child: FlutterLogo(key: _key, size: 150.0)),
|
||||
Text('Flutter logo is offstage: $_offstage'),
|
||||
ElevatedButton(
|
||||
child: const Text('Toggle Offstage Value'),
|
||||
@@ -63,14 +55,13 @@ class _OffstageExampleState extends State<OffstageExample> {
|
||||
),
|
||||
if (_offstage)
|
||||
ElevatedButton(
|
||||
child: const Text('Get Flutter Logo size'),
|
||||
onPressed: () {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Flutter Logo size is ${_getFlutterLogoSize()}'),
|
||||
),
|
||||
);
|
||||
}),
|
||||
child: const Text('Get Flutter Logo size'),
|
||||
onPressed: () {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Flutter Logo size is ${_getFlutterLogoSize()}')),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,7 @@ class OverflowBoxApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('OverflowBox Sample')),
|
||||
body: const Center(
|
||||
child: OverflowBoxExample(),
|
||||
),
|
||||
body: const Center(child: OverflowBoxExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,7 @@ class PhysicalShapeApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('PhysicalShape Sample'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('PhysicalShape Sample')),
|
||||
body: const Center(child: PhysicalShapeExample()),
|
||||
),
|
||||
);
|
||||
@@ -32,22 +30,14 @@ class PhysicalShapeExample extends StatelessWidget {
|
||||
return PhysicalShape(
|
||||
elevation: 5.0,
|
||||
clipper: ShapeBorderClipper(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
|
||||
),
|
||||
color: Colors.orange,
|
||||
child: const SizedBox(
|
||||
height: 200.0,
|
||||
width: 200.0,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Hello, World!',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
child: Text('Hello, World!', style: TextStyle(color: Colors.white, fontSize: 20.0)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user