From 6655074b370d39150d2ed28f67851e3bce7013ab Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Fri, 28 Jul 2017 15:44:38 -0700 Subject: [PATCH] Fix documentation based on dartdoc's warnings (#11428) --- dev/tools/dartdoc.dart | 47 ++++++-- dev/tools/java_and_objc_doc.dart | 15 +-- packages/flutter/lib/foundation.dart | 2 + .../flutter/lib/src/cupertino/colors.dart | 5 +- .../flutter/lib/src/cupertino/nav_bar.dart | 67 ++++++------ .../foundation/tree_diagnostics_mixin.dart | 102 +++++++++--------- .../flutter/lib/src/material/feedback.dart | 10 +- packages/flutter/lib/src/material/tabs.dart | 5 +- packages/flutter/lib/src/painting/colors.dart | 2 +- .../flutter/lib/src/painting/edge_insets.dart | 2 +- .../lib/src/painting/flutter_logo.dart | 11 +- .../flutter/lib/src/painting/text_span.dart | 2 +- .../flutter/lib/src/painting/text_style.dart | 10 +- packages/flutter/lib/src/rendering/box.dart | 2 +- packages/flutter/lib/src/rendering/layer.dart | 4 +- .../flutter/lib/src/rendering/object.dart | 12 +-- .../lib/src/services/image_stream.dart | 2 +- .../flutter/lib/src/widgets/framework.dart | 4 +- .../lib/src/widgets/gesture_detector.dart | 2 +- .../flutter/lib/src/widgets/page_view.dart | 2 +- .../lib/src/widgets/scroll_controller.dart | 8 +- .../lib/src/widgets/scroll_position.dart | 4 +- .../flutter/lib/src/widgets/scroll_view.dart | 12 +-- .../flutter/lib/src/widgets/scrollable.dart | 2 +- .../flutter/test/cupertino/nav_bar_test.dart | 42 ++++++++ .../flutter_driver/lib/flutter_driver.dart | 3 +- .../flutter_driver/lib/src/render_tree.dart | 3 +- 27 files changed, 232 insertions(+), 150 deletions(-) diff --git a/dev/tools/dartdoc.dart b/dev/tools/dartdoc.dart index e50d4493a6..b474f4ad5a 100644 --- a/dev/tools/dartdoc.dart +++ b/dev/tools/dartdoc.dart @@ -10,6 +10,12 @@ import 'package:intl/intl.dart'; import 'package:path/path.dart' as path; import 'update_versions.dart'; +/// Whether to report all error messages (true) or attempt to filter out some +/// known false positives (false). +/// +/// Set this to false locally if you want to address Flutter-specific issues. +const bool kVerbose = true; // please leave this as true on Travis + const String kDocRoot = 'dev/docs/doc'; /// This script expects to run with the cwd as the root of the flutter repo. It @@ -68,8 +74,8 @@ dependencies: 'FLUTTER_ROOT': Directory.current.path, }, ); - printStream(process.stdout); - printStream(process.stderr); + printStream(process.stdout, prefix: 'pub:stdout: '); + printStream(process.stderr, prefix: 'pub:stderr: '); final int code = await process.exitCode; if (code != 0) exit(code); @@ -94,8 +100,12 @@ dependencies: '--favicon=favicon.ico', '--use-categories', '--category-order', 'flutter,Dart Core,flutter_test,flutter_driver', + '--show-warnings', + '--auto-include-dependencies', ]; + // Explicitly list all the packages in //flutter/packages/* that are + // not listed 'nodoc' in their pubspec.yaml. for (String libraryRef in libraryRefs(diskPath: true)) { args.add('--include-external'); args.add(libraryRef); @@ -106,8 +116,18 @@ dependencies: args, workingDirectory: 'dev/docs', ); - printStream(process.stdout); - printStream(process.stderr); + printStream(process.stdout, prefix: 'dartdoc:stdout: ', + filter: kVerbose ? const [] : [ + new RegExp(r'^generating docs for library '), // unnecessary verbosity + new RegExp(r'^pars'), // unnecessary verbosity + ], + ); + printStream(process.stderr, prefix: 'dartdoc:stderr: ', + filter: kVerbose ? const [] : [ + new RegExp(r'^ warning: generic type handled as HTML:'), // https://github.com/dart-lang/dartdoc/issues/1475 + new RegExp(r'^ warning: .+: \(.+/\.pub-cache/hosted/pub.dartlang.org/.+\)'), // packages outside our control + ], + ); final int exitCode = await process.exitCode; if (exitCode != 0) @@ -194,15 +214,17 @@ void copyIndexToRootOfDocs() { void addHtmlBaseToIndex() { final File indexFile = new File('$kDocRoot/index.html'); String indexContents = indexFile.readAsStringSync(); - indexContents = indexContents.replaceFirst('\n', - '\n \n'); + indexContents = indexContents.replaceFirst( + '\n', + '\n \n', + ); indexContents = indexContents.replaceAll( 'href="Android/Android-library.html"', - 'href="https://docs.flutter.io/javadoc/"' + 'href="/javadoc/"', ); indexContents = indexContents.replaceAll( 'href="iOS/iOS-library.html"', - 'href="https://docs.flutter.io/objcdoc/"' + 'href="/objcdoc/"', ); indexFile.writeAsStringSync(indexContents); @@ -257,9 +279,14 @@ Iterable libraryRefs({ bool diskPath: false }) sync* { } } -void printStream(Stream> stream) { +void printStream(Stream> stream, { String prefix: '', List filter: const [] }) { + assert(prefix != null); + assert(filter != null); stream .transform(UTF8.decoder) .transform(const LineSplitter()) - .listen(print); + .listen((String line) { + if (!filter.any((Pattern pattern) => line.contains(pattern))) + print('$prefix$line'.trim()); + }); } diff --git a/dev/tools/java_and_objc_doc.dart b/dev/tools/java_and_objc_doc.dart index f02f9d7e1f..0998678b76 100644 --- a/dev/tools/java_and_objc_doc.dart +++ b/dev/tools/java_and_objc_doc.dart @@ -13,21 +13,16 @@ const String kDocRoot = 'dev/docs/doc'; /// This script downloads an archive of Javadoc and objc doc for the engine from /// the artifact store and extracts them to the location used for Dartdoc. Future main(List args) async { - final String engineVersion = - new File('bin/internal/engine.version').readAsStringSync().trim(); + final String engineVersion = new File('bin/internal/engine.version').readAsStringSync().trim(); - final String javadocUrl = - 'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/android-javadoc.zip'; + final String javadocUrl = 'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/android-javadoc.zip'; generateDocs(javadocUrl, 'javadoc', 'io/flutter/view/FlutterView.html'); - final String objcdocUrl = - 'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/ios-objcdoc.zip'; - generateDocs( - objcdocUrl, 'objcdoc', 'Classes/FlutterViewController.html'); + final String objcdocUrl = 'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/ios-objcdoc.zip'; + generateDocs(objcdocUrl, 'objcdoc', 'Classes/FlutterViewController.html'); } -Future generateDocs( - final String url, String docName, String checkFile) async { +Future generateDocs(String url, String docName, String checkFile) async { final http.Response response = await http.get(url); final Archive archive = new ZipDecoder().decodeBytes(response.bodyBytes); diff --git a/packages/flutter/lib/foundation.dart b/packages/flutter/lib/foundation.dart index 738b375b6d..05ac8f4d40 100644 --- a/packages/flutter/lib/foundation.dart +++ b/packages/flutter/lib/foundation.dart @@ -23,6 +23,8 @@ export 'package:meta/meta.dart' show // bool _lights; // bool _visible; // bool inherit; +// int columns; +// int rows; // class Cat { } // double _volume; // dynamic _calculation; diff --git a/packages/flutter/lib/src/cupertino/colors.dart b/packages/flutter/lib/src/cupertino/colors.dart index 8765b3e6ee..62dc7b2813 100644 --- a/packages/flutter/lib/src/cupertino/colors.dart +++ b/packages/flutter/lib/src/cupertino/colors.dart @@ -22,7 +22,7 @@ class CupertinoColors { /// /// See also: /// - /// * [Colors.white], the same color, in the material design palette. + /// * [material.Colors.white], the same color, in the material design palette. /// * [black], opaque black in the [CupertinoColors] palette. static const Color white = const Color(0xFFFFFFFF); @@ -30,7 +30,8 @@ class CupertinoColors { /// /// See also: /// - /// * [Colors.black], the same color, in the material design palette. + /// * [material.Colors.black], the same color, in the material design palette. + /// * [white], opaque white in the [CupertinoColors] palette. static const Color black = const Color(0xFF000000); /// Used in iOS 10 for light background fills such as the chat bubble background. diff --git a/packages/flutter/lib/src/cupertino/nav_bar.dart b/packages/flutter/lib/src/cupertino/nav_bar.dart index fe9bd9b9ef..cfc59c5819 100644 --- a/packages/flutter/lib/src/cupertino/nav_bar.dart +++ b/packages/flutter/lib/src/cupertino/nav_bar.dart @@ -41,7 +41,7 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid this.trailing, this.backgroundColor: _kDefaultNavBarBackgroundColor, this.actionsForegroundColor: CupertinoColors.activeBlue, - }) : assert(middle != null, 'There must be a middle widget, usually a title'), + }) : assert(middle != null, 'There must be a middle widget, usually a title.'), super(key: key); /// Widget to place at the start of the nav bar. Normally a back button @@ -66,7 +66,8 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid /// Default color used for text and icons of the [leading] and [trailing] /// widgets in the nav bar. /// - /// The [title] remains black if it's a text as per iOS standard design. + /// The default color for text in the [middle] slot is always black, as per + /// iOS standard design. final Color actionsForegroundColor; /// True if the nav bar's background color has no transparency. @@ -77,15 +78,28 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid @override Widget build(BuildContext context) { - Widget styledMiddle = middle; - if (styledMiddle.runtimeType == Text || styledMiddle.runtimeType == DefaultTextStyle) { - // Let the middle be black rather than `actionsForegroundColor` in case - // it's a plain text title. - styledMiddle = DefaultTextStyle.merge( - style: const TextStyle(color: CupertinoColors.black), - child: middle, - ); - } + final TextStyle actionsStyle = new TextStyle( + fontSize: 17.0, + letterSpacing: -0.24, + color: actionsForegroundColor, + ); + + final Widget styledLeading = leading == null ? null : DefaultTextStyle.merge( + style: actionsStyle, + child: leading, + ); + + final Widget styledTrailing = trailing == null ? null : DefaultTextStyle.merge( + style: actionsStyle, + child: trailing, + ); + + // Let the middle be black rather than `actionsForegroundColor` in case + // it's a plain text title. + final Widget styledMiddle = middle == null ? null : DefaultTextStyle.merge( + style: actionsStyle.copyWith(color: CupertinoColors.black), + child: middle, + ); // TODO(xster): automatically build a CupertinoBackButton. @@ -107,26 +121,19 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid color: actionsForegroundColor, size: 22.0, ), - child: DefaultTextStyle.merge( - style: new TextStyle( - fontSize: 17.0, - letterSpacing: -0.24, - color: actionsForegroundColor, + child: new Padding( + padding: new EdgeInsets.only( + top: MediaQuery.of(context).padding.top, + // TODO(xster): dynamically reduce padding when an automatic + // CupertinoBackButton is present. + left: 16.0, + right: 16.0, ), - child: new Padding( - padding: new EdgeInsets.only( - top: MediaQuery.of(context).padding.top, - // TODO(xster): dynamically reduce padding when an automatic - // CupertinoBackButton is present. - left: 16.0, - right: 16.0, - ), - child: new NavigationToolbar( - leading: leading, - middle: styledMiddle, - trailing: trailing, - centerMiddle: true, - ), + child: new NavigationToolbar( + leading: styledLeading, + middle: styledMiddle, + trailing: styledTrailing, + centerMiddle: true, ), ), ), diff --git a/packages/flutter/lib/src/foundation/tree_diagnostics_mixin.dart b/packages/flutter/lib/src/foundation/tree_diagnostics_mixin.dart index 42f759255e..b2d3062b1b 100644 --- a/packages/flutter/lib/src/foundation/tree_diagnostics_mixin.dart +++ b/packages/flutter/lib/src/foundation/tree_diagnostics_mixin.dart @@ -569,12 +569,12 @@ class _NoDefaultValue { const _NoDefaultValue(); } -/// Marker object indicating that a DiagnosticNode has no default value. +/// Marker object indicating that a [DiagnosticsNode] has no default value. const _NoDefaultValue kNoDefaultValue = const _NoDefaultValue(); /// Defines diagnostics data for a [value]. /// -/// DiagnosticsNode provides a high quality multi-line string dump via +/// [DiagnosticsNode] provides a high quality multi-line string dump via /// [toStringDeep]. The core members are the [name], [description], [getProperties], /// [value], and [getChildren]. All other members exist typically to provide /// hints for how [toStringDeep] and debugging tools should format output. @@ -629,7 +629,7 @@ abstract class DiagnosticsNode { /// /// See also: /// - /// * [PropertyMessage], which should be used if the message should be + /// * [MessageProperty], which is better suited to messages that are to be /// formatted like a property with a separate name and message. factory DiagnosticsNode.message( String message, { @@ -645,7 +645,10 @@ abstract class DiagnosticsNode { ); } - /// Label describing the Diagnostics node. + /// Label describing the [DiagnosticsNode], typically shown before a separator + /// (see [showSeparator]). + /// + /// The name will be omitted if the [showName] property is false. final String name; /// Description with a short summary of the node itself not including children @@ -678,13 +681,13 @@ abstract class DiagnosticsNode { /// Hint for how the node should be displayed. final DiagnosticsTreeStyle style; - /// Properties of this DiagnosticsNode. + /// Properties of this [DiagnosticsNode]. /// /// Properties and children are kept distinct even though they are both - /// [List] because they should be grouped differently. + /// [List] because they should be grouped differently. List getProperties(); - /// Children of this DiagnosticsNode. + /// Children of this [DiagnosticsNode]. /// /// See also: /// @@ -885,30 +888,32 @@ abstract class DiagnosticsNode { /// Debugging message displayed like a property. /// -/// The following two properties should be a [MessageProperty], not -/// [StringProperty], as the intent is to show a message with property style -/// display rather than to describe the value of an actual property of the -/// object. +/// ## Sample code +/// +/// The following two properties are better expressed using this +/// [MessageProperty] class, rather than [StringProperty], as the intent is to +/// show a message with property style display rather than to describe the value +/// of an actual property of the object: /// /// ```dart -/// new MessageProperty('table size', '$columns\u00D7$rows')); -/// new MessageProperty('usefulness ratio', 'no metrics collected yet (never painted)'); +/// new MessageProperty('table size', '$columns\u00D7$rows') +/// ``` +/// ```dart +/// new MessageProperty('usefulness ratio', 'no metrics collected yet (never painted)') /// ``` /// -/// StringProperty should be used if the property has a concrete value that is -/// a string. +/// On the other hand, [StringProperty] is better suited when the property has a +/// concrete value that is a string: /// /// ```dart -/// new StringProperty('fontFamily', fontFamily); -/// new StringProperty('title', title): +/// new StringProperty('name', _name) /// ``` /// /// See also: /// -/// * [DiagnosticsProperty.message], which serves the same role for messages +/// * [DiagnosticsNode.message], which serves the same role for messages /// without a clear property name. -/// * [StringProperty], which should be used instead for properties with string -/// values. +/// * [StringProperty], which is a better fit for properties with string values. class MessageProperty extends DiagnosticsProperty { /// Create a diagnostics property that displays a message. /// @@ -926,7 +931,7 @@ class MessageProperty extends DiagnosticsProperty { /// /// See also: /// -/// * [MessageProperty], which should be used instead if showing a message +/// * [MessageProperty], which is a better fit for showing a message /// instead of describing a property with a string value. class StringProperty extends DiagnosticsProperty { /// Create a diagnostics property for strings. @@ -1025,11 +1030,11 @@ abstract class _NumProperty extends DiagnosticsProperty { return unit != null ? '${numberToString()}$unit' : numberToString(); } } -/// Property describing a [double] [value] with an option [unit] of measurement. +/// Property describing a [double] [value] with an optional [unit] of measurement. /// /// Numeric formatting is optimized for debug message readability. class DoubleProperty extends _NumProperty { - /// If specified, `unit` describes the unit for the [value] (e.g. px). + /// If specified, [unit] describes the unit for the [value] (e.g. px). DoubleProperty(String name, double value, { bool hidden: false, String ifNull, @@ -1782,31 +1787,30 @@ String camelCaseToHyphenatedName(String word) { return buffer.toString(); } -/// An interface providing string and [DiagnosticNode] debug representations. +/// An interface providing string and [DiagnosticsNode] debug representations. /// /// The string debug representation is generated from the intermediate -/// [DiagnosticNode] representation. The [DiagnosticNode] representation is +/// [DiagnosticsNode] representation. The [DiagnosticsNode] representation is /// also used by debugging tools displaying interactive trees of objects and /// properties. /// /// See also: /// -/// * [TreeDiagnosticsMixin], which should be used to implement this interface -/// in all contexts where a mixin can be used. -/// * [TreeDiagnosticsMixin.debugFillProperties], which lists best practices -/// for specifying the properties of a [DiagnosticNode]. The most common use -/// case is to override [debugFillProperties] defining custom properties for -/// a subclass of [TreeDiagnosticsMixin] using the existing +/// * [TreeDiagnosticsMixin], which provides convenience members for implementing +/// this interface in a consistent way. +/// * The documentation for [TreeDiagnosticsMixin.debugFillProperties], which +/// lists best practices for specifying the properties of a +/// [DiagnosticsNode]. The most common use case is to override +/// [TreeDiagnosticsMixin.debugFillProperties] to define custom properties +/// for a subclass of [TreeDiagnosticsMixin] using the existing /// [DiagnosticsProperty] subclasses. -/// * [TreeDiagnosticsMixin.debugDescribeChildren], which lists best practices -/// for describing the children of a [DiagnosticNode]. Typically the base -/// class already describes the children of a node properly or a node has -/// no children. -/// * [DiagnosticsProperty], which should be used to create leaf diagnostic -/// nodes without properties or children. There are many [DiagnosticProperty] -/// subclasses to handle common use cases. -/// * [DiagnosticsNode.lazy], which should be used to create a DiagnosticNode -/// with children and properties where [TreeDiagnosticsMixin] cannot be used. +/// * The documentation for [TreeDiagnosticsMixin.debugDescribeChildren], which +/// lists best practices for describing the children of a [DiagnosticsNode]. +/// Typically the base class already describes the children of a node +/// properly or a node has no children. +/// * [DiagnosticsProperty], which describes leaf diagnostic nodes without +/// properties or children. There are many [DiagnosticsProperty] subclasses +/// to handle common use cases such as strings and doubles. abstract class TreeDiagnostics { /// Abstract const constructor. This constructor enables subclasses to provide /// const constructors so that they can be used in const expressions. @@ -1907,10 +1911,10 @@ abstract class TreeDiagnosticsMixin implements TreeDiagnostics { /// /// Use the most specific [DiagnosticsProperty] existing subclass to describe /// each property instead of the [DiagnosticsProperty] base class. There are - /// only a small number of [DiagnosticProperty] subclasses each covering a + /// only a small number of [DiagnosticsProperty] subclasses each covering a /// common use case. Consider what values a property is relevant for users /// debugging as users debugging large trees are overloaded with information. - /// Common named parameters in [DiagnosticNode] subclasses help filter when + /// Common named parameters in [DiagnosticsNode] subclasses help filter when /// and how properties are displayed. /// /// `defaultValue`, `showName`, `showSeparator`, and `hidden` keep string @@ -1941,7 +1945,7 @@ abstract class TreeDiagnosticsMixin implements TreeDiagnostics { /// descriptions clearer. The examples in the code sample below illustrate /// good uses of all of these parameters. /// - /// ## DiagnosticProperty subclasses for primitive types + /// ## DiagnosticsProperty subclasses for primitive types /// /// * [StringProperty], which supports automatically enclosing a [String] /// value in quotes. @@ -1953,33 +1957,31 @@ abstract class TreeDiagnosticsMixin implements TreeDiagnostics { /// [int] value. /// * [FlagProperty], which formats a [bool] value as one or more flags. /// Depending on the use case it is better to format a bool as - /// `DiagnosticProperty` instead of using [FlagProperty] as the + /// `DiagnosticsProperty` instead of using [FlagProperty] as the /// output is more verbose but unambiguous. /// - /// ## Other important [DiagnosticProperty] subclasses + /// ## Other important [DiagnosticsProperty] variants /// /// * [EnumProperty], which provides terse descriptions of enum values /// working around limitations of the `toString` implementation for Dart /// enum types. /// * [IterableProperty], which handles iterable values with display /// customizable depending on the [DiagnosticsTreeStyle] used. - /// * [LazyDiagnosticsProperty], which handles properties where computing the - /// value could throw an exception. /// * [ObjectFlagProperty], which provides terse descriptions of whether a /// property value is present or not. For example, whether an `onClick` /// callback is specified or an animation is in progress. /// - /// If none of these subclasses apply, use the [DiagnosticProperty] + /// If none of these subclasses apply, use the [DiagnosticsProperty] /// constructor or in rare cases create your own [DiagnosticsProperty] /// subclass as in the case for [TransformProperty] which handles [Matrix4] /// that represent transforms. Generally any property value with a good - /// `toString` method implementation works fine using [DiagnosticProperty] + /// `toString` method implementation works fine using [DiagnosticsProperty] /// directly. /// /// ## Sample code /// /// This example shows best practices for implementing [debugFillProperties] - /// illustrating use of all common [DiagnosticProperty] subclasses and all + /// illustrating use of all common [DiagnosticsProperty] subclasses and all /// common [DiagnosticsProperty] parameters. /// /// ```dart diff --git a/packages/flutter/lib/src/material/feedback.dart b/packages/flutter/lib/src/material/feedback.dart index 84994e85c3..dd9ad63387 100644 --- a/packages/flutter/lib/src/material/feedback.dart +++ b/packages/flutter/lib/src/material/feedback.dart @@ -15,14 +15,16 @@ import 'theme.dart'; /// For example, to play the Android-typically click sound when a button is /// tapped, call [forTap]. For the Android-specific vibration when long pressing /// an element, call [forLongPress]. Alternatively, you can also wrap your -/// [onTap] or [onLongPress] callback in [wrapForTap] or [wrapForLongPress] to -/// achieve the same (see example code below). +/// [GestureDetector.onTap] or [GestureDetector.onLongPress] callback in +/// [wrapForTap] or [wrapForLongPress] to achieve the same (see example code +/// below). /// /// Calling any of these methods is a no-op on iOS as actions on that platform /// typically don't provide haptic or acoustic feedback. /// -/// All methods in this class are usually called from within a [build] method -/// or from a State's methods as you have to provide a [BuildContext]. +/// All methods in this class are usually called from within a +/// [StatelessWidget.build] method or from a [State]'s methods as you have to +/// provide a [BuildContext]. /// /// ## Sample code /// diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 871401109c..fda34f35f6 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -458,10 +458,13 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget { final double indicatorWeight; /// The horizontal padding for the line that appears below the selected tab. - /// For [isScrollable] tab bars, specifying [kDefaultTabLabelPadding] will align + /// For [isScrollable] tab bars, specifying [kTabLabelPadding] will align /// the indicator with the tab's text for [Tab] widgets and all but the /// shortest [Tab.text] values. /// + /// The [EdgeInsets.top] and [EdgeInsets.bottom] values of the + /// [indicatorPadding] are ignored. + /// /// The default value of [indicatorPadding] is [EdgeInsets.zero]. final EdgeInsets indicatorPadding; diff --git a/packages/flutter/lib/src/painting/colors.dart b/packages/flutter/lib/src/painting/colors.dart index be9748dc41..484ba90bb6 100644 --- a/packages/flutter/lib/src/painting/colors.dart +++ b/packages/flutter/lib/src/painting/colors.dart @@ -181,7 +181,7 @@ class HSVColor { /// /// * [MaterialColor] and [MaterialAccentColor], which define material design /// primary and accent color swatches. -/// * [Colors], which defines all of the standard material design colors. +/// * [material.Colors], which defines all of the standard material design colors. class ColorSwatch extends Color { /// Creates a color that has a small table of related colors called a "swatch". const ColorSwatch(int primary, this._swatch) : super(primary); diff --git a/packages/flutter/lib/src/painting/edge_insets.dart b/packages/flutter/lib/src/painting/edge_insets.dart index b6b013bd60..c7521cd29d 100644 --- a/packages/flutter/lib/src/painting/edge_insets.dart +++ b/packages/flutter/lib/src/painting/edge_insets.dart @@ -97,7 +97,7 @@ class EdgeInsets { /// /// If you need the current system padding in the context of a widget, /// consider using [MediaQuery.of] to obtain the current padding rather than - /// using the value from [ui.window], so that you get notified when it + /// using the value from [dart:ui.window], so that you get notified when it /// changes. EdgeInsets.fromWindowPadding(ui.WindowPadding padding, double devicePixelRatio) : left = padding.left / devicePixelRatio, diff --git a/packages/flutter/lib/src/painting/flutter_logo.dart b/packages/flutter/lib/src/painting/flutter_logo.dart index 76f6c07d6c..fa712d411c 100644 --- a/packages/flutter/lib/src/painting/flutter_logo.dart +++ b/packages/flutter/lib/src/painting/flutter_logo.dart @@ -56,15 +56,16 @@ class FlutterLogoDecoration extends Decoration { /// The lighter of the two colors used to paint the logo. /// /// If possible, the default should be used. It corresponds to the 400 and 900 - /// values of [Colors.blue] from the Material library. + /// values of [material.Colors.blue] from the Material library. /// /// If for some reason that color scheme is impractical, the same entries from - /// [Colors.amber], [Colors.red], or [Colors.indigo] colors can be used. These - /// are Flutter's secondary colors. + /// [material.Colors.amber], [material.Colors.red], or + /// [material.Colors.indigo] colors can be used. These are Flutter's secondary + /// colors. /// /// In extreme cases where none of those four color schemes will work, - /// [Colors.pink], [Colors.purple], or [Colors.cyan] can be used. - /// These are Flutter's tertiary colors. + /// [material.Colors.pink], [material.Colors.purple], or + /// [material.Colors.cyan] can be used. These are Flutter's tertiary colors. final Color lightColor; /// The darker of the two colors used to paint the logo. diff --git a/packages/flutter/lib/src/painting/text_span.dart b/packages/flutter/lib/src/painting/text_span.dart index f0121522c6..953837d1b6 100644 --- a/packages/flutter/lib/src/painting/text_span.dart +++ b/packages/flutter/lib/src/painting/text_span.dart @@ -96,7 +96,7 @@ class TextSpan implements TreeDiagnostics { /// ## Sample code /// /// This example shows how to manage the lifetime of a gesture recognizer - /// provided to a [TextSpan] object. It defines a [BuzzingText] widget which + /// provided to a [TextSpan] object. It defines a `BuzzingText` widget which /// uses the [HapticFeedback] class to vibrate the device when the user /// long-presses the "find the" span, which is underlined in wavy green. The /// hit-testing is handled by the [RichText] widget. diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index c12401f0f4..6a3830b5aa 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -40,11 +40,11 @@ import 'basic_types.dart'; /// ### Opacity /// /// Each line here is progressively more opaque. The base color is -/// [Colors.black], and [Color.withOpacity] is used to create a derivative color -/// with the desired opacity. The root [TextSpan] for this [RichText] widget is -/// explicitly given the ambient [DefaultTextStyle], since [RichText] does not -/// do that automatically. The inner [TextStyle] objects are implicitly mixed -/// with the parent [TextSpan]'s [TextSpan.style]. +/// [material.Colors.black], and [Color.withOpacity] is used to create a +/// derivative color with the desired opacity. The root [TextSpan] for this +/// [RichText] widget is explicitly given the ambient [DefaultTextStyle], since +/// [RichText] does not do that automatically. The inner [TextStyle] objects are +/// implicitly mixed with the parent [TextSpan]'s [TextSpan.style]. /// /// ```dart /// new RichText( diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index d023f2b91d..e43570981d 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -836,7 +836,7 @@ class _IntrinsicDimensionsCacheEntry { /// * Implement the [visitChildren] method such that it calls its argument for /// each child, typically in paint order (back-most to front-most). /// -/// * Implement [debugDescribeChildren] such that it outputs a [DiagnosticNode] +/// * Implement [debugDescribeChildren] such that it outputs a [DiagnosticsNode] /// for each child. /// /// Implementing these seven bullet points is essentially all that the two diff --git a/packages/flutter/lib/src/rendering/layer.dart b/packages/flutter/lib/src/rendering/layer.dart index 4ca295c469..da73d486e3 100644 --- a/packages/flutter/lib/src/rendering/layer.dart +++ b/packages/flutter/lib/src/rendering/layer.dart @@ -122,7 +122,7 @@ class PictureLayer extends Layer { /// The bounds that were used for the canvas that drew this layer's [picture]. /// /// This is purely advisory. It is included in the information dumped with - /// [dumpLayerTree] (which can be triggered by pressing "L" when using + /// [debugDumpLayerTree] (which can be triggered by pressing "L" when using /// "flutter run" at the console), which can help debug why certain drawing /// commands are being culled. final Rect canvasBounds; @@ -866,7 +866,7 @@ class LeaderLayer extends ContainerLayer { /// /// If any of the ancestors of this layer have a degenerate matrix (e.g. scaling /// by zero), then the [FollowerLayer] will not be able to transform its child -/// to the coordinate space of the [Leader]. +/// to the coordinate space of the [LeaderLayer]. /// /// A [linkedOffset] property can be provided to further offset the child layer /// from the leader layer, for example if the child is to follow the linked diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index c650e31155..96235f1592 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -72,12 +72,12 @@ class PaintingContext { /// A render object provided with this [PaintingContext] (e.g. in its /// [RenderObject.paint] method) is permitted to paint outside the region that /// the render object occupies during layout, but is not permitted to paint - /// outside these paints bounds. These paint bounds are used to construct - /// memory-efficient composited layers, which means attempting to paint - /// outside these bounds can attempt to write to pixels that do not exist in - /// the composited layer. + /// outside these canvas paints bounds. These paint bounds are used to + /// construct memory-efficient composited layers, which means attempting to + /// paint outside these bounds can attempt to write to pixels that do not + /// exist in the composited layer. /// - /// The [paintBounds] rectangle is in the [canvas] coordinate system. + /// The [canvasBounds] rectangle is in the [canvas] coordinate system. final Rect canvasBounds; /// Repaint the given render object. @@ -1180,7 +1180,7 @@ class PipelineOwner { /// update. /// /// Initially, only the root node, as scheduled by - /// [RenderObjectscheduleInitialSemantics], needs a semantics update. + /// [RenderObject.scheduleInitialSemantics], needs a semantics update. /// /// This function is one of the core stages of the rendering pipeline. The /// semantics are compiled after painting and only after diff --git a/packages/flutter/lib/src/services/image_stream.dart b/packages/flutter/lib/src/services/image_stream.dart index 54a9f937f6..3e9124cc2b 100644 --- a/packages/flutter/lib/src/services/image_stream.dart +++ b/packages/flutter/lib/src/services/image_stream.dart @@ -177,7 +177,7 @@ class ImageStreamCompleter { /// object is available. If a concrete image is already available, this object /// will call the listener synchronously. /// - /// If the assigned [completer] completes multiple images over its lifetime, + /// If the [ImageStreamCompleter] completes multiple images over its lifetime, /// this listener will fire multiple times. /// /// The listener will be passed a flag indicating whether a synchronous call diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 9af52db380..e5bc2b526c 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -1378,7 +1378,7 @@ abstract class State { } /// Add additional properties to the given description used by - /// [toDiagnosticNode], [toString] and [toStringDeep]. + /// [toDiagnosticsNode], [toString] and [toStringDeep]. /// /// This method makes it easier for subclasses to coordinate to provide /// high-quality diagnostic data. The [toString] implementation on @@ -3305,7 +3305,7 @@ abstract class Element implements BuildContext, TreeDiagnostics { } /// Add additional properties to the given description used by - /// [toDiagnosticNode], [toString] and [toStringDeep]. + /// [toDiagnosticsNode], [toString] and [toStringDeep]. /// /// This method makes it easier for subclasses to coordinate to provide /// high-quality diagnostic data. The [toString] implementation on diff --git a/packages/flutter/lib/src/widgets/gesture_detector.dart b/packages/flutter/lib/src/widgets/gesture_detector.dart index cdab68e7ea..18c34fd9a3 100644 --- a/packages/flutter/lib/src/widgets/gesture_detector.dart +++ b/packages/flutter/lib/src/widgets/gesture_detector.dart @@ -439,7 +439,7 @@ class GestureDetector extends StatelessWidget { /// See also: /// /// * [GestureDetector], a less flexible but much simpler widget that does the same thing. -/// * [PointerListener], a widget that reports raw pointer events. +/// * [Listener], a widget that reports raw pointer events. /// * [GestureRecognizer], the class that you extend to create a custom gesture recognizer. class RawGestureDetector extends StatefulWidget { /// Creates a widget that detects gestures. diff --git a/packages/flutter/lib/src/widgets/page_view.dart b/packages/flutter/lib/src/widgets/page_view.dart index fd6f2647f2..3b9f8e2f8b 100644 --- a/packages/flutter/lib/src/widgets/page_view.dart +++ b/packages/flutter/lib/src/widgets/page_view.dart @@ -329,7 +329,7 @@ const PageScrollPhysics _kPagePhysics = const PageScrollPhysics(); /// * [SingleChildScrollView], when you need to make a single child scrollable. /// * [ListView], for a scrollable list of boxes. /// * [GridView], for a scrollable grid of boxes. -/// * [ScollNotification] and [NotificationListener], which can be used to watch +/// * [ScrollNotification] and [NotificationListener], which can be used to watch /// the scroll position without using a [ScrollController]. class PageView extends StatefulWidget { /// Creates a scrollable list that works page by page from an explicit [List] diff --git a/packages/flutter/lib/src/widgets/scroll_controller.dart b/packages/flutter/lib/src/widgets/scroll_controller.dart index 12431eb648..b4b078910b 100644 --- a/packages/flutter/lib/src/widgets/scroll_controller.dart +++ b/packages/flutter/lib/src/widgets/scroll_controller.dart @@ -40,7 +40,7 @@ import 'scroll_position_with_single_context.dart'; /// [PageView]. /// * [ScrollPosition], which manages the scroll offset for an individual /// scrolling widget. -/// * [ScollNotification] and [NotificationListener], which can be used to watch +/// * [ScrollNotification] and [NotificationListener], which can be used to watch /// the scroll position without using a [ScrollController]. class ScrollController extends ChangeNotifier { /// Creates a controller for a scrollable widget. @@ -285,9 +285,9 @@ class ScrollController extends ChangeNotifier { /// ## Sample code /// /// In this example each [PageView] page contains a [ListView] and all three -/// [ListView]'s share a [TrackingController]. The scroll offsets of all three -/// list views will track each other, to the extent that's possible given the -/// different list lengths. +/// [ListView]'s share a [TrackingScrollController]. The scroll offsets of all +/// three list views will track each other, to the extent that's possible given +/// the different list lengths. /// /// ```dart /// new PageView( diff --git a/packages/flutter/lib/src/widgets/scroll_position.dart b/packages/flutter/lib/src/widgets/scroll_position.dart index 83b13835e1..20411842cf 100644 --- a/packages/flutter/lib/src/widgets/scroll_position.dart +++ b/packages/flutter/lib/src/widgets/scroll_position.dart @@ -58,7 +58,7 @@ export 'scroll_activity.dart' show ScrollHoldController; /// other scrollable widgets to control a [ScrollPosition]. /// * [ScrollPositionWithSingleContext], which is the most commonly used /// concrete subclass of [ScrollPosition]. -/// * [ScollNotification] and [NotificationListener], which can be used to watch +/// * [ScrollNotification] and [NotificationListener], which can be used to watch /// the scroll position without using a [ScrollController]. abstract class ScrollPosition extends ViewportOffset with ScrollMetrics { /// Creates an object that determines which portion of the content is visible @@ -92,7 +92,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics { /// Typically implemented by [ScrollableState]. final ScrollContext context; - /// Save the current scroll [offset] with [PageStorage] and restore it if + /// Save the current scroll offset with [PageStorage] and restore it if /// this scroll position's scrollable is recreated. /// /// See also: diff --git a/packages/flutter/lib/src/widgets/scroll_view.dart b/packages/flutter/lib/src/widgets/scroll_view.dart index a3479e0871..6851d7184c 100644 --- a/packages/flutter/lib/src/widgets/scroll_view.dart +++ b/packages/flutter/lib/src/widgets/scroll_view.dart @@ -42,7 +42,7 @@ import 'viewport.dart'; /// of child widgets. /// * [CustomScrollView], which is a [ScrollView] that creates custom scroll /// effects using slivers. -/// * [ScollNotification] and [NotificationListener], which can be used to watch +/// * [ScrollNotification] and [NotificationListener], which can be used to watch /// the scroll position without using a [ScrollController]. abstract class ScrollView extends StatelessWidget { /// Creates a widget that scrolls. @@ -303,7 +303,7 @@ abstract class ScrollView extends StatelessWidget { /// sliver. /// * [SliverAppBar], which is a sliver that displays a header that can expand /// and float as the scroll view scrolls. -/// * [ScollNotification] and [NotificationListener], which can be used to watch +/// * [ScrollNotification] and [NotificationListener], which can be used to watch /// the scroll position without using a [ScrollController]. class CustomScrollView extends ScrollView { /// Creates a [ScrollView] that creates custom scroll effects using slivers. @@ -438,7 +438,7 @@ abstract class BoxScrollView extends ScrollView { /// ## Transitioning to [CustomScrollView] /// /// A [ListView] is basically a [CustomScrollView] with a single [SliverList] in -/// its [slivers] property. +/// its [CustomScrollView.slivers] property. /// /// If [ListView] is no longer sufficient, for example because the scroll view /// is to have both a list and a grid, or because the list is to be combined @@ -519,7 +519,7 @@ abstract class BoxScrollView extends ScrollView { /// scroll effects using slivers. /// * [ListBody], which arranges its children in a similar manner, but without /// scrolling. -/// * [ScollNotification] and [NotificationListener], which can be used to watch +/// * [ScrollNotification] and [NotificationListener], which can be used to watch /// the scroll position without using a [ScrollController]. class ListView extends BoxScrollView { /// Creates a scrollable, linear array of widgets from an explicit [List]. @@ -708,7 +708,7 @@ class ListView extends BoxScrollView { /// ## Transitioning to [CustomScrollView] /// /// A [GridView] is basically a [CustomScrollView] with a single [SliverGrid] in -/// its [slivers] property. +/// its [CustomScrollView.slivers] property. /// /// If [GridView] is no longer sufficient, for example because the scroll view /// is to have both a grid and a list, or because the grid is to be combined @@ -804,7 +804,7 @@ class ListView extends BoxScrollView { /// a fixed number of tiles in the cross axis. /// * [SliverGridDelegateWithMaxCrossAxisExtent], which creates a layout with /// tiles that have a maximum cross-axis extent. -/// * [ScollNotification] and [NotificationListener], which can be used to watch +/// * [ScrollNotification] and [NotificationListener], which can be used to watch /// the scroll position without using a [ScrollController]. class GridView extends BoxScrollView { /// Creates a scrollable, 2D array of widgets with a custom diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart index 80e0dd1c7a..8261a92dcb 100644 --- a/packages/flutter/lib/src/widgets/scrollable.dart +++ b/packages/flutter/lib/src/widgets/scrollable.dart @@ -67,7 +67,7 @@ typedef Widget ViewportBuilder(BuildContext context, ViewportOffset position); /// effects using slivers. /// * [SingleChildScrollView], which is a scrollable widget that has a single /// child. -/// * [ScollNotification] and [NotificationListener], which can be used to watch +/// * [ScrollNotification] and [NotificationListener], which can be used to watch /// the scroll position without using a [ScrollController]. class Scrollable extends StatefulWidget { /// Creates a widget that scrolls. diff --git a/packages/flutter/test/cupertino/nav_bar_test.dart b/packages/flutter/test/cupertino/nav_bar_test.dart index ff65491610..89d385a720 100644 --- a/packages/flutter/test/cupertino/nav_bar_test.dart +++ b/packages/flutter/test/cupertino/nav_bar_test.dart @@ -6,6 +6,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; +int count = 0; + void main() { testWidgets('Middle still in center with asymmetrical actions', (WidgetTester tester) async { await tester.pumpWidget( @@ -67,4 +69,44 @@ void main() { ); expect(find.byType(BackdropFilter), findsOneWidget); }); + + testWidgets('Verify styles of each slot', (WidgetTester tester) async { + count = 0x000000; + await tester.pumpWidget( + new WidgetsApp( + color: const Color(0xFFFFFFFF), + onGenerateRoute: (RouteSettings settings) { + return new PageRouteBuilder( + settings: settings, + pageBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation) { + return const CupertinoNavigationBar( + leading: const _ExpectStyles(color: const Color(0xFF001122), index: 0x000001), + middle: const _ExpectStyles(color: const Color(0xFF000000), index: 0x000100), + trailing: const _ExpectStyles(color: const Color(0xFF001122), index: 0x010000), + actionsForegroundColor: const Color(0xFF001122), + ); + }, + ); + }, + ), + ); + expect(count, 0x010101); + }); +} + +class _ExpectStyles extends StatelessWidget { + const _ExpectStyles({ this.color, this.index }); + + final Color color; + final int index; + + @override + Widget build(BuildContext context) { + final TextStyle style = DefaultTextStyle.of(context).style; + expect(style.color, color); + expect(style.fontSize, 17.0); + expect(style.letterSpacing, -0.24); + count += index; + return new Container(); + } } \ No newline at end of file diff --git a/packages/flutter_driver/lib/flutter_driver.dart b/packages/flutter_driver/lib/flutter_driver.dart index 69e2593c14..05845fb820 100644 --- a/packages/flutter_driver/lib/flutter_driver.dart +++ b/packages/flutter_driver/lib/flutter_driver.dart @@ -25,8 +25,7 @@ export 'src/error.dart' show LogRecord, flutterDriverLog; export 'src/find.dart' show - SerializableFinder, - GetTextResult; + SerializableFinder; export 'src/health.dart' show Health, HealthStatus; diff --git a/packages/flutter_driver/lib/src/render_tree.dart b/packages/flutter_driver/lib/src/render_tree.dart index 8eda71d119..84cbd2f882 100644 --- a/packages/flutter_driver/lib/src/render_tree.dart +++ b/packages/flutter_driver/lib/src/render_tree.dart @@ -16,7 +16,8 @@ class GetRenderTree extends Command { final String kind = 'get_render_tree'; } -/// A string representation of the render tree, the result of a [GetRenderTree] command. +/// A string representation of the render tree, the result of a +/// [FlutterDriver.getRenderTree] method. class RenderTree extends Result { /// Creates a [RenderTree] object with the given string representation. RenderTree(this.tree);