From ca4b5cf4971763ca546c548a2583cb83b2aea1a6 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Fri, 1 Apr 2016 12:58:19 -0700 Subject: [PATCH] Polish drop-down padding Previously we weren't padding the top and the bottom of drop-down menus but the spec says these should have 8.0 pixel of padding, the same as popup menus. Fixes #2683 --- packages/flutter/lib/src/material/drop_down.dart | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/flutter/lib/src/material/drop_down.dart b/packages/flutter/lib/src/material/drop_down.dart index 3e37a0abf1..19c399d4e4 100644 --- a/packages/flutter/lib/src/material/drop_down.dart +++ b/packages/flutter/lib/src/material/drop_down.dart @@ -16,7 +16,8 @@ import 'material.dart'; const Duration _kDropDownMenuDuration = const Duration(milliseconds: 300); const double _kMenuItemHeight = 48.0; -const EdgeInsets _kMenuHorizontalPadding = const EdgeInsets.only(left: 36.0, right: 36.0); +const EdgeInsets _kMenuVerticalPadding = const EdgeInsets.symmetric(vertical: 8.0); +const EdgeInsets _kMenuHorizontalPadding = const EdgeInsets.symmetric(horizontal: 36.0); const double _kBaselineOffsetFromBottom = 20.0; const Border _kDropDownUnderline = const Border(bottom: const BorderSide(color: const Color(0xFFBDBDBD), width: 2.0)); @@ -117,16 +118,19 @@ class _DropDownMenu extends StatusTransitionWidget { final Tween menuTop = new Tween( begin: route.rect.top, - end: route.rect.top - route.selectedIndex * route.rect.height + end: route.rect.top - route.selectedIndex * route.rect.height - _kMenuVerticalPadding.top ); final Tween menuBottom = new Tween( begin: route.rect.bottom, - end: menuTop.end + route.items.length * route.rect.height + end: menuTop.end + route.items.length * route.rect.height + _kMenuVerticalPadding.vertical ); Widget child = new Material( type: MaterialType.transparency, - child: new Block(children: children) + child: new Block( + padding: _kMenuVerticalPadding, + children: children + ) ); return new FadeTransition( opacity: opacity, @@ -200,7 +204,7 @@ class _DropDownRoute extends PopupRoute<_DropDownRouteResult> { Size overlaySize = overlayBox.size; RelativeRect menuRect = new RelativeRect.fromSize(rect, overlaySize); return new ModalPosition( - top: menuRect.top - selectedIndex * rect.height, + top: menuRect.top - selectedIndex * rect.height - _kMenuVerticalPadding.top, left: menuRect.left, right: menuRect.right );