Commit eebe09d4 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Set the ScrollConfiguration for dropdown menus (#5255)

parent 47139f1d
......@@ -25,7 +25,6 @@ assets:
- packages/flutter_gallery_assets/pesto/image9.jpg
- packages/flutter_gallery_assets/pesto/logo_small.png
- packages/flutter_gallery_assets/pesto/logo_medium.png
- packages/flutter_gallery_assets/pesto/logo_big.png
- packages/flutter_gallery_assets/pesto/fish.png
- packages/flutter_gallery_assets/pesto/healthy.png
- packages/flutter_gallery_assets/pesto/main.png
......
......@@ -12,8 +12,7 @@ const String _kUserImage = 'packages/flutter_gallery_assets/pesto/avatar.jpg';
// Map of logo images keyed by the minimum height their container needs to be.
final Map<double, String> _kLogoImages = <double, String>{
0.0: 'packages/flutter_gallery_assets/pesto/logo_small.png',
70.0: 'packages/flutter_gallery_assets/pesto/logo_medium.png',
170.0: 'packages/flutter_gallery_assets/pesto/logo_big.png',
70.0: 'packages/flutter_gallery_assets/pesto/logo_medium.png'
};
final ThemeData _kTheme = new ThemeData(
......
......@@ -75,6 +75,16 @@ class _DropDownMenuPainter extends CustomPainter {
}
}
// Do not use the platform-specific default scroll configuration.
// Dropdown menus should never overscroll or display an overscroll indicator.
class _DropDownScrollConfigurationDelegate extends ScrollConfigurationDelegate {
const _DropDownScrollConfigurationDelegate();
@override
Widget wrapScrollWidget(Widget scrollWidget) => new ClampOverscrolls(value: true, child: scrollWidget);
}
final ScrollConfigurationDelegate _dropDownScroll = const _DropDownScrollConfigurationDelegate();
class _DropDownMenu<T> extends StatefulWidget {
_DropDownMenu({
Key key,
......@@ -159,12 +169,15 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> {
child: new Material(
type: MaterialType.transparency,
textStyle: route.style,
child: new Scrollbar(
child: new ScrollableList(
scrollableKey: config.route.scrollableKey,
padding: _kMenuVerticalPadding,
itemExtent: _kMenuItemHeight,
children: children
child: new ScrollConfiguration(
delegate: _dropDownScroll,
child: new Scrollbar(
child: new ScrollableList(
scrollableKey: config.route.scrollableKey,
padding: _kMenuVerticalPadding,
itemExtent: _kMenuItemHeight,
children: children
)
)
)
)
......
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