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
@@ -8,13 +8,7 @@ import 'package:flutter/services.dart';
|
||||
/// Flutter code sample for [Action.overridable].
|
||||
|
||||
void main() {
|
||||
runApp(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(child: VerificationCodeGenerator()),
|
||||
),
|
||||
),
|
||||
);
|
||||
runApp(const MaterialApp(home: Scaffold(body: Center(child: VerificationCodeGenerator()))));
|
||||
}
|
||||
|
||||
const CopyTextIntent copyTextIntent = CopyTextIntent._();
|
||||
@@ -32,16 +26,21 @@ class CopyableText extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Action<CopyTextIntent> defaultCopyAction = CallbackAction<CopyTextIntent>(onInvoke: _copy);
|
||||
final Action<CopyTextIntent> defaultCopyAction = CallbackAction<CopyTextIntent>(
|
||||
onInvoke: _copy,
|
||||
);
|
||||
return Shortcuts(
|
||||
shortcuts: const <ShortcutActivator, Intent>{
|
||||
SingleActivator(LogicalKeyboardKey.keyC, control: true): copyTextIntent
|
||||
SingleActivator(LogicalKeyboardKey.keyC, control: true): copyTextIntent,
|
||||
},
|
||||
child: Actions(
|
||||
actions: <Type, Action<Intent>>{
|
||||
// The Action is made overridable so the VerificationCodeGenerator
|
||||
// widget can override how copying is handled.
|
||||
CopyTextIntent: Action<CopyTextIntent>.overridable(defaultAction: defaultCopyAction, context: context),
|
||||
CopyTextIntent: Action<CopyTextIntent>.overridable(
|
||||
defaultAction: defaultCopyAction,
|
||||
context: context,
|
||||
),
|
||||
},
|
||||
child: Focus(
|
||||
autofocus: true,
|
||||
@@ -66,7 +65,9 @@ class VerificationCodeGenerator extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Actions(
|
||||
actions: <Type, Action<Intent>>{CopyTextIntent: CallbackAction<CopyTextIntent>(onInvoke: _copy)},
|
||||
actions: <Type, Action<Intent>>{
|
||||
CopyTextIntent: CallbackAction<CopyTextIntent>(onInvoke: _copy),
|
||||
},
|
||||
child: const Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
|
||||
@@ -16,9 +16,7 @@ class ActionListenerExampleApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('ActionListener Sample')),
|
||||
body: const Center(
|
||||
child: ActionListenerExample(),
|
||||
),
|
||||
body: const Center(child: ActionListenerExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -54,10 +52,7 @@ class _ActionListenerExampleState extends State<ActionListenerExample> {
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: OutlinedButton(
|
||||
onPressed: _toggleState,
|
||||
child: Text(_on ? 'Disable' : 'Enable'),
|
||||
),
|
||||
child: OutlinedButton(onPressed: _toggleState, child: Text(_on ? 'Disable' : 'Enable')),
|
||||
),
|
||||
if (_on)
|
||||
Padding(
|
||||
@@ -65,9 +60,9 @@ class _ActionListenerExampleState extends State<ActionListenerExample> {
|
||||
child: ActionListener(
|
||||
listener: (Action<Intent> action) {
|
||||
if (action.intentType == MyIntent) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text('Action Listener Called'),
|
||||
));
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text('Action Listener Called')));
|
||||
}
|
||||
},
|
||||
action: _myAction,
|
||||
|
||||
@@ -16,9 +16,7 @@ class ActionsExampleApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('Actions Sample')),
|
||||
body: const Center(
|
||||
child: ActionsExample(),
|
||||
),
|
||||
body: const Center(child: ActionsExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,18 +14,12 @@ class FocusableActionDetectorExampleApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: FocusableActionDetectorExample(),
|
||||
);
|
||||
return const MaterialApp(home: FocusableActionDetectorExample());
|
||||
}
|
||||
}
|
||||
|
||||
class FadButton extends StatefulWidget {
|
||||
const FadButton({
|
||||
super.key,
|
||||
required this.onPressed,
|
||||
required this.child,
|
||||
});
|
||||
const FadButton({super.key, required this.onPressed, required this.child});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
final Widget child;
|
||||
@@ -47,9 +41,7 @@ class _FadButtonState extends State<FadButton> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_actionMap = <Type, Action<Intent>>{
|
||||
ActivateIntent: CallbackAction<Intent>(
|
||||
onInvoke: (Intent intent) => _toggleState(),
|
||||
),
|
||||
ActivateIntent: CallbackAction<Intent>(onInvoke: (Intent intent) => _toggleState()),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -93,11 +85,7 @@ class _FadButtonState extends State<FadButton> {
|
||||
onShowHoverHighlight: _handleHoveHighlight,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
color: color,
|
||||
child: widget.child,
|
||||
),
|
||||
Container(padding: const EdgeInsets.all(10.0), color: color, child: widget.child),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
@@ -122,9 +110,7 @@ class _FocusableActionDetectorExampleState extends State<FocusableActionDetector
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('FocusableActionDetector Example'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('FocusableActionDetector Example')),
|
||||
body: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
||||
Reference in New Issue
Block a user