Commit b1a77203 authored by Dragoș Tiselice's avatar Dragoș Tiselice Committed by GitHub

Fixed capitalization of toolbar. (#5895)

Fixes #4713.
parent f0f99a45
......@@ -12,7 +12,7 @@ import 'shrine_page.dart';
import 'shrine_theme.dart';
import 'shrine_types.dart';
const double unitSize = kToolBarHeight;
const double unitSize = kToolbarHeight;
final List<Product> _products = new List<Product>.from(allProducts());
final Map<Product, Order> _shoppingCart = <Product, Order>{};
......
......@@ -24,14 +24,14 @@ abstract class AppBarBottomWidget extends Widget {
double get bottomHeight;
}
enum _ToolBarSlot {
enum _ToolbarSlot {
leading,
title,
actions,
}
class _ToolBarLayout extends MultiChildLayoutDelegate {
_ToolBarLayout({ this.centerTitle });
class _ToolbarLayout extends MultiChildLayoutDelegate {
_ToolbarLayout({ this.centerTitle });
// If false the title should be left or right justified within the space bewteen
// the leading and actions widgets, depending on the locale's writing direction.
......@@ -46,22 +46,22 @@ class _ToolBarLayout extends MultiChildLayoutDelegate {
void performLayout(Size size) {
double actionsWidth = 0.0;
if (hasChild(_ToolBarSlot.leading)) {
if (hasChild(_ToolbarSlot.leading)) {
final BoxConstraints constraints = new BoxConstraints.tight(new Size(kLeadingWidth, size.height));
layoutChild(_ToolBarSlot.leading, constraints);
positionChild(_ToolBarSlot.leading, Offset.zero);
layoutChild(_ToolbarSlot.leading, constraints);
positionChild(_ToolbarSlot.leading, Offset.zero);
}
if (hasChild(_ToolBarSlot.actions)) {
if (hasChild(_ToolbarSlot.actions)) {
final BoxConstraints constraints = new BoxConstraints.loose(size);
actionsWidth = layoutChild(_ToolBarSlot.actions, constraints).width;
positionChild(_ToolBarSlot.actions, new Offset(size.width - actionsWidth, 0.0));
actionsWidth = layoutChild(_ToolbarSlot.actions, constraints).width;
positionChild(_ToolbarSlot.actions, new Offset(size.width - actionsWidth, 0.0));
}
if (hasChild(_ToolBarSlot.title)) {
if (hasChild(_ToolbarSlot.title)) {
final double maxWidth = size.width - kTitleLeft - actionsWidth;
final BoxConstraints constraints = new BoxConstraints.loose(size).copyWith(maxWidth: maxWidth);
final Size titleSize = layoutChild(_ToolBarSlot.title, constraints);
final Size titleSize = layoutChild(_ToolbarSlot.title, constraints);
final double titleY = (size.height - titleSize.height) / 2.0;
double titleX = kTitleLeft;
......@@ -75,12 +75,12 @@ class _ToolBarLayout extends MultiChildLayoutDelegate {
titleX = kTitleLeft;
}
positionChild(_ToolBarSlot.title, new Offset(titleX, titleY));
positionChild(_ToolbarSlot.title, new Offset(titleX, titleY));
}
}
@override
bool shouldRelayout(_ToolBarLayout oldDelegate) => centerTitle != oldDelegate.centerTitle;
bool shouldRelayout(_ToolbarLayout oldDelegate) => centerTitle != oldDelegate.centerTitle;
}
// TODO(eseidel) Toolbar needs to change size based on orientation:
......@@ -287,7 +287,7 @@ class AppBar extends StatelessWidget {
);
}
double get _toolBarHeight => kToolBarHeight;
double get _toolbarHeight => kToolbarHeight;
/// The height of the bottom widget. The [Scaffold] uses this value to control
/// the size of the app bar when its appBarBehavior is [AppBarBehavior.scroll]
......@@ -300,16 +300,16 @@ class AppBar extends StatelessWidget {
/// enough to accommodate whatever that widget contains.
///
/// See also [getExpandedHeightFor].
double get expandedHeight => _expandedHeight ?? (_toolBarHeight + bottomHeight);
double get expandedHeight => _expandedHeight ?? (_toolbarHeight + bottomHeight);
/// By default, the height of the toolbar and the bottom widget (if any).
/// If the height of the app bar is constrained to be less than this value
/// then the toolbar and bottom widget are scrolled upwards, out of view.
double get collapsedHeight => _collapsedHeight ?? (_toolBarHeight + bottomHeight);
double get collapsedHeight => _collapsedHeight ?? (_toolbarHeight + bottomHeight);
// Defines the opacity of the toolbar's text and icons.
double _toolBarOpacity(double appBarHeight, double statusBarHeight) {
return ((appBarHeight - bottomHeight - statusBarHeight) / _toolBarHeight).clamp(0.0, 1.0);
double _toolbarOpacity(double appBarHeight, double statusBarHeight) {
return ((appBarHeight - bottomHeight - statusBarHeight) / _toolbarHeight).clamp(0.0, 1.0);
}
double _bottomOpacity(double appBarHeight, double statusBarHeight) {
......@@ -345,9 +345,9 @@ class AppBar extends StatelessWidget {
? mojom.SystemUiOverlayStyle.light
: mojom.SystemUiOverlayStyle.dark);
final double toolBarOpacity = _toolBarOpacity(size.height, statusBarHeight);
if (toolBarOpacity != 1.0) {
final double opacity = const Interval(0.25, 1.0, curve: Curves.fastOutSlowIn).transform(toolBarOpacity);
final double toolbarOpacity = _toolbarOpacity(size.height, statusBarHeight);
if (toolbarOpacity != 1.0) {
final double opacity = const Interval(0.25, 1.0, curve: Curves.fastOutSlowIn).transform(toolbarOpacity);
if (centerStyle?.color != null)
centerStyle = centerStyle.copyWith(color: centerStyle.color.withOpacity(opacity));
if (sideStyle?.color != null)
......@@ -357,19 +357,19 @@ class AppBar extends StatelessWidget {
);
}
final List<Widget> toolBarChildren = <Widget>[];
final List<Widget> toolbarChildren = <Widget>[];
if (leading != null) {
toolBarChildren.add(
toolbarChildren.add(
new LayoutId(
id: _ToolBarSlot.leading,
id: _ToolbarSlot.leading,
child: leading
)
);
}
if (title != null) {
toolBarChildren.add(
toolbarChildren.add(
new LayoutId(
id: _ToolBarSlot.title,
id: _ToolbarSlot.title,
child: new DefaultTextStyle(
style: centerStyle,
softWrap: false,
......@@ -380,9 +380,9 @@ class AppBar extends StatelessWidget {
);
}
if (actions != null && actions.isNotEmpty) {
toolBarChildren.add(
toolbarChildren.add(
new LayoutId(
id: _ToolBarSlot.actions,
id: _ToolbarSlot.actions,
child: new Row(
mainAxisSize: MainAxisSize.min,
children: actions
......@@ -391,24 +391,24 @@ class AppBar extends StatelessWidget {
);
}
Widget toolBar = new Padding(
Widget toolbar = new Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: new CustomMultiChildLayout(
delegate: new _ToolBarLayout(
delegate: new _ToolbarLayout(
centerTitle: _getEffectiveCenterTitle(themeData)
),
children: toolBarChildren
children: toolbarChildren
)
);
Widget appBar = new SizedBox(
height: kToolBarHeight,
height: kToolbarHeight,
child: new IconTheme.merge(
context: context,
data: appBarIconTheme,
child: new DefaultTextStyle(
style: sideStyle,
child: toolBar
child: toolbar
)
)
);
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// The height of the tool bar component of the [AppBar].
const double kToolBarHeight = 56.0;
/// The height of the toolbar component of the [AppBar].
const double kToolbarHeight = 56.0;
/// The height of a tab bar containing text.
const double kTextTabBarHeight = 48.0;
......
......@@ -78,7 +78,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
final double currentHeight = size.height;
final double maxHeight = statusBarHeight + AppBar.getExpandedHeightFor(context);
final double minHeight = statusBarHeight + kToolBarHeight;
final double minHeight = statusBarHeight + kToolbarHeight;
final double deltaHeight = maxHeight - minHeight;
// 0.0 -> Expanded
......@@ -89,7 +89,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
// background image
if (config.background != null) {
final double fadeStart = math.max(0.0, 1.0 - kToolBarHeight / deltaHeight);
final double fadeStart = math.max(0.0, 1.0 - kToolbarHeight / deltaHeight);
final double fadeEnd = 1.0;
assert(fadeStart <= fadeEnd);
final double opacity = 1.0 - new Interval(fadeStart, fadeEnd).transform(t);
......@@ -110,7 +110,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
if (config.title != null) {
final ThemeData theme = Theme.of(context);
final double opacity = (1.0 - (minHeight - currentHeight) / (kToolBarHeight - statusBarHeight)).clamp(0.0, 1.0);
final double opacity = (1.0 - (minHeight - currentHeight) / (kToolbarHeight - statusBarHeight)).clamp(0.0, 1.0);
if (opacity > 0.0) {
TextStyle titleStyle = theme.primaryTextTheme.title;
titleStyle = titleStyle.copyWith(
......
......@@ -41,7 +41,7 @@ enum TextSelectionHandleType {
/// Builds a selection handle of the given type.
typedef Widget TextSelectionHandleBuilder(BuildContext context, TextSelectionHandleType type);
/// Builds a tool bar near a text selection.
/// Builds a toolbar near a text selection.
///
/// Typically displays buttons for copying and pasting text.
// TODO(mpcomplete): A single position is probably insufficient.
......@@ -110,9 +110,9 @@ class TextSelectionOverlay implements TextSelectionDelegate {
/// selected.
final TextSelectionHandleBuilder handleBuilder;
/// Builds a tool bar to display near the selection.
/// Builds a toolbar to display near the selection.
///
/// The tool bar typically contains buttons for copying and pasting text.
/// The toolbar typically contains buttons for copying and pasting text.
final TextSelectionToolbarBuilder toolbarBuilder;
/// Controls the fade-in animations.
......
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