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