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 BottomNavigationBarExampleApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: BottomNavigationBarExample(),
|
||||
);
|
||||
return const MaterialApp(home: BottomNavigationBarExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,18 +28,9 @@ class _BottomNavigationBarExampleState extends State<BottomNavigationBarExample>
|
||||
int _selectedIndex = 0;
|
||||
static const TextStyle optionStyle = TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
|
||||
static const List<Widget> _widgetOptions = <Widget>[
|
||||
Text(
|
||||
'Index 0: Home',
|
||||
style: optionStyle,
|
||||
),
|
||||
Text(
|
||||
'Index 1: Business',
|
||||
style: optionStyle,
|
||||
),
|
||||
Text(
|
||||
'Index 2: School',
|
||||
style: optionStyle,
|
||||
),
|
||||
Text('Index 0: Home', style: optionStyle),
|
||||
Text('Index 1: Business', style: optionStyle),
|
||||
Text('Index 2: School', style: optionStyle),
|
||||
];
|
||||
|
||||
void _onItemTapped(int index) {
|
||||
@@ -53,26 +42,13 @@ class _BottomNavigationBarExampleState extends State<BottomNavigationBarExample>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('BottomNavigationBar Sample'),
|
||||
),
|
||||
body: Center(
|
||||
child: _widgetOptions.elementAt(_selectedIndex),
|
||||
),
|
||||
appBar: AppBar(title: const Text('BottomNavigationBar Sample')),
|
||||
body: Center(child: _widgetOptions.elementAt(_selectedIndex)),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
items: const <BottomNavigationBarItem>[
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.home),
|
||||
label: 'Home',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.business),
|
||||
label: 'Business',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.school),
|
||||
label: 'School',
|
||||
),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.business), label: 'Business'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.school), label: 'School'),
|
||||
],
|
||||
currentIndex: _selectedIndex,
|
||||
selectedItemColor: Colors.amber[800],
|
||||
|
||||
@@ -13,9 +13,7 @@ class BottomNavigationBarExampleApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: BottomNavigationBarExample(),
|
||||
);
|
||||
return const MaterialApp(home: BottomNavigationBarExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,22 +28,10 @@ class _BottomNavigationBarExampleState extends State<BottomNavigationBarExample>
|
||||
int _selectedIndex = 0;
|
||||
static const TextStyle optionStyle = TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
|
||||
static const List<Widget> _widgetOptions = <Widget>[
|
||||
Text(
|
||||
'Index 0: Home',
|
||||
style: optionStyle,
|
||||
),
|
||||
Text(
|
||||
'Index 1: Business',
|
||||
style: optionStyle,
|
||||
),
|
||||
Text(
|
||||
'Index 2: School',
|
||||
style: optionStyle,
|
||||
),
|
||||
Text(
|
||||
'Index 3: Settings',
|
||||
style: optionStyle,
|
||||
),
|
||||
Text('Index 0: Home', style: optionStyle),
|
||||
Text('Index 1: Business', style: optionStyle),
|
||||
Text('Index 2: School', style: optionStyle),
|
||||
Text('Index 3: Settings', style: optionStyle),
|
||||
];
|
||||
|
||||
void _onItemTapped(int index) {
|
||||
@@ -57,12 +43,8 @@ class _BottomNavigationBarExampleState extends State<BottomNavigationBarExample>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('BottomNavigationBar Sample'),
|
||||
),
|
||||
body: Center(
|
||||
child: _widgetOptions.elementAt(_selectedIndex),
|
||||
),
|
||||
appBar: AppBar(title: const Text('BottomNavigationBar Sample')),
|
||||
body: Center(child: _widgetOptions.elementAt(_selectedIndex)),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
items: const <BottomNavigationBarItem>[
|
||||
BottomNavigationBarItem(
|
||||
|
||||
@@ -13,9 +13,7 @@ class BottomNavigationBarExampleApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: BottomNavigationBarExample(),
|
||||
);
|
||||
return const MaterialApp(home: BottomNavigationBarExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,37 +30,24 @@ class _BottomNavigationBarExampleState extends State<BottomNavigationBarExample>
|
||||
|
||||
Widget _listViewBody() {
|
||||
return ListView.separated(
|
||||
controller: _homeController,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Center(
|
||||
child: Text(
|
||||
'Item $index',
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) => const Divider(
|
||||
thickness: 1,
|
||||
),
|
||||
itemCount: 50);
|
||||
controller: _homeController,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Center(child: Text('Item $index'));
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) => const Divider(thickness: 1),
|
||||
itemCount: 50,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('BottomNavigationBar Sample'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('BottomNavigationBar Sample')),
|
||||
body: _listViewBody(),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
items: const <BottomNavigationBarItem>[
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.home),
|
||||
label: 'Home',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.open_in_new_rounded),
|
||||
label: 'Open Dialog',
|
||||
),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.open_in_new_rounded), label: 'Open Dialog'),
|
||||
],
|
||||
currentIndex: _selectedIndex,
|
||||
selectedItemColor: Colors.amber[800],
|
||||
@@ -80,11 +65,9 @@ class _BottomNavigationBarExampleState extends State<BottomNavigationBarExample>
|
||||
case 1:
|
||||
showModal(context);
|
||||
}
|
||||
setState(
|
||||
() {
|
||||
_selectedIndex = index;
|
||||
},
|
||||
);
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -93,17 +76,18 @@ class _BottomNavigationBarExampleState extends State<BottomNavigationBarExample>
|
||||
void showModal(BuildContext context) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) => AlertDialog(
|
||||
content: const Text('Example Dialog'),
|
||||
actions: <TextButton>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Close'),
|
||||
)
|
||||
],
|
||||
),
|
||||
builder:
|
||||
(BuildContext context) => AlertDialog(
|
||||
content: const Text('Example Dialog'),
|
||||
actions: <TextButton>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Close'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user