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
@@ -82,7 +82,7 @@ class MyHttpOverrides extends HttpOverrides {
|
||||
@override
|
||||
HttpClient createHttpClient(SecurityContext? context) {
|
||||
return super.createHttpClient(
|
||||
(context ?? SecurityContext())..setTrustedCertificatesBytes(certificate.codeUnits),
|
||||
(context ?? SecurityContext())..setTrustedCertificatesBytes(certificate.codeUnits),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -90,12 +90,12 @@ class MyHttpOverrides extends HttpOverrides {
|
||||
Future<void> main() async {
|
||||
HttpOverrides.global = MyHttpOverrides();
|
||||
|
||||
final SecurityContext serverContext = SecurityContext()
|
||||
..useCertificateChainBytes(certificate.codeUnits)
|
||||
..usePrivateKeyBytes(privateKey.codeUnits);
|
||||
final SecurityContext serverContext =
|
||||
SecurityContext()
|
||||
..useCertificateChainBytes(certificate.codeUnits)
|
||||
..usePrivateKeyBytes(privateKey.codeUnits);
|
||||
|
||||
final HttpServer httpServer =
|
||||
await HttpServer.bindSecure('localhost', 0, serverContext);
|
||||
final HttpServer httpServer = await HttpServer.bindSecure('localhost', 0, serverContext);
|
||||
final int port = httpServer.port;
|
||||
debugPrint('Listening on port $port.');
|
||||
|
||||
@@ -131,9 +131,7 @@ class MyApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
theme: ThemeData(primarySwatch: Colors.blue),
|
||||
home: MyHomePage(title: 'Flutter Demo Home Page', port: port),
|
||||
);
|
||||
}
|
||||
@@ -159,18 +157,13 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
|
||||
|
||||
Widget createImage(final int index, final Completer<bool> completer) {
|
||||
return Image.network(
|
||||
'https://localhost:${widget.port}/${_counter * images + index}',
|
||||
frameBuilder: (
|
||||
BuildContext context,
|
||||
Widget child,
|
||||
int? frame,
|
||||
bool wasSynchronouslyLoaded,
|
||||
) {
|
||||
if (frame == 0 && !completer.isCompleted) {
|
||||
completer.complete(true);
|
||||
}
|
||||
return child;
|
||||
},
|
||||
'https://localhost:${widget.port}/${_counter * images + index}',
|
||||
frameBuilder: (BuildContext context, Widget child, int? frame, bool wasSynchronouslyLoaded) {
|
||||
if (frame == 0 && !completer.isCompleted) {
|
||||
completer.complete(true);
|
||||
}
|
||||
return child;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -178,18 +171,13 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
|
||||
Widget build(BuildContext context) {
|
||||
final List<AnimationController> controllers = <AnimationController>[
|
||||
for (int i = 0; i < images; i++)
|
||||
AnimationController(
|
||||
duration: const Duration(milliseconds: 3600),
|
||||
vsync: this,
|
||||
)..repeat(),
|
||||
AnimationController(duration: const Duration(milliseconds: 3600), vsync: this)..repeat(),
|
||||
];
|
||||
final List<Completer<bool>> completers = <Completer<bool>>[
|
||||
for (int i = 0; i < images; i++)
|
||||
Completer<bool>(),
|
||||
for (int i = 0; i < images; i++) Completer<bool>(),
|
||||
];
|
||||
final List<Future<bool>> futures = completers.map(
|
||||
(Completer<bool> completer) => completer.future,
|
||||
).toList();
|
||||
final List<Future<bool>> futures =
|
||||
completers.map((Completer<bool> completer) => completer.future).toList();
|
||||
final DateTime started = DateTime.now();
|
||||
Future.wait(futures).then((_) {
|
||||
debugPrint(
|
||||
@@ -197,21 +185,14 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
|
||||
);
|
||||
});
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.title),
|
||||
),
|
||||
appBar: AppBar(title: Text(widget.title)),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Row(children: createImageList(images, completers, controllers)),
|
||||
const Text(
|
||||
'You have pushed the button this many times:',
|
||||
),
|
||||
Text(
|
||||
'$_counter',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
const Text('You have pushed the button this many times:'),
|
||||
Text('$_counter', style: Theme.of(context).textTheme.headlineMedium),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -230,14 +211,16 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
|
||||
) {
|
||||
final List<Widget> list = <Widget>[];
|
||||
for (int i = 0; i < count; i++) {
|
||||
list.add(Flexible(
|
||||
fit: FlexFit.tight,
|
||||
flex: i + 1,
|
||||
child: RotationTransition(
|
||||
turns: controllers[i],
|
||||
child: createImage(i + 1, completers[i]),
|
||||
list.add(
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
flex: i + 1,
|
||||
child: RotationTransition(
|
||||
turns: controllers[i],
|
||||
child: createImage(i + 1, completers[i]),
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user