From a46e3377880ef15c51d23b7457040e2e3c416a76 Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Thu, 28 Jul 2016 16:10:32 -0700 Subject: [PATCH] AppBar: pad toolbars not tab bars (#5124) --- packages/flutter/lib/src/material/app_bar.dart | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/flutter/lib/src/material/app_bar.dart b/packages/flutter/lib/src/material/app_bar.dart index 3fdb41552a..e738a8d67b 100644 --- a/packages/flutter/lib/src/material/app_bar.dart +++ b/packages/flutter/lib/src/material/app_bar.dart @@ -41,7 +41,8 @@ abstract class AppBarBottomWidget extends Widget { /// The AppBar displays the toolbar widgets, [leading], [title], and /// [actions], above the [bottom] (if any). If a [flexibleSpace] widget is /// specified then it is stacked behind the toolbar and the bottom widget. -/// The [Scaffold] typically creates the appbar with an initial height equal to +/// +/// The [Scaffold] typically creates the app bar with an initial height equal to /// [expandedHeight]. If the [Scaffold.appBarBehavior] is set then the /// AppBar's [collapsedHeight] and [bottomHeight] define how small the app bar /// will become when the application is scrolled. @@ -288,7 +289,10 @@ class AppBar extends StatelessWidget { if (actions != null) toolBarRow.addAll(actions); - Widget toolBar = new Row(children: toolBarRow); + Widget toolBar = new Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: new Row(children: toolBarRow) + ); if (effectiveCenterTitle && centerWidget != null) { toolBar = new Stack( @@ -330,18 +334,15 @@ class AppBar extends StatelessWidget { // The padding applies to the toolbar and tabbar, not the flexible space. // The incoming padding parameter's top value typically equals the height // of the status bar - so that the toolbar appears below the status bar. - EdgeInsets combinedPadding = new EdgeInsets.symmetric(horizontal: 8.0); - if (padding != null) - combinedPadding += padding; appBar = new Padding( - padding: combinedPadding, + padding: padding, child: appBar ); // If the appBar's height shrinks below collapsedHeight, it will be clipped and bottom // justified. This is so that the toolbar and the tabbar appear to move upwards as // the appBar's height is reduced below collapsedHeight. - final double paddedCollapsedHeight = collapsedHeight + combinedPadding.top + combinedPadding.bottom; + final double paddedCollapsedHeight = collapsedHeight + padding.top + padding.bottom; if (size.height < paddedCollapsedHeight) { appBar = new ClipRect( child: new OverflowBox(