mirror of
https://github.com/flutter/flutter
synced 2024-10-13 19:52:53 +00:00
parent
31fd74230e
commit
269538df58
|
@ -84,7 +84,7 @@ class MenuDemoState extends State<MenuDemo> {
|
|||
]
|
||||
),
|
||||
body: new ListView(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
padding: kMaterialListPadding,
|
||||
children: <Widget>[
|
||||
// Pressing the PopupMenuButton on the right of this item shows
|
||||
// a simple menu with one disabled item. Typically the contents
|
||||
|
|
|
@ -60,7 +60,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
|
|||
key: _refreshIndicatorKey,
|
||||
onRefresh: _handleRefresh,
|
||||
child: new ListView.builder(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
padding: kMaterialListPadding,
|
||||
itemCount: _items.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final String item = _items[index];
|
||||
|
|
|
@ -59,7 +59,7 @@ class ShrinePageState extends State<ShrinePage> {
|
|||
);
|
||||
}
|
||||
return new ListView(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
padding: kMaterialListPadding,
|
||||
children: config.shoppingCart.values.map((Order order) {
|
||||
return new ListTile(
|
||||
title: new Text(order.product.name),
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/painting.dart';
|
||||
|
||||
/// The height of the toolbar component of the [AppBar].
|
||||
const double kToolbarHeight = 56.0;
|
||||
|
||||
|
@ -25,3 +27,5 @@ const int kRadialReactionAlpha = 0x33;
|
|||
|
||||
/// The duration
|
||||
const Duration kTabScrollDuration = const Duration(milliseconds: 200);
|
||||
|
||||
const EdgeInsets kMaterialListPadding = const EdgeInsets.symmetric(vertical: 8.0);
|
||||
|
|
|
@ -9,6 +9,7 @@ import 'package:flutter/scheduler.dart';
|
|||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'colors.dart';
|
||||
import 'constants.dart';
|
||||
import 'debug.dart';
|
||||
import 'icon.dart';
|
||||
import 'icons.dart';
|
||||
|
@ -21,7 +22,6 @@ import 'theme.dart';
|
|||
const Duration _kDropdownMenuDuration = const Duration(milliseconds: 300);
|
||||
const double _kMenuItemHeight = 48.0;
|
||||
const double _kDenseButtonHeight = 24.0;
|
||||
const EdgeInsets _kMenuVerticalPadding = const EdgeInsets.symmetric(vertical: 8.0);
|
||||
const EdgeInsets _kMenuHorizontalPadding = const EdgeInsets.symmetric(horizontal: 16.0);
|
||||
|
||||
class _DropdownMenuPainter extends CustomPainter {
|
||||
|
@ -49,7 +49,7 @@ class _DropdownMenuPainter extends CustomPainter {
|
|||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final double selectedItemOffset = selectedIndex * _kMenuItemHeight + _kMenuVerticalPadding.top;
|
||||
final double selectedItemOffset = selectedIndex * _kMenuItemHeight + kMaterialListPadding.top;
|
||||
final Tween<double> top = new Tween<double>(
|
||||
begin: selectedItemOffset.clamp(0.0, size.height - _kMenuItemHeight),
|
||||
end: 0.0,
|
||||
|
@ -178,7 +178,7 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
|
|||
child: new Scrollbar(
|
||||
child: new ListView(
|
||||
controller: config.route.scrollController,
|
||||
padding: _kMenuVerticalPadding,
|
||||
padding: kMaterialListPadding,
|
||||
itemExtent: _kMenuItemHeight,
|
||||
shrinkWrap: true,
|
||||
children: children,
|
||||
|
@ -219,7 +219,7 @@ class _DropdownMenuRouteLayout<T> extends SingleChildLayoutDelegate {
|
|||
@override
|
||||
Offset getPositionForChild(Size size, Size childSize) {
|
||||
final double buttonTop = buttonRect.top;
|
||||
final double selectedItemOffset = selectedIndex * _kMenuItemHeight + _kMenuVerticalPadding.top;
|
||||
final double selectedItemOffset = selectedIndex * _kMenuItemHeight + kMaterialListPadding.top;
|
||||
double top = (buttonTop - selectedItemOffset) - (_kMenuItemHeight - buttonRect.height) / 2.0;
|
||||
final double topPreferredLimit = _kMenuItemHeight;
|
||||
if (top < topPreferredLimit)
|
||||
|
|
Loading…
Reference in a new issue