mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Set the ScrollConfiguration for dropdown menus (#5255)
This commit is contained in:
parent
47139f1da9
commit
eebe09d402
@ -25,7 +25,6 @@ assets:
|
|||||||
- packages/flutter_gallery_assets/pesto/image9.jpg
|
- packages/flutter_gallery_assets/pesto/image9.jpg
|
||||||
- packages/flutter_gallery_assets/pesto/logo_small.png
|
- packages/flutter_gallery_assets/pesto/logo_small.png
|
||||||
- packages/flutter_gallery_assets/pesto/logo_medium.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/fish.png
|
||||||
- packages/flutter_gallery_assets/pesto/healthy.png
|
- packages/flutter_gallery_assets/pesto/healthy.png
|
||||||
- packages/flutter_gallery_assets/pesto/main.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.
|
// Map of logo images keyed by the minimum height their container needs to be.
|
||||||
final Map<double, String> _kLogoImages = <double, String>{
|
final Map<double, String> _kLogoImages = <double, String>{
|
||||||
0.0: 'packages/flutter_gallery_assets/pesto/logo_small.png',
|
0.0: 'packages/flutter_gallery_assets/pesto/logo_small.png',
|
||||||
70.0: 'packages/flutter_gallery_assets/pesto/logo_medium.png',
|
70.0: 'packages/flutter_gallery_assets/pesto/logo_medium.png'
|
||||||
170.0: 'packages/flutter_gallery_assets/pesto/logo_big.png',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final ThemeData _kTheme = new ThemeData(
|
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 {
|
class _DropDownMenu<T> extends StatefulWidget {
|
||||||
_DropDownMenu({
|
_DropDownMenu({
|
||||||
Key key,
|
Key key,
|
||||||
@ -159,6 +169,8 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> {
|
|||||||
child: new Material(
|
child: new Material(
|
||||||
type: MaterialType.transparency,
|
type: MaterialType.transparency,
|
||||||
textStyle: route.style,
|
textStyle: route.style,
|
||||||
|
child: new ScrollConfiguration(
|
||||||
|
delegate: _dropDownScroll,
|
||||||
child: new Scrollbar(
|
child: new Scrollbar(
|
||||||
child: new ScrollableList(
|
child: new ScrollableList(
|
||||||
scrollableKey: config.route.scrollableKey,
|
scrollableKey: config.route.scrollableKey,
|
||||||
@ -169,6 +181,7 @@ class _DropDownMenuState<T> extends State<_DropDownMenu<T>> {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user