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
@@ -13,9 +13,7 @@ class CustomListItemApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: CustomListItemExample(),
|
||||
);
|
||||
return const MaterialApp(home: CustomListItemExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,22 +38,12 @@ class CustomListItem extends StatelessWidget {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: thumbnail,
|
||||
),
|
||||
Expanded(flex: 2, child: thumbnail),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: _VideoDescription(
|
||||
title: title,
|
||||
user: user,
|
||||
viewCount: viewCount,
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.more_vert,
|
||||
size: 16.0,
|
||||
child: _VideoDescription(title: title, user: user, viewCount: viewCount),
|
||||
),
|
||||
const Icon(Icons.more_vert, size: 16.0),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -63,11 +51,7 @@ class CustomListItem extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _VideoDescription extends StatelessWidget {
|
||||
const _VideoDescription({
|
||||
required this.title,
|
||||
required this.user,
|
||||
required this.viewCount,
|
||||
});
|
||||
const _VideoDescription({required this.title, required this.user, required this.viewCount});
|
||||
|
||||
final String title;
|
||||
final String user;
|
||||
@@ -80,23 +64,11 @@ class _VideoDescription extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14.0,
|
||||
),
|
||||
),
|
||||
Text(title, style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 14.0)),
|
||||
const Padding(padding: EdgeInsets.symmetric(vertical: 2.0)),
|
||||
Text(
|
||||
user,
|
||||
style: const TextStyle(fontSize: 10.0),
|
||||
),
|
||||
Text(user, style: const TextStyle(fontSize: 10.0)),
|
||||
const Padding(padding: EdgeInsets.symmetric(vertical: 1.0)),
|
||||
Text(
|
||||
'$viewCount views',
|
||||
style: const TextStyle(fontSize: 10.0),
|
||||
),
|
||||
Text('$viewCount views', style: const TextStyle(fontSize: 10.0)),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -117,17 +89,13 @@ class CustomListItemExample extends StatelessWidget {
|
||||
CustomListItem(
|
||||
user: 'Flutter',
|
||||
viewCount: 999000,
|
||||
thumbnail: Container(
|
||||
decoration: const BoxDecoration(color: Colors.blue),
|
||||
),
|
||||
thumbnail: Container(decoration: const BoxDecoration(color: Colors.blue)),
|
||||
title: 'The Flutter YouTube Channel',
|
||||
),
|
||||
CustomListItem(
|
||||
user: 'Dash',
|
||||
viewCount: 884000,
|
||||
thumbnail: Container(
|
||||
decoration: const BoxDecoration(color: Colors.yellow),
|
||||
),
|
||||
thumbnail: Container(decoration: const BoxDecoration(color: Colors.yellow)),
|
||||
title: 'Announcing Flutter 1.0',
|
||||
),
|
||||
],
|
||||
|
||||
@@ -13,10 +13,7 @@ class CustomListItemApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const CustomListItemExample(),
|
||||
);
|
||||
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const CustomListItemExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,9 +41,7 @@ class _ArticleDescription extends StatelessWidget {
|
||||
title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
const Padding(padding: EdgeInsets.only(bottom: 2.0)),
|
||||
Expanded(
|
||||
@@ -54,25 +49,13 @@ class _ArticleDescription extends StatelessWidget {
|
||||
subtitle,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
author,
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.black87,
|
||||
style: const TextStyle(fontSize: 12.0, color: Colors.black54),
|
||||
),
|
||||
),
|
||||
Text(author, style: const TextStyle(fontSize: 12.0, color: Colors.black87)),
|
||||
Text(
|
||||
'$publishDate - $readDuration',
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
style: const TextStyle(fontSize: 12.0, color: Colors.black54),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -106,10 +89,7 @@ class CustomListItemTwo extends StatelessWidget {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: thumbnail,
|
||||
),
|
||||
AspectRatio(aspectRatio: 1.0, child: thumbnail),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 2.0, 0.0),
|
||||
@@ -140,20 +120,17 @@ class CustomListItemExample extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
children: <Widget>[
|
||||
CustomListItemTwo(
|
||||
thumbnail: Container(
|
||||
decoration: const BoxDecoration(color: Colors.pink),
|
||||
),
|
||||
thumbnail: Container(decoration: const BoxDecoration(color: Colors.pink)),
|
||||
title: 'Flutter 1.0 Launch',
|
||||
subtitle: 'Flutter continues to improve and expand its horizons. '
|
||||
subtitle:
|
||||
'Flutter continues to improve and expand its horizons. '
|
||||
'This text should max out at two lines and clip',
|
||||
author: 'Dash',
|
||||
publishDate: 'Dec 28',
|
||||
readDuration: '5 mins',
|
||||
),
|
||||
CustomListItemTwo(
|
||||
thumbnail: Container(
|
||||
decoration: const BoxDecoration(color: Colors.blue),
|
||||
),
|
||||
thumbnail: Container(decoration: const BoxDecoration(color: Colors.blue)),
|
||||
title: 'Flutter 1.2 Release - Continual updates to the framework',
|
||||
subtitle: 'Flutter once again improves and makes updates.',
|
||||
author: 'Flutter',
|
||||
|
||||
@@ -15,9 +15,7 @@ class ListTileApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(
|
||||
listTileTheme: const ListTileThemeData(
|
||||
textColor: Colors.white,
|
||||
),
|
||||
listTileTheme: const ListTileThemeData(textColor: Colors.white),
|
||||
useMaterial3: true,
|
||||
),
|
||||
home: const ListTileExample(),
|
||||
@@ -41,25 +39,15 @@ class _ListTileExampleState extends State<ListTileExample> with TickerProviderSt
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_fadeController = AnimationController(
|
||||
duration: const Duration(seconds: 1),
|
||||
vsync: this,
|
||||
)..repeat(reverse: true);
|
||||
_fadeController = AnimationController(duration: const Duration(seconds: 1), vsync: this)
|
||||
..repeat(reverse: true);
|
||||
|
||||
_sizeController = AnimationController(
|
||||
duration: const Duration(milliseconds: 850),
|
||||
vsync: this,
|
||||
)..repeat(reverse: true);
|
||||
_sizeController = AnimationController(duration: const Duration(milliseconds: 850), vsync: this)
|
||||
..repeat(reverse: true);
|
||||
|
||||
_fadeAnimation = CurvedAnimation(
|
||||
parent: _fadeController,
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
_fadeAnimation = CurvedAnimation(parent: _fadeController, curve: Curves.easeInOut);
|
||||
|
||||
_sizeAnimation = CurvedAnimation(
|
||||
parent: _sizeController,
|
||||
curve: Curves.easeOut,
|
||||
);
|
||||
_sizeAnimation = CurvedAnimation(parent: _sizeController, curve: Curves.easeOut);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -88,26 +76,28 @@ class _ListTileExampleState extends State<ListTileExample> with TickerProviderSt
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute<Widget>(builder: (BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('ListTile Hero')),
|
||||
body: Center(
|
||||
child: Hero(
|
||||
tag: 'ListTile-Hero',
|
||||
child: Material(
|
||||
child: ListTile(
|
||||
title: const Text('ListTile with Hero'),
|
||||
subtitle: const Text('Tap here to go back'),
|
||||
tileColor: Colors.blue[700],
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
MaterialPageRoute<Widget>(
|
||||
builder: (BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('ListTile Hero')),
|
||||
body: Center(
|
||||
child: Hero(
|
||||
tag: 'ListTile-Hero',
|
||||
child: Material(
|
||||
child: ListTile(
|
||||
title: const Text('ListTile with Hero'),
|
||||
subtitle: const Text('Tap here to go back'),
|
||||
tileColor: Colors.blue[700],
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -13,10 +13,7 @@ class ListTileApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const ListTileExample(),
|
||||
);
|
||||
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const ListTileExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +28,7 @@ class ListTileExample extends StatelessWidget {
|
||||
children: const <Widget>[
|
||||
Card(child: ListTile(title: Text('One-line ListTile'))),
|
||||
Card(
|
||||
child: ListTile(
|
||||
leading: FlutterLogo(),
|
||||
title: Text('One-line with leading widget'),
|
||||
),
|
||||
child: ListTile(leading: FlutterLogo(), title: Text('One-line with leading widget')),
|
||||
),
|
||||
Card(
|
||||
child: ListTile(
|
||||
@@ -49,12 +43,7 @@ class ListTileExample extends StatelessWidget {
|
||||
trailing: Icon(Icons.more_vert),
|
||||
),
|
||||
),
|
||||
Card(
|
||||
child: ListTile(
|
||||
title: Text('One-line dense ListTile'),
|
||||
dense: true,
|
||||
),
|
||||
),
|
||||
Card(child: ListTile(title: Text('One-line dense ListTile'), dense: true)),
|
||||
Card(
|
||||
child: ListTile(
|
||||
leading: FlutterLogo(size: 56.0),
|
||||
|
||||
@@ -13,10 +13,7 @@ class ListTileApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const ListTileExample(),
|
||||
);
|
||||
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const ListTileExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +37,8 @@ class ListTileExample extends StatelessWidget {
|
||||
leading: CircleAvatar(child: Text('B')),
|
||||
title: Text('Headline'),
|
||||
subtitle: Text(
|
||||
'Longer supporting text to demonstrate how the text wraps and how the leading and trailing widgets are centered vertically with the text.'),
|
||||
'Longer supporting text to demonstrate how the text wraps and how the leading and trailing widgets are centered vertically with the text.',
|
||||
),
|
||||
trailing: Icon(Icons.favorite_rounded),
|
||||
),
|
||||
Divider(height: 0),
|
||||
@@ -48,7 +46,8 @@ class ListTileExample extends StatelessWidget {
|
||||
leading: CircleAvatar(child: Text('C')),
|
||||
title: Text('Headline'),
|
||||
subtitle: Text(
|
||||
"Longer supporting text to demonstrate how the text wraps and how setting 'ListTile.isThreeLine = true' aligns leading and trailing widgets to the top vertically with the text."),
|
||||
"Longer supporting text to demonstrate how the text wraps and how setting 'ListTile.isThreeLine = true' aligns leading and trailing widgets to the top vertically with the text.",
|
||||
),
|
||||
trailing: Icon(Icons.favorite_rounded),
|
||||
isThreeLine: true,
|
||||
),
|
||||
|
||||
@@ -13,10 +13,7 @@ class ListTileApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const ListTileExample(),
|
||||
);
|
||||
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const ListTileExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +45,7 @@ class _ListTileExampleState extends State<ListTileExample> {
|
||||
iconColor: const WidgetStateColor.fromMap(<WidgetStatesConstraint, Color>{
|
||||
WidgetState.disabled: Colors.red,
|
||||
WidgetState.selected: Colors.green,
|
||||
WidgetState.any: Colors.black,
|
||||
WidgetState.any: Colors.black,
|
||||
}),
|
||||
// The same can be achieved using the .resolveWith() constructor.
|
||||
// The text color will be identical to the icon color above.
|
||||
|
||||
@@ -13,10 +13,7 @@ class ListTileApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const ListTileExample(),
|
||||
);
|
||||
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const ListTileExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,41 +36,40 @@ class _ListTileExampleState extends State<ListTileExample> {
|
||||
const Divider(),
|
||||
ListTile(
|
||||
titleAlignment: titleAlignment,
|
||||
leading: Checkbox(
|
||||
value: true,
|
||||
onChanged: (bool? value) {},
|
||||
),
|
||||
leading: Checkbox(value: true, onChanged: (bool? value) {}),
|
||||
title: const Text('Headline Text'),
|
||||
subtitle: const Text(
|
||||
'Tapping on the trailing widget will show a menu that allows you to change the title alignment. The title alignment is set to threeLine by default if `ThemeData.useMaterial3` is true. Otherwise, defaults to titleHeight.'),
|
||||
'Tapping on the trailing widget will show a menu that allows you to change the title alignment. The title alignment is set to threeLine by default if `ThemeData.useMaterial3` is true. Otherwise, defaults to titleHeight.',
|
||||
),
|
||||
trailing: PopupMenuButton<ListTileTitleAlignment>(
|
||||
onSelected: (ListTileTitleAlignment? value) {
|
||||
setState(() {
|
||||
titleAlignment = value;
|
||||
});
|
||||
},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<ListTileTitleAlignment>>[
|
||||
const PopupMenuItem<ListTileTitleAlignment>(
|
||||
value: ListTileTitleAlignment.threeLine,
|
||||
child: Text('threeLine'),
|
||||
),
|
||||
const PopupMenuItem<ListTileTitleAlignment>(
|
||||
value: ListTileTitleAlignment.titleHeight,
|
||||
child: Text('titleHeight'),
|
||||
),
|
||||
const PopupMenuItem<ListTileTitleAlignment>(
|
||||
value: ListTileTitleAlignment.top,
|
||||
child: Text('top'),
|
||||
),
|
||||
const PopupMenuItem<ListTileTitleAlignment>(
|
||||
value: ListTileTitleAlignment.center,
|
||||
child: Text('center'),
|
||||
),
|
||||
const PopupMenuItem<ListTileTitleAlignment>(
|
||||
value: ListTileTitleAlignment.bottom,
|
||||
child: Text('bottom'),
|
||||
),
|
||||
],
|
||||
itemBuilder:
|
||||
(BuildContext context) => <PopupMenuEntry<ListTileTitleAlignment>>[
|
||||
const PopupMenuItem<ListTileTitleAlignment>(
|
||||
value: ListTileTitleAlignment.threeLine,
|
||||
child: Text('threeLine'),
|
||||
),
|
||||
const PopupMenuItem<ListTileTitleAlignment>(
|
||||
value: ListTileTitleAlignment.titleHeight,
|
||||
child: Text('titleHeight'),
|
||||
),
|
||||
const PopupMenuItem<ListTileTitleAlignment>(
|
||||
value: ListTileTitleAlignment.top,
|
||||
child: Text('top'),
|
||||
),
|
||||
const PopupMenuItem<ListTileTitleAlignment>(
|
||||
value: ListTileTitleAlignment.center,
|
||||
child: Text('center'),
|
||||
),
|
||||
const PopupMenuItem<ListTileTitleAlignment>(
|
||||
value: ListTileTitleAlignment.bottom,
|
||||
child: Text('bottom'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
|
||||
@@ -13,10 +13,7 @@ class ListTileApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const ListTileExample(),
|
||||
);
|
||||
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const ListTileExample());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user