Unverified Commit d759197d authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

Add scrollbars to Gallery (#33634)

parent 23174c34
......@@ -115,9 +115,11 @@ class PaletteTabView extends StatelessWidget {
}).toList());
}
return ListView(
return Scrollbar(
child: ListView(
itemExtent: kColorItemHeight,
children: colorItems,
)
);
}
}
......
......@@ -54,7 +54,8 @@ class _CupertinoAlertDemoState extends State<CupertinoAlertDemo> {
child: Builder(
builder: (BuildContext context) {
final List<Widget> stackChildren = <Widget>[
ListView(
CupertinoScrollbar(
child: ListView(
// Add more padding to the normal safe area.
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0)
+ MediaQuery.of(context).padding,
......@@ -185,6 +186,7 @@ class _CupertinoAlertDemoState extends State<CupertinoAlertDemo> {
),
],
),
),
];
if (lastSelectedValue != null) {
......
......@@ -430,11 +430,13 @@ class CupertinoDemoTab2 extends StatelessWidget {
navigationBar: CupertinoNavigationBar(
trailing: trailingButtons,
),
child: CupertinoScrollbar(
child: ListView(
children: <Widget>[
Tab2Header(),
]..addAll(buildTab2Conversation()),
),
),
);
}
}
......
......@@ -166,6 +166,7 @@ class _CupertinoTextFieldDemoState extends State<CupertinoTextFieldDemo> {
previousPageTitle: 'Cupertino',
middle: Text('Text Fields'),
),
child: CupertinoScrollbar(
child: ListView(
children: <Widget>[
Padding(
......@@ -187,6 +188,7 @@ class _CupertinoTextFieldDemoState extends State<CupertinoTextFieldDemo> {
],
),
),
),
);
}
}
......@@ -102,7 +102,8 @@ class CategoryView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
return ListView(
return Scrollbar(
child: ListView(
key: PageStorageKey<Category>(category),
padding: const EdgeInsets.symmetric(
vertical: 16.0,
......@@ -139,6 +140,7 @@ class CategoryView extends StatelessWidget {
],
);
}).toList(),
)
);
}
}
......
......@@ -156,7 +156,8 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
),
],
),
body: ListView(
body: Scrollbar(
child: ListView(
padding: const EdgeInsets.only(bottom: 88.0),
children: <Widget>[
const _Heading('FAB Shape'),
......@@ -185,6 +186,7 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
_ColorsItem(kBabColors, _babColor, _onBabColorChanged),
],
),
),
floatingActionButton: _fabShape.value,
floatingActionButtonLocation: _fabLocation.value,
bottomNavigationBar: _DemoBottomAppBar(
......
......@@ -388,7 +388,8 @@ class _CardsDemoState extends State<CardsDemo> {
),
],
),
body: ListView(
body: Scrollbar(
child: ListView(
padding: const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0),
children: destinations.map<Widget>((TravelDestination destination) {
Widget child;
......@@ -410,6 +411,7 @@ class _CardsDemoState extends State<CardsDemo> {
);
}).toList(),
),
),
);
}
}
......@@ -324,7 +324,7 @@ class _ChipDemoState extends State<ChipDemo> {
borderRadius: BorderRadius.circular(10.0),
))
: theme.chipTheme,
child: ListView(children: tiles),
child: Scrollbar(child: ListView(children: tiles)),
),
floatingActionButton: FloatingActionButton(
onPressed: () => setState(_reset),
......
......@@ -172,7 +172,8 @@ class _DataTableDemoState extends State<DataTableDemo> {
MaterialDemoDocumentationButton(DataTableDemo.routeName),
],
),
body: ListView(
body: Scrollbar(
child: ListView(
padding: const EdgeInsets.all(20.0),
children: <Widget>[
PaginatedDataTable(
......@@ -229,6 +230,7 @@ class _DataTableDemoState extends State<DataTableDemo> {
),
],
),
),
);
}
}
......@@ -57,9 +57,7 @@ class _ElevationDemoState extends State<ElevationDemo> {
),
],
),
body: ListView(
children: buildCards(),
),
body: Scrollbar(child: ListView(children: buildCards())),
);
}
}
......@@ -16,7 +16,8 @@ class ExpansionTileListDemo extends StatelessWidget {
title: const Text('Expand/collapse list control'),
actions: <Widget>[MaterialDemoDocumentationButton(routeName)],
),
body: ListView(
body: Scrollbar(
child: ListView(
children: <Widget>[
const ListTile(title: Text('Top')),
ExpansionTile(
......@@ -33,6 +34,7 @@ class ExpansionTileListDemo extends StatelessWidget {
const ListTile(title: Text('Bottom')),
],
),
),
);
}
}
......@@ -162,6 +162,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
),
body: Form(
onWillPop: _onWillPop,
child: Scrollbar(
child: ListView(
padding: const EdgeInsets.all(16.0),
children: <Widget>[
......@@ -261,6 +262,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
.toList(),
),
),
),
);
}
}
......@@ -58,6 +58,7 @@ class IconsDemoState extends State<IconsDemo> {
child: SafeArea(
top: false,
bottom: false,
child: Scrollbar(
child: ListView(
padding: const EdgeInsets.all(24.0),
children: <Widget>[
......@@ -68,6 +69,7 @@ class IconsDemoState extends State<IconsDemo> {
),
),
),
),
);
}
}
......
......@@ -130,7 +130,8 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
),
);
} else {
body = ListView(
body = Scrollbar(
child: ListView(
children: leaveBehindItems.map<Widget>((LeaveBehindItem item) {
return _LeaveBehindListItem(
confirmDismiss: _confirmDismiss,
......@@ -140,6 +141,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
dismissDirection: _dismissDirection,
);
}).toList(),
),
);
}
......
......@@ -62,6 +62,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
body: RefreshIndicator(
key: _refreshIndicatorKey,
onRefresh: _handleRefresh,
child: Scrollbar(
child: ListView.builder(
padding: kMaterialListPadding,
itemCount: _items.length,
......@@ -76,6 +77,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
},
),
),
),
);
}
}
......@@ -182,6 +182,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
key: _formKey,
autovalidate: _autovalidate,
onWillPop: _warnUserAboutInvalidData,
child: Scrollbar(
child: SingleChildScrollView(
dragStartBehavior: DragStartBehavior.down,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
......@@ -296,6 +297,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
),
),
),
),
);
}
}
......
......@@ -73,7 +73,7 @@ class TypographyDemo extends StatelessWidget {
body: SafeArea(
top: false,
bottom: false,
child: ListView(children: styleItems),
child: Scrollbar(child: ListView(children: styleItems)),
),
);
}
......
......@@ -405,6 +405,7 @@ class _VideoDemoState extends State<VideoDemo> with SingleTickerProviderStateMix
),
body: isSupported
? ConnectivityOverlay(
child: Scrollbar(
child: ListView(
children: <Widget>[
VideoCard(
......@@ -419,6 +420,7 @@ class _VideoDemoState extends State<VideoDemo> with SingleTickerProviderStateMix
),
],
),
),
connectedCompleter: connectedCompleter,
scaffoldKey: scaffoldKey,
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment