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
@@ -18,9 +18,7 @@ class ApplicationExitExample extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: Scaffold(body: Body()),
|
||||
);
|
||||
return const MaterialApp(home: Scaffold(body: Body()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,10 +93,7 @@ class _BodyState extends State<Body> with WidgetsBindingObserver {
|
||||
onChanged: _radioChanged,
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
ElevatedButton(
|
||||
onPressed: _quit,
|
||||
child: const Text('Quit'),
|
||||
),
|
||||
ElevatedButton(onPressed: _quit, child: const Text('Quit')),
|
||||
const SizedBox(height: 30),
|
||||
Text(lastResponse),
|
||||
],
|
||||
|
||||
@@ -60,7 +60,9 @@ class _MyKeyExampleState extends State<MyKeyExample> {
|
||||
}
|
||||
}
|
||||
});
|
||||
return event.logicalKey == LogicalKeyboardKey.keyQ ? KeyEventResult.handled : KeyEventResult.ignored;
|
||||
return event.logicalKey == LogicalKeyboardKey.keyQ
|
||||
? KeyEventResult.handled
|
||||
: KeyEventResult.ignored;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -32,27 +32,28 @@ class MyPhysicalKeyExample extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyPhysicalKeyExampleState extends State<MyPhysicalKeyExample> {
|
||||
// The node used to request the keyboard focus.
|
||||
// The node used to request the keyboard focus.
|
||||
final FocusNode _focusNode = FocusNode();
|
||||
// The message to display.
|
||||
// The message to display.
|
||||
String? _message;
|
||||
|
||||
// Focus nodes need to be disposed.
|
||||
// Focus nodes need to be disposed.
|
||||
@override
|
||||
void dispose() {
|
||||
_focusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// Handles the key events from the RawKeyboardListener and update the
|
||||
// _message.
|
||||
// Handles the key events from the RawKeyboardListener and update the
|
||||
// _message.
|
||||
KeyEventResult _handleKeyEvent(FocusNode node, KeyEvent event) {
|
||||
setState(() {
|
||||
if (event.physicalKey == PhysicalKeyboardKey.keyA) {
|
||||
_message = 'Pressed the key next to CAPS LOCK!';
|
||||
} else {
|
||||
if (kReleaseMode) {
|
||||
_message = 'Not the key next to CAPS LOCK: Pressed 0x${event.physicalKey.usbHidUsage.toRadixString(16)}';
|
||||
_message =
|
||||
'Not the key next to CAPS LOCK: Pressed 0x${event.physicalKey.usbHidUsage.toRadixString(16)}';
|
||||
} else {
|
||||
// As the name implies, the debugName will only print useful
|
||||
// information in debug mode.
|
||||
@@ -60,7 +61,9 @@ class _MyPhysicalKeyExampleState extends State<MyPhysicalKeyExample> {
|
||||
}
|
||||
}
|
||||
});
|
||||
return event.physicalKey == PhysicalKeyboardKey.keyA ? KeyEventResult.handled : KeyEventResult.ignored;
|
||||
return event.physicalKey == PhysicalKeyboardKey.keyA
|
||||
? KeyEventResult.handled
|
||||
: KeyEventResult.ignored;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -33,10 +33,7 @@ class MouseCursorExample extends StatelessWidget {
|
||||
child: Container(
|
||||
width: 200,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue,
|
||||
border: Border.all(color: Colors.yellow),
|
||||
),
|
||||
decoration: BoxDecoration(color: Colors.blue, border: Border.all(color: Colors.yellow)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -17,10 +17,7 @@ class SystemOverlayStyleApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.light,
|
||||
),
|
||||
theme: ThemeData(useMaterial3: true, brightness: Brightness.light),
|
||||
home: const SystemOverlayStyleExample(),
|
||||
);
|
||||
}
|
||||
@@ -60,10 +57,7 @@ class _SystemOverlayStyleExampleState extends State<SystemOverlayStyleExample> {
|
||||
systemOverlayStyle: _currentStyle,
|
||||
),
|
||||
body: Center(
|
||||
child: ElevatedButton(
|
||||
onPressed: _changeColor,
|
||||
child: const Text('Change Color'),
|
||||
),
|
||||
child: ElevatedButton(onPressed: _changeColor, child: const Text('Change Color')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,7 @@ class SystemOverlayStyleApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.light,
|
||||
),
|
||||
theme: ThemeData(useMaterial3: true, brightness: Brightness.light),
|
||||
home: const SystemOverlayStyleExample(),
|
||||
);
|
||||
}
|
||||
@@ -69,10 +66,7 @@ class _SystemOverlayStyleExampleState extends State<SystemOverlayStyleExample> {
|
||||
),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: ElevatedButton(
|
||||
onPressed: _changeColor,
|
||||
child: const Text('Change Color'),
|
||||
),
|
||||
child: ElevatedButton(onPressed: _changeColor, child: const Text('Change Color')),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -15,9 +15,7 @@ class TextInputControlExampleApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: TextInputControlExample(),
|
||||
);
|
||||
return const MaterialApp(home: TextInputControlExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,10 +102,7 @@ class MyVirtualKeyboardState extends State<MyVirtualKeyboard> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
for (final String key in <String>['A', 'B', 'C'])
|
||||
ElevatedButton(
|
||||
child: Text(key),
|
||||
onPressed: () => _handleKeyPress(key),
|
||||
),
|
||||
ElevatedButton(child: Text(key), onPressed: () => _handleKeyPress(key)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user