From 5eb44433434dd0f0312f3a0ed18ba7c3a20ca37a Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 28 Apr 2016 09:32:19 -0700 Subject: [PATCH] Address review comments from previous patches (#3600) This patch addresses late-breaking comments on previous patches. --- CONTRIBUTING.md | 4 ++-- packages/flutter/lib/src/material/scaffold.dart | 13 +++++++------ packages/flutter/lib/src/material/typography.dart | 11 +++++------ packages/flutter/test/material/scaffold_test.dart | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7a64110397..051b1c588f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,10 +78,10 @@ Individual tests can also be run directly, e.g. `flutter test lib/my_app_test.da Flutter tests use [package:flutter_test](https://github.com/flutter/flutter/tree/master/packages/flutter_test) which provides flutter-specific extensions on top of [package:test](https://pub.dartlang.org/packages/test). -`flutter test` runs tests inside the flutter shell. Some packages inside the flutter repository can be run inside the dart command line VM as well as the flutter shell, `packages/flutter_tools` is one such examples: +`flutter test` runs tests inside the flutter shell. Some packages inside the flutter repository can be run inside the dart command line VM as well as the flutter shell, `packages/flutter_tools` is one such example: * `cd packages/flutter_tools` - * `pub run test` + * `dart test/all.dart` `flutter test --flutter-repo` is a shortcut for those working on the flutter repository itself which runs all tests inside the `flutter` package regardless of the current working directory. To run all the tests for the entire Flutter repository, the same way that Travis runs them, run `travis/test.sh`. diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index 96bb36ed14..7df31a5908 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -231,7 +231,7 @@ class Scaffold extends StatefulWidget { this.drawer, this.scrollableKey, this.appBarBehavior: AppBarBehavior.anchor, - this.resizeToAvoidWindowPadding: true + this.resizeToAvoidBottomPadding: true }) : super(key: key) { assert(scrollableKey != null ? (appBarBehavior != AppBarBehavior.anchor) : true); } @@ -243,7 +243,7 @@ class Scaffold extends StatefulWidget { /// /// Displayed below the app bar and behind the [floatingActionButton] and /// [drawer]. To avoid the body being resized to avoid the window padding - /// (e.g., from the onscreen keyboard), see [resizeToAvoidWindowPadding]. + /// (e.g., from the onscreen keyboard), see [resizeToAvoidBottomPadding]. final Widget body; /// A button displayed on top of the body. @@ -267,14 +267,15 @@ class Scaffold extends StatefulWidget { /// By default, the [appBar] does not respond to scrolling. final AppBarBehavior appBarBehavior; - /// Whether the [body] (and other floating widgets) should size themselves to avoid the window's padding. + /// Whether the [body] (and other floating widgets) should size themselves to + /// avoid the window's bottom padding. /// /// For example, if there is an onscreen keyboard displayed above the /// scaffold, the body can be resized to avoid overlapping the keyboard, which /// prevents widgets inside the body from being obscured by the keyboard. /// /// Defaults to true. - final bool resizeToAvoidWindowPadding; + final bool resizeToAvoidBottomPadding; /// The state from the closest instance of this class that encloses the given context. static ScaffoldState of(BuildContext context) => context.ancestorStateOfType(const TypeMatcher()); @@ -613,8 +614,8 @@ class ScaffoldState extends State { @override Widget build(BuildContext context) { EdgeInsets padding = MediaQuery.of(context).padding; - if (!config.resizeToAvoidWindowPadding) - padding = new EdgeInsets.only(top: padding.top); + if (!config.resizeToAvoidBottomPadding) + padding = new EdgeInsets.fromLTRB(padding.left, padding.top, padding.right, 0.0); if (_snackBars.length > 0) { final ModalRoute route = ModalRoute.of(context); diff --git a/packages/flutter/lib/src/material/typography.dart b/packages/flutter/lib/src/material/typography.dart index d41658b62c..cdad0332d6 100644 --- a/packages/flutter/lib/src/material/typography.dart +++ b/packages/flutter/lib/src/material/typography.dart @@ -115,10 +115,9 @@ class TextTheme { /// The two material design text themes. /// /// [Typography.black] and [Typography.white] define the two text themes used in -/// material design. The black text theme, which uses darkly colored glyphs, is -/// used on lightly colored backgrounds in light themes. The white text theme, -/// which uses lightly colored glyphs, is used on darkly colored backgrounds in -/// in light themes and in dark themes. +/// material design. The black text theme, which uses dark glyphs, is used on +/// light backgrounds in light themes. The white text theme, which uses light +/// glyphs, is used in dark themes and on dark backgrounds in in light themes. /// /// To obtain the current text theme, call [Theme.of] with the current /// [BuildContext] and read the [ThemeData.textTheme] property. @@ -131,9 +130,9 @@ class TextTheme { class Typography { Typography._(); - /// A material design text theme with darkly colored glyphs. + /// A material design text theme with dark glyphs. static const TextTheme black = const TextTheme._black(); - /// A material design text theme with lightly colored glyphs. + /// A material design text theme with light glyphs. static const TextTheme white = const TextTheme._white(); } diff --git a/packages/flutter/test/material/scaffold_test.dart b/packages/flutter/test/material/scaffold_test.dart index 6708ece686..76a8118330 100644 --- a/packages/flutter/test/material/scaffold_test.dart +++ b/packages/flutter/test/material/scaffold_test.dart @@ -35,7 +35,7 @@ void main() { child: new Scaffold( appBar: new AppBar(title: new Text('Title')), body: new Container(key: bodyKey), - resizeToAvoidWindowPadding: false + resizeToAvoidBottomPadding: false ) ));