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
@@ -11,14 +11,14 @@ void main() {
|
||||
}
|
||||
|
||||
class Test extends SingleChildRenderObjectWidget {
|
||||
const Test({ super.key });
|
||||
const Test({super.key});
|
||||
|
||||
@override
|
||||
RenderTest createRenderObject(BuildContext context) => RenderTest();
|
||||
}
|
||||
|
||||
class RenderTest extends RenderProxyBox {
|
||||
RenderTest({ RenderBox? child }) : super(child);
|
||||
RenderTest({RenderBox? child}) : super(child);
|
||||
|
||||
@override
|
||||
void debugPaintSize(PaintingContext context, Offset offset) {
|
||||
|
||||
@@ -27,22 +27,15 @@ class DriverTestAppState extends State<DriverTestApp> {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('FlutterDriver test'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('FlutterDriver test')),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(present ? 'present' : 'absent'),
|
||||
),
|
||||
Expanded(child: Text(present ? 'present' : 'absent')),
|
||||
ElevatedButton(
|
||||
child: const Text(
|
||||
'toggle',
|
||||
key: ValueKey<String>('togglePresent'),
|
||||
),
|
||||
child: const Text('toggle', key: ValueKey<String>('togglePresent')),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
present = !present;
|
||||
@@ -53,9 +46,7 @@ class DriverTestAppState extends State<DriverTestApp> {
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
const Expanded(
|
||||
child: Text('hit testability'),
|
||||
),
|
||||
const Expanded(child: Text('hit testability')),
|
||||
DropdownButton<Letter>(
|
||||
key: const ValueKey<String>('dropdown'),
|
||||
value: _selectedValue,
|
||||
@@ -81,9 +72,7 @@ class DriverTestAppState extends State<DriverTestApp> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const TextField(
|
||||
key: ValueKey<String>('enter-text-field'),
|
||||
),
|
||||
const TextField(key: ValueKey<String>('enter-text-field')),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -18,16 +18,16 @@ void main() {
|
||||
completer.complete(timings);
|
||||
});
|
||||
|
||||
runApp(Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: _FirstFrameTimings(completer: completer),
|
||||
));
|
||||
runApp(
|
||||
Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: _FirstFrameTimings(completer: completer),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class _FirstFrameTimings extends StatefulWidget {
|
||||
const _FirstFrameTimings({
|
||||
required this.completer,
|
||||
});
|
||||
const _FirstFrameTimings({required this.completer});
|
||||
|
||||
final Completer<List<FrameTiming>> completer;
|
||||
|
||||
@@ -42,19 +42,14 @@ class _FirstFrameTimingsState extends State<_FirstFrameTimings> {
|
||||
Widget build(BuildContext context) {
|
||||
widget.completer.future.then(_setMinFrameNumber);
|
||||
if (_minFrameNumber != null) {
|
||||
return Text(
|
||||
_minFrameNumber.toString(),
|
||||
key: const Key('minFrameNumber'),
|
||||
);
|
||||
return Text(_minFrameNumber.toString(), key: const Key('minFrameNumber'));
|
||||
} else {
|
||||
return const Text('Waiting...');
|
||||
}
|
||||
}
|
||||
|
||||
void _setMinFrameNumber(List<FrameTiming> timings) {
|
||||
final int minFrameNumber = timings
|
||||
.map((FrameTiming timing) => timing.frameNumber)
|
||||
.reduce(min);
|
||||
final int minFrameNumber = timings.map((FrameTiming timing) => timing.frameNumber).reduce(min);
|
||||
setState(() {
|
||||
_minFrameNumber = minFrameNumber;
|
||||
});
|
||||
|
||||
@@ -8,10 +8,12 @@ import 'package:flutter_driver/driver_extension.dart';
|
||||
import 'keys.dart' as keys;
|
||||
|
||||
void main() {
|
||||
enableFlutterDriverExtension(handler: (String? message) async {
|
||||
// TODO(cbernaschina): remove when test flakiness is resolved
|
||||
return 'keyboard_resize';
|
||||
});
|
||||
enableFlutterDriverExtension(
|
||||
handler: (String? message) async {
|
||||
// TODO(cbernaschina): remove when test flakiness is resolved
|
||||
return 'keyboard_resize';
|
||||
},
|
||||
);
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@@ -52,15 +54,19 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
children: <Widget>[
|
||||
LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return Center(child: Text('${constraints.biggest.height}', key: const Key(keys.kHeightText)));
|
||||
}
|
||||
return Center(
|
||||
child: Text('${constraints.biggest.height}', key: const Key(keys.kHeightText)),
|
||||
);
|
||||
},
|
||||
),
|
||||
textField,
|
||||
],
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
key: const Key(keys.kUnfocusButton),
|
||||
onPressed: () { textField.focusNode!.unfocus(); },
|
||||
onPressed: () {
|
||||
textField.focusNode!.unfocus();
|
||||
},
|
||||
tooltip: 'Unfocus',
|
||||
child: const Icon(Icons.done),
|
||||
),
|
||||
|
||||
@@ -59,24 +59,16 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
return Scaffold(
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
Text('$offset',
|
||||
key: const ValueKey<String>(keys.kOffsetText),
|
||||
),
|
||||
if (isSoftKeyboardVisible) const Text(
|
||||
'keyboard visible',
|
||||
key: ValueKey<String>(keys.kKeyboardVisibleView),
|
||||
),
|
||||
Text('$offset', key: const ValueKey<String>(keys.kOffsetText)),
|
||||
if (isSoftKeyboardVisible)
|
||||
const Text('keyboard visible', key: ValueKey<String>(keys.kKeyboardVisibleView)),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
key: const ValueKey<String>(keys.kListView),
|
||||
controller: _controller,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
),
|
||||
const TextField(
|
||||
key: ValueKey<String>(keys.kDefaultTextField),
|
||||
),
|
||||
Container(height: MediaQuery.of(context).size.height),
|
||||
const TextField(key: ValueKey<String>(keys.kDefaultTextField)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -16,11 +16,8 @@ void main() {
|
||||
class ShowLicenses extends StatelessWidget {
|
||||
const ShowLicenses({super.key});
|
||||
|
||||
Widget _buildTestResultWidget(
|
||||
BuildContext context,
|
||||
AsyncSnapshot<List<LicenseEntry>> snapshot,
|
||||
) {
|
||||
final List<LicenseEntry> entries = snapshot.data ?? <LicenseEntry>[];
|
||||
Widget _buildTestResultWidget(BuildContext context, AsyncSnapshot<List<LicenseEntry>> snapshot) {
|
||||
final List<LicenseEntry> entries = snapshot.data ?? <LicenseEntry>[];
|
||||
String flutterPackage = '';
|
||||
final List<String> flutterParagraphs = <String>[];
|
||||
String enginePackage = '';
|
||||
@@ -34,9 +31,7 @@ class ShowLicenses extends StatelessWidget {
|
||||
}
|
||||
if (entry.packages.contains('engine')) {
|
||||
enginePackage = 'engine';
|
||||
engineParagraphs.addAll(
|
||||
entry.paragraphs.map<String>((LicenseParagraph para) => para.text),
|
||||
);
|
||||
engineParagraphs.addAll(entry.paragraphs.map<String>((LicenseParagraph para) => para.text));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,9 +46,7 @@ class ShowLicenses extends StatelessWidget {
|
||||
Text('${engineParagraphs.length}', key: const ValueKey<String>('EngineCount')),
|
||||
]);
|
||||
|
||||
return ListView(
|
||||
children: result,
|
||||
);
|
||||
return ListView(children: result);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -8,35 +8,31 @@ import 'package:flutter_driver/driver_extension.dart';
|
||||
void main() {
|
||||
enableFlutterDriverExtension();
|
||||
|
||||
runApp(MaterialApp(
|
||||
home: Material(
|
||||
child: Builder(
|
||||
builder: (BuildContext context) {
|
||||
return TextButton(
|
||||
child: const Text(
|
||||
'flutter drive lib/xxx.dart',
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.push<Object?>(
|
||||
context,
|
||||
MaterialPageRoute<Object?>(
|
||||
builder: (BuildContext context) {
|
||||
return const Material(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'navigated here',
|
||||
textDirection: TextDirection.ltr,
|
||||
runApp(
|
||||
MaterialApp(
|
||||
home: Material(
|
||||
child: Builder(
|
||||
builder: (BuildContext context) {
|
||||
return TextButton(
|
||||
child: const Text('flutter drive lib/xxx.dart', textDirection: TextDirection.ltr),
|
||||
onPressed: () {
|
||||
Navigator.push<Object?>(
|
||||
context,
|
||||
MaterialPageRoute<Object?>(
|
||||
builder: (BuildContext context) {
|
||||
return const Material(
|
||||
child: Center(
|
||||
child: Text('navigated here', textDirection: TextDirection.ltr),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ void main() {
|
||||
}
|
||||
|
||||
class Test extends StatefulWidget {
|
||||
const Test({ super.key });
|
||||
const Test({super.key});
|
||||
|
||||
@override
|
||||
State<Test> createState() => _TestState();
|
||||
@@ -29,14 +29,16 @@ class _TestState extends State<Test> {
|
||||
if (!_triggered) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return const Row(children: <Widget>[
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
]);
|
||||
return const Row(
|
||||
children: <Widget>[
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
SizedBox(width: 10000.0),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,17 +17,13 @@ class ResizeApp extends StatefulWidget {
|
||||
static const Key widthLabel = Key('width label');
|
||||
static const Key extendedFab = Key('extended FAB');
|
||||
|
||||
static const MethodChannel platform =
|
||||
MethodChannel('samples.flutter.dev/resize');
|
||||
static const MethodChannel platform = MethodChannel('samples.flutter.dev/resize');
|
||||
|
||||
static Future<void> resize(Size size) async {
|
||||
await ResizeApp.platform.invokeMethod<void>(
|
||||
'resize',
|
||||
<String, dynamic>{
|
||||
'width': size.width,
|
||||
'height': size.height,
|
||||
}
|
||||
);
|
||||
await ResizeApp.platform.invokeMethod<void>('resize', <String, dynamic>{
|
||||
'width': size.width,
|
||||
'height': size.height,
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -57,19 +53,13 @@ class _ResizeAppState extends State<ResizeApp> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
key: ResizeApp.widthLabel,
|
||||
'width: ${currentSize.width}'
|
||||
),
|
||||
Text(
|
||||
key: ResizeApp.heightLabel,
|
||||
'height: ${currentSize.height}',
|
||||
),
|
||||
Text(key: ResizeApp.widthLabel, 'width: ${currentSize.width}'),
|
||||
Text(key: ResizeApp.heightLabel, 'height: ${currentSize.height}'),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ import 'package:flutter_driver/driver_extension.dart';
|
||||
// To use this test: "flutter drive --route '/smuggle-it' lib/route.dart"
|
||||
|
||||
void main() {
|
||||
enableFlutterDriverExtension(handler: (String? message) async {
|
||||
return ui.PlatformDispatcher.instance.defaultRouteName;
|
||||
});
|
||||
enableFlutterDriverExtension(
|
||||
handler: (String? message) async {
|
||||
return ui.PlatformDispatcher.instance.defaultRouteName;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,9 +29,7 @@ class TogglerState extends State<Toggler> {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('FlutterDriver test'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('FlutterDriver test')),
|
||||
body: Material(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
@@ -44,11 +42,7 @@ class TogglerState extends State<Toggler> {
|
||||
});
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: _buildRows(_visible ? 10 : 0),
|
||||
),
|
||||
),
|
||||
Expanded(child: ListView(children: _buildRows(_visible ? 10 : 0))),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -59,9 +53,7 @@ class TogglerState extends State<Toggler> {
|
||||
|
||||
List<Widget> _buildRows(int count) {
|
||||
return List<Widget>.generate(count, (int i) {
|
||||
return Row(
|
||||
children: _buildCells(i / count),
|
||||
);
|
||||
return Row(children: _buildCells(i / count));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,5 @@ import 'package:flutter_driver/driver_extension.dart';
|
||||
void main() {
|
||||
enableFlutterDriverExtension();
|
||||
|
||||
runApp(Container(
|
||||
color: const Color(0xFFFF0000),
|
||||
));
|
||||
runApp(Container(color: const Color(0xFFFF0000)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user