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 NestedScrollViewExampleApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: NestedScrollViewExample(),
|
||||
);
|
||||
return const MaterialApp(home: NestedScrollViewExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,65 +62,64 @@ class NestedScrollViewExample extends StatelessWidget {
|
||||
},
|
||||
body: TabBarView(
|
||||
// These are the contents of the tab views, below the tabs.
|
||||
children: tabs.map((String name) {
|
||||
return SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Builder(
|
||||
// This Builder is needed to provide a BuildContext that is
|
||||
// "inside" the NestedScrollView, so that
|
||||
// sliverOverlapAbsorberHandleFor() can find the
|
||||
// NestedScrollView.
|
||||
builder: (BuildContext context) {
|
||||
return CustomScrollView(
|
||||
// The "controller" and "primary" members should be left
|
||||
// unset, so that the NestedScrollView can control this
|
||||
// inner scroll view.
|
||||
// If the "controller" property is set, then this scroll
|
||||
// view will not be associated with the NestedScrollView.
|
||||
// The PageStorageKey should be unique to this ScrollView;
|
||||
// it allows the list to remember its scroll position when
|
||||
// the tab view is not on the screen.
|
||||
key: PageStorageKey<String>(name),
|
||||
slivers: <Widget>[
|
||||
SliverOverlapInjector(
|
||||
// This is the flip side of the SliverOverlapAbsorber
|
||||
// above.
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
// In this example, the inner scroll view has
|
||||
// fixed-height list items, hence the use of
|
||||
// SliverFixedExtentList. However, one could use any
|
||||
// sliver widget here, e.g. SliverList or SliverGrid.
|
||||
sliver: SliverFixedExtentList(
|
||||
// The items in this example are fixed to 48 pixels
|
||||
// high. This matches the Material Design spec for
|
||||
// ListTile widgets.
|
||||
itemExtent: 48.0,
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
// This builder is called for each child.
|
||||
// In this example, we just number each list item.
|
||||
return ListTile(
|
||||
title: Text('Item $index'),
|
||||
);
|
||||
},
|
||||
// The childCount of the SliverChildBuilderDelegate
|
||||
// specifies how many children this inner list
|
||||
// has. In this example, each tab has a list of
|
||||
// exactly 30 items, but this is arbitrary.
|
||||
childCount: 30,
|
||||
children:
|
||||
tabs.map((String name) {
|
||||
return SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Builder(
|
||||
// This Builder is needed to provide a BuildContext that is
|
||||
// "inside" the NestedScrollView, so that
|
||||
// sliverOverlapAbsorberHandleFor() can find the
|
||||
// NestedScrollView.
|
||||
builder: (BuildContext context) {
|
||||
return CustomScrollView(
|
||||
// The "controller" and "primary" members should be left
|
||||
// unset, so that the NestedScrollView can control this
|
||||
// inner scroll view.
|
||||
// If the "controller" property is set, then this scroll
|
||||
// view will not be associated with the NestedScrollView.
|
||||
// The PageStorageKey should be unique to this ScrollView;
|
||||
// it allows the list to remember its scroll position when
|
||||
// the tab view is not on the screen.
|
||||
key: PageStorageKey<String>(name),
|
||||
slivers: <Widget>[
|
||||
SliverOverlapInjector(
|
||||
// This is the flip side of the SliverOverlapAbsorber
|
||||
// above.
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
// In this example, the inner scroll view has
|
||||
// fixed-height list items, hence the use of
|
||||
// SliverFixedExtentList. However, one could use any
|
||||
// sliver widget here, e.g. SliverList or SliverGrid.
|
||||
sliver: SliverFixedExtentList(
|
||||
// The items in this example are fixed to 48 pixels
|
||||
// high. This matches the Material Design spec for
|
||||
// ListTile widgets.
|
||||
itemExtent: 48.0,
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
// This builder is called for each child.
|
||||
// In this example, we just number each list item.
|
||||
return ListTile(title: Text('Item $index'));
|
||||
},
|
||||
// The childCount of the SliverChildBuilderDelegate
|
||||
// specifies how many children this inner list
|
||||
// has. In this example, each tab has a list of
|
||||
// exactly 30 items, but this is arbitrary.
|
||||
childCount: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -13,9 +13,7 @@ class NestedScrollViewExampleApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: NestedScrollViewExample(),
|
||||
);
|
||||
return const MaterialApp(home: NestedScrollViewExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,28 +23,28 @@ class NestedScrollViewExample extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: NestedScrollView(
|
||||
// Setting floatHeaderSlivers to true is required in order to float
|
||||
// the outer slivers over the inner scrollable.
|
||||
floatHeaderSlivers: true,
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
return <Widget>[
|
||||
SliverAppBar(
|
||||
title: const Text('Floating Nested SliverAppBar'),
|
||||
floating: true,
|
||||
expandedHeight: 200.0,
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
),
|
||||
];
|
||||
},
|
||||
body: ListView.builder(
|
||||
padding: const EdgeInsets.all(8),
|
||||
itemCount: 30,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return SizedBox(
|
||||
height: 50,
|
||||
child: Center(child: Text('Item $index')),
|
||||
);
|
||||
})));
|
||||
body: NestedScrollView(
|
||||
// Setting floatHeaderSlivers to true is required in order to float
|
||||
// the outer slivers over the inner scrollable.
|
||||
floatHeaderSlivers: true,
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
return <Widget>[
|
||||
SliverAppBar(
|
||||
title: const Text('Floating Nested SliverAppBar'),
|
||||
floating: true,
|
||||
expandedHeight: 200.0,
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
),
|
||||
];
|
||||
},
|
||||
body: ListView.builder(
|
||||
padding: const EdgeInsets.all(8),
|
||||
itemCount: 30,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return SizedBox(height: 50, child: Center(child: Text('Item $index')));
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,7 @@ class NestedScrollViewExampleApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: NestedScrollViewExample(),
|
||||
);
|
||||
return const MaterialApp(home: NestedScrollViewExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,36 +23,44 @@ class NestedScrollViewExample extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: NestedScrollView(headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
return <Widget>[
|
||||
SliverOverlapAbsorber(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
sliver: SliverAppBar(
|
||||
title: const Text('Snapping Nested SliverAppBar'),
|
||||
floating: true,
|
||||
snap: true,
|
||||
expandedHeight: 200.0,
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
),
|
||||
),
|
||||
];
|
||||
}, body: Builder(builder: (BuildContext context) {
|
||||
return CustomScrollView(
|
||||
// The "controller" and "primary" members should be left unset, so that
|
||||
// the NestedScrollView can control this inner scroll view.
|
||||
// If the "controller" property is set, then this scroll view will not
|
||||
// be associated with the NestedScrollView.
|
||||
slivers: <Widget>[
|
||||
SliverOverlapInjector(handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context)),
|
||||
SliverFixedExtentList(
|
||||
itemExtent: 48.0,
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) => ListTile(title: Text('Item $index')),
|
||||
childCount: 30,
|
||||
body: NestedScrollView(
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
return <Widget>[
|
||||
SliverOverlapAbsorber(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
sliver: SliverAppBar(
|
||||
title: const Text('Snapping Nested SliverAppBar'),
|
||||
floating: true,
|
||||
snap: true,
|
||||
expandedHeight: 200.0,
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
})));
|
||||
];
|
||||
},
|
||||
body: Builder(
|
||||
builder: (BuildContext context) {
|
||||
return CustomScrollView(
|
||||
// The "controller" and "primary" members should be left unset, so that
|
||||
// the NestedScrollView can control this inner scroll view.
|
||||
// If the "controller" property is set, then this scroll view will not
|
||||
// be associated with the NestedScrollView.
|
||||
slivers: <Widget>[
|
||||
SliverOverlapInjector(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
),
|
||||
SliverFixedExtentList(
|
||||
itemExtent: 48.0,
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) => ListTile(title: Text('Item $index')),
|
||||
childCount: 30,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,7 @@ class NestedScrollViewStateExampleApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: NestedScrollViewStateExample(),
|
||||
);
|
||||
return const MaterialApp(home: NestedScrollViewStateExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,15 +27,11 @@ class NestedScrollViewStateExample extends StatelessWidget {
|
||||
return NestedScrollView(
|
||||
key: globalKey,
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
return const <Widget>[
|
||||
SliverAppBar(
|
||||
title: Text('NestedScrollViewState Demo!'),
|
||||
),
|
||||
];
|
||||
return const <Widget>[SliverAppBar(title: Text('NestedScrollViewState Demo!'))];
|
||||
},
|
||||
body: const CustomScrollView(
|
||||
// Body slivers go here!
|
||||
),
|
||||
// Body slivers go here!
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user