Commit 6655074b authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Fix documentation based on dartdoc's warnings (#11428)

parent 58a28a29
...@@ -10,6 +10,12 @@ import 'package:intl/intl.dart'; ...@@ -10,6 +10,12 @@ import 'package:intl/intl.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'update_versions.dart'; 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'; const String kDocRoot = 'dev/docs/doc';
/// This script expects to run with the cwd as the root of the flutter repo. It /// This script expects to run with the cwd as the root of the flutter repo. It
...@@ -68,8 +74,8 @@ dependencies: ...@@ -68,8 +74,8 @@ dependencies:
'FLUTTER_ROOT': Directory.current.path, 'FLUTTER_ROOT': Directory.current.path,
}, },
); );
printStream(process.stdout); printStream(process.stdout, prefix: 'pub:stdout: ');
printStream(process.stderr); printStream(process.stderr, prefix: 'pub:stderr: ');
final int code = await process.exitCode; final int code = await process.exitCode;
if (code != 0) if (code != 0)
exit(code); exit(code);
...@@ -94,8 +100,12 @@ dependencies: ...@@ -94,8 +100,12 @@ dependencies:
'--favicon=favicon.ico', '--favicon=favicon.ico',
'--use-categories', '--use-categories',
'--category-order', 'flutter,Dart Core,flutter_test,flutter_driver', '--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)) { for (String libraryRef in libraryRefs(diskPath: true)) {
args.add('--include-external'); args.add('--include-external');
args.add(libraryRef); args.add(libraryRef);
...@@ -106,8 +116,18 @@ dependencies: ...@@ -106,8 +116,18 @@ dependencies:
args, args,
workingDirectory: 'dev/docs', workingDirectory: 'dev/docs',
); );
printStream(process.stdout); printStream(process.stdout, prefix: 'dartdoc:stdout: ',
printStream(process.stderr); filter: kVerbose ? const <Pattern>[] : <Pattern>[
new RegExp(r'^generating docs for library '), // unnecessary verbosity
new RegExp(r'^pars'), // unnecessary verbosity
],
);
printStream(process.stderr, prefix: 'dartdoc:stderr: ',
filter: kVerbose ? const <Pattern>[] : <Pattern>[
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; final int exitCode = await process.exitCode;
if (exitCode != 0) if (exitCode != 0)
...@@ -194,15 +214,17 @@ void copyIndexToRootOfDocs() { ...@@ -194,15 +214,17 @@ void copyIndexToRootOfDocs() {
void addHtmlBaseToIndex() { void addHtmlBaseToIndex() {
final File indexFile = new File('$kDocRoot/index.html'); final File indexFile = new File('$kDocRoot/index.html');
String indexContents = indexFile.readAsStringSync(); String indexContents = indexFile.readAsStringSync();
indexContents = indexContents.replaceFirst('</title>\n', indexContents = indexContents.replaceFirst(
'</title>\n <base href="./flutter/">\n'); '</title>\n',
'</title>\n <base href="./flutter/">\n',
);
indexContents = indexContents.replaceAll( indexContents = indexContents.replaceAll(
'href="Android/Android-library.html"', 'href="Android/Android-library.html"',
'href="https://docs.flutter.io/javadoc/"' 'href="/javadoc/"',
); );
indexContents = indexContents.replaceAll( indexContents = indexContents.replaceAll(
'href="iOS/iOS-library.html"', 'href="iOS/iOS-library.html"',
'href="https://docs.flutter.io/objcdoc/"' 'href="/objcdoc/"',
); );
indexFile.writeAsStringSync(indexContents); indexFile.writeAsStringSync(indexContents);
...@@ -257,9 +279,14 @@ Iterable<String> libraryRefs({ bool diskPath: false }) sync* { ...@@ -257,9 +279,14 @@ Iterable<String> libraryRefs({ bool diskPath: false }) sync* {
} }
} }
void printStream(Stream<List<int>> stream) { void printStream(Stream<List<int>> stream, { String prefix: '', List<Pattern> filter: const <Pattern>[] }) {
assert(prefix != null);
assert(filter != null);
stream stream
.transform(UTF8.decoder) .transform(UTF8.decoder)
.transform(const LineSplitter()) .transform(const LineSplitter())
.listen(print); .listen((String line) {
if (!filter.any((Pattern pattern) => line.contains(pattern)))
print('$prefix$line'.trim());
});
} }
...@@ -13,21 +13,16 @@ const String kDocRoot = 'dev/docs/doc'; ...@@ -13,21 +13,16 @@ const String kDocRoot = 'dev/docs/doc';
/// This script downloads an archive of Javadoc and objc doc for the engine from /// 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. /// the artifact store and extracts them to the location used for Dartdoc.
Future<Null> main(List<String> args) async { Future<Null> main(List<String> args) async {
final String engineVersion = final String engineVersion = new File('bin/internal/engine.version').readAsStringSync().trim();
new File('bin/internal/engine.version').readAsStringSync().trim();
final String javadocUrl = final String javadocUrl = 'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/android-javadoc.zip';
'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/android-javadoc.zip';
generateDocs(javadocUrl, 'javadoc', 'io/flutter/view/FlutterView.html'); generateDocs(javadocUrl, 'javadoc', 'io/flutter/view/FlutterView.html');
final String objcdocUrl = final String objcdocUrl = 'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/ios-objcdoc.zip';
'https://storage.googleapis.com/flutter_infra/flutter/$engineVersion/ios-objcdoc.zip'; generateDocs(objcdocUrl, 'objcdoc', 'Classes/FlutterViewController.html');
generateDocs(
objcdocUrl, 'objcdoc', 'Classes/FlutterViewController.html');
} }
Future<Null> generateDocs( Future<Null> generateDocs(String url, String docName, String checkFile) async {
final String url, String docName, String checkFile) async {
final http.Response response = await http.get(url); final http.Response response = await http.get(url);
final Archive archive = new ZipDecoder().decodeBytes(response.bodyBytes); final Archive archive = new ZipDecoder().decodeBytes(response.bodyBytes);
......
...@@ -23,6 +23,8 @@ export 'package:meta/meta.dart' show ...@@ -23,6 +23,8 @@ export 'package:meta/meta.dart' show
// bool _lights; // bool _lights;
// bool _visible; // bool _visible;
// bool inherit; // bool inherit;
// int columns;
// int rows;
// class Cat { } // class Cat { }
// double _volume; // double _volume;
// dynamic _calculation; // dynamic _calculation;
......
...@@ -22,7 +22,7 @@ class CupertinoColors { ...@@ -22,7 +22,7 @@ class CupertinoColors {
/// ///
/// See also: /// 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. /// * [black], opaque black in the [CupertinoColors] palette.
static const Color white = const Color(0xFFFFFFFF); static const Color white = const Color(0xFFFFFFFF);
...@@ -30,7 +30,8 @@ class CupertinoColors { ...@@ -30,7 +30,8 @@ class CupertinoColors {
/// ///
/// See also: /// 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); static const Color black = const Color(0xFF000000);
/// Used in iOS 10 for light background fills such as the chat bubble background. /// Used in iOS 10 for light background fills such as the chat bubble background.
......
...@@ -41,7 +41,7 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid ...@@ -41,7 +41,7 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid
this.trailing, this.trailing,
this.backgroundColor: _kDefaultNavBarBackgroundColor, this.backgroundColor: _kDefaultNavBarBackgroundColor,
this.actionsForegroundColor: CupertinoColors.activeBlue, 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); super(key: key);
/// Widget to place at the start of the nav bar. Normally a back button /// Widget to place at the start of the nav bar. Normally a back button
...@@ -66,7 +66,8 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid ...@@ -66,7 +66,8 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid
/// Default color used for text and icons of the [leading] and [trailing] /// Default color used for text and icons of the [leading] and [trailing]
/// widgets in the nav bar. /// 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; final Color actionsForegroundColor;
/// True if the nav bar's background color has no transparency. /// True if the nav bar's background color has no transparency.
...@@ -77,15 +78,28 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid ...@@ -77,15 +78,28 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget styledMiddle = middle; final TextStyle actionsStyle = new TextStyle(
if (styledMiddle.runtimeType == Text || styledMiddle.runtimeType == DefaultTextStyle) { fontSize: 17.0,
// Let the middle be black rather than `actionsForegroundColor` in case letterSpacing: -0.24,
// it's a plain text title. color: actionsForegroundColor,
styledMiddle = DefaultTextStyle.merge( );
style: const TextStyle(color: CupertinoColors.black),
child: middle, 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. // TODO(xster): automatically build a CupertinoBackButton.
...@@ -107,26 +121,19 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid ...@@ -107,26 +121,19 @@ class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWid
color: actionsForegroundColor, color: actionsForegroundColor,
size: 22.0, size: 22.0,
), ),
child: DefaultTextStyle.merge( child: new Padding(
style: new TextStyle( padding: new EdgeInsets.only(
fontSize: 17.0, top: MediaQuery.of(context).padding.top,
letterSpacing: -0.24, // TODO(xster): dynamically reduce padding when an automatic
color: actionsForegroundColor, // CupertinoBackButton is present.
left: 16.0,
right: 16.0,
), ),
child: new Padding( child: new NavigationToolbar(
padding: new EdgeInsets.only( leading: styledLeading,
top: MediaQuery.of(context).padding.top, middle: styledMiddle,
// TODO(xster): dynamically reduce padding when an automatic trailing: styledTrailing,
// CupertinoBackButton is present. centerMiddle: true,
left: 16.0,
right: 16.0,
),
child: new NavigationToolbar(
leading: leading,
middle: styledMiddle,
trailing: trailing,
centerMiddle: true,
),
), ),
), ),
), ),
......
...@@ -569,12 +569,12 @@ class _NoDefaultValue { ...@@ -569,12 +569,12 @@ class _NoDefaultValue {
const _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(); const _NoDefaultValue kNoDefaultValue = const _NoDefaultValue();
/// Defines diagnostics data for a [value]. /// 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], /// [toStringDeep]. The core members are the [name], [description], [getProperties],
/// [value], and [getChildren]. All other members exist typically to provide /// [value], and [getChildren]. All other members exist typically to provide
/// hints for how [toStringDeep] and debugging tools should format output. /// hints for how [toStringDeep] and debugging tools should format output.
...@@ -629,7 +629,7 @@ abstract class DiagnosticsNode { ...@@ -629,7 +629,7 @@ abstract class DiagnosticsNode {
/// ///
/// See also: /// 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. /// formatted like a property with a separate name and message.
factory DiagnosticsNode.message( factory DiagnosticsNode.message(
String message, { String message, {
...@@ -645,7 +645,10 @@ abstract class DiagnosticsNode { ...@@ -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; final String name;
/// Description with a short summary of the node itself not including children /// Description with a short summary of the node itself not including children
...@@ -678,13 +681,13 @@ abstract class DiagnosticsNode { ...@@ -678,13 +681,13 @@ abstract class DiagnosticsNode {
/// Hint for how the node should be displayed. /// Hint for how the node should be displayed.
final DiagnosticsTreeStyle style; final DiagnosticsTreeStyle style;
/// Properties of this DiagnosticsNode. /// Properties of this [DiagnosticsNode].
/// ///
/// Properties and children are kept distinct even though they are both /// Properties and children are kept distinct even though they are both
/// [List<DiagnosticNode>] because they should be grouped differently. /// [List<DiagnosticsNode>] because they should be grouped differently.
List<DiagnosticsNode> getProperties(); List<DiagnosticsNode> getProperties();
/// Children of this DiagnosticsNode. /// Children of this [DiagnosticsNode].
/// ///
/// See also: /// See also:
/// ///
...@@ -885,30 +888,32 @@ abstract class DiagnosticsNode { ...@@ -885,30 +888,32 @@ abstract class DiagnosticsNode {
/// Debugging message displayed like a property. /// Debugging message displayed like a property.
/// ///
/// The following two properties should be a [MessageProperty], not /// ## Sample code
/// [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 /// The following two properties are better expressed using this
/// object. /// [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 /// ```dart
/// new MessageProperty('table size', '$columns\u00D7$rows')); /// new MessageProperty('table size', '$columns\u00D7$rows')
/// new MessageProperty('usefulness ratio', 'no metrics collected yet (never painted)'); /// ```
/// ```dart
/// new MessageProperty('usefulness ratio', 'no metrics collected yet (never painted)')
/// ``` /// ```
/// ///
/// StringProperty should be used if the property has a concrete value that is /// On the other hand, [StringProperty] is better suited when the property has a
/// a string. /// concrete value that is a string:
/// ///
/// ```dart /// ```dart
/// new StringProperty('fontFamily', fontFamily); /// new StringProperty('name', _name)
/// new StringProperty('title', title):
/// ``` /// ```
/// ///
/// See also: /// 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. /// without a clear property name.
/// * [StringProperty], which should be used instead for properties with string /// * [StringProperty], which is a better fit for properties with string values.
/// values.
class MessageProperty extends DiagnosticsProperty<Null> { class MessageProperty extends DiagnosticsProperty<Null> {
/// Create a diagnostics property that displays a message. /// Create a diagnostics property that displays a message.
/// ///
...@@ -926,7 +931,7 @@ class MessageProperty extends DiagnosticsProperty<Null> { ...@@ -926,7 +931,7 @@ class MessageProperty extends DiagnosticsProperty<Null> {
/// ///
/// See also: /// 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. /// instead of describing a property with a string value.
class StringProperty extends DiagnosticsProperty<String> { class StringProperty extends DiagnosticsProperty<String> {
/// Create a diagnostics property for strings. /// Create a diagnostics property for strings.
...@@ -1025,11 +1030,11 @@ abstract class _NumProperty<T extends num> extends DiagnosticsProperty<T> { ...@@ -1025,11 +1030,11 @@ abstract class _NumProperty<T extends num> extends DiagnosticsProperty<T> {
return unit != null ? '${numberToString()}$unit' : numberToString(); 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. /// Numeric formatting is optimized for debug message readability.
class DoubleProperty extends _NumProperty<double> { class DoubleProperty extends _NumProperty<double> {
/// 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, { DoubleProperty(String name, double value, {
bool hidden: false, bool hidden: false,
String ifNull, String ifNull,
...@@ -1782,31 +1787,30 @@ String camelCaseToHyphenatedName(String word) { ...@@ -1782,31 +1787,30 @@ String camelCaseToHyphenatedName(String word) {
return buffer.toString(); 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 /// 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 /// also used by debugging tools displaying interactive trees of objects and
/// properties. /// properties.
/// ///
/// See also: /// See also:
/// ///
/// * [TreeDiagnosticsMixin], which should be used to implement this interface /// * [TreeDiagnosticsMixin], which provides convenience members for implementing
/// in all contexts where a mixin can be used. /// this interface in a consistent way.
/// * [TreeDiagnosticsMixin.debugFillProperties], which lists best practices /// * The documentation for [TreeDiagnosticsMixin.debugFillProperties], which
/// for specifying the properties of a [DiagnosticNode]. The most common use /// lists best practices for specifying the properties of a
/// case is to override [debugFillProperties] defining custom properties for /// [DiagnosticsNode]. The most common use case is to override
/// a subclass of [TreeDiagnosticsMixin] using the existing /// [TreeDiagnosticsMixin.debugFillProperties] to define custom properties
/// for a subclass of [TreeDiagnosticsMixin] using the existing
/// [DiagnosticsProperty] subclasses. /// [DiagnosticsProperty] subclasses.
/// * [TreeDiagnosticsMixin.debugDescribeChildren], which lists best practices /// * The documentation for [TreeDiagnosticsMixin.debugDescribeChildren], which
/// for describing the children of a [DiagnosticNode]. Typically the base /// lists best practices for describing the children of a [DiagnosticsNode].
/// class already describes the children of a node properly or a node has /// Typically the base class already describes the children of a node
/// no children. /// properly or a node has no children.
/// * [DiagnosticsProperty], which should be used to create leaf diagnostic /// * [DiagnosticsProperty], which describes leaf diagnostic nodes without
/// nodes without properties or children. There are many [DiagnosticProperty] /// properties or children. There are many [DiagnosticsProperty] subclasses
/// subclasses to handle common use cases. /// to handle common use cases such as strings and doubles.
/// * [DiagnosticsNode.lazy], which should be used to create a DiagnosticNode
/// with children and properties where [TreeDiagnosticsMixin] cannot be used.
abstract class TreeDiagnostics { abstract class TreeDiagnostics {
/// Abstract const constructor. This constructor enables subclasses to provide /// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions. /// const constructors so that they can be used in const expressions.
...@@ -1907,10 +1911,10 @@ abstract class TreeDiagnosticsMixin implements TreeDiagnostics { ...@@ -1907,10 +1911,10 @@ abstract class TreeDiagnosticsMixin implements TreeDiagnostics {
/// ///
/// Use the most specific [DiagnosticsProperty] existing subclass to describe /// Use the most specific [DiagnosticsProperty] existing subclass to describe
/// each property instead of the [DiagnosticsProperty] base class. There are /// 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 /// common use case. Consider what values a property is relevant for users
/// debugging as users debugging large trees are overloaded with information. /// 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. /// and how properties are displayed.
/// ///
/// `defaultValue`, `showName`, `showSeparator`, and `hidden` keep string /// `defaultValue`, `showName`, `showSeparator`, and `hidden` keep string
...@@ -1941,7 +1945,7 @@ abstract class TreeDiagnosticsMixin implements TreeDiagnostics { ...@@ -1941,7 +1945,7 @@ abstract class TreeDiagnosticsMixin implements TreeDiagnostics {
/// descriptions clearer. The examples in the code sample below illustrate /// descriptions clearer. The examples in the code sample below illustrate
/// good uses of all of these parameters. /// good uses of all of these parameters.
/// ///
/// ## DiagnosticProperty subclasses for primitive types /// ## DiagnosticsProperty subclasses for primitive types
/// ///
/// * [StringProperty], which supports automatically enclosing a [String] /// * [StringProperty], which supports automatically enclosing a [String]
/// value in quotes. /// value in quotes.
...@@ -1953,33 +1957,31 @@ abstract class TreeDiagnosticsMixin implements TreeDiagnostics { ...@@ -1953,33 +1957,31 @@ abstract class TreeDiagnosticsMixin implements TreeDiagnostics {
/// [int] value. /// [int] value.
/// * [FlagProperty], which formats a [bool] value as one or more flags. /// * [FlagProperty], which formats a [bool] value as one or more flags.
/// Depending on the use case it is better to format a bool as /// Depending on the use case it is better to format a bool as
/// `DiagnosticProperty<bool>` instead of using [FlagProperty] as the /// `DiagnosticsProperty<bool>` instead of using [FlagProperty] as the
/// output is more verbose but unambiguous. /// output is more verbose but unambiguous.
/// ///
/// ## Other important [DiagnosticProperty] subclasses /// ## Other important [DiagnosticsProperty] variants
/// ///
/// * [EnumProperty], which provides terse descriptions of enum values /// * [EnumProperty], which provides terse descriptions of enum values
/// working around limitations of the `toString` implementation for Dart /// working around limitations of the `toString` implementation for Dart
/// enum types. /// enum types.
/// * [IterableProperty], which handles iterable values with display /// * [IterableProperty], which handles iterable values with display
/// customizable depending on the [DiagnosticsTreeStyle] used. /// 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 /// * [ObjectFlagProperty], which provides terse descriptions of whether a
/// property value is present or not. For example, whether an `onClick` /// property value is present or not. For example, whether an `onClick`
/// callback is specified or an animation is in progress. /// 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] /// constructor or in rare cases create your own [DiagnosticsProperty]
/// subclass as in the case for [TransformProperty] which handles [Matrix4] /// subclass as in the case for [TransformProperty] which handles [Matrix4]
/// that represent transforms. Generally any property value with a good /// 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. /// directly.
/// ///
/// ## Sample code /// ## Sample code
/// ///
/// This example shows best practices for implementing [debugFillProperties] /// 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. /// common [DiagnosticsProperty] parameters.
/// ///
/// ```dart /// ```dart
......
...@@ -15,14 +15,16 @@ import 'theme.dart'; ...@@ -15,14 +15,16 @@ import 'theme.dart';
/// For example, to play the Android-typically click sound when a button is /// For example, to play the Android-typically click sound when a button is
/// tapped, call [forTap]. For the Android-specific vibration when long pressing /// tapped, call [forTap]. For the Android-specific vibration when long pressing
/// an element, call [forLongPress]. Alternatively, you can also wrap your /// an element, call [forLongPress]. Alternatively, you can also wrap your
/// [onTap] or [onLongPress] callback in [wrapForTap] or [wrapForLongPress] to /// [GestureDetector.onTap] or [GestureDetector.onLongPress] callback in
/// achieve the same (see example code below). /// [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 /// Calling any of these methods is a no-op on iOS as actions on that platform
/// typically don't provide haptic or acoustic feedback. /// typically don't provide haptic or acoustic feedback.
/// ///
/// All methods in this class are usually called from within a [build] method /// All methods in this class are usually called from within a
/// or from a State's methods as you have to provide a [BuildContext]. /// [StatelessWidget.build] method or from a [State]'s methods as you have to
/// provide a [BuildContext].
/// ///
/// ## Sample code /// ## Sample code
/// ///
......
...@@ -458,10 +458,13 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget { ...@@ -458,10 +458,13 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
final double indicatorWeight; final double indicatorWeight;
/// The horizontal padding for the line that appears below the selected tab. /// 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 /// the indicator with the tab's text for [Tab] widgets and all but the
/// shortest [Tab.text] values. /// shortest [Tab.text] values.
/// ///
/// The [EdgeInsets.top] and [EdgeInsets.bottom] values of the
/// [indicatorPadding] are ignored.
///
/// The default value of [indicatorPadding] is [EdgeInsets.zero]. /// The default value of [indicatorPadding] is [EdgeInsets.zero].
final EdgeInsets indicatorPadding; final EdgeInsets indicatorPadding;
......
...@@ -181,7 +181,7 @@ class HSVColor { ...@@ -181,7 +181,7 @@ class HSVColor {
/// ///
/// * [MaterialColor] and [MaterialAccentColor], which define material design /// * [MaterialColor] and [MaterialAccentColor], which define material design
/// primary and accent color swatches. /// 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<T> extends Color { class ColorSwatch<T> extends Color {
/// Creates a color that has a small table of related colors called a "swatch". /// Creates a color that has a small table of related colors called a "swatch".
const ColorSwatch(int primary, this._swatch) : super(primary); const ColorSwatch(int primary, this._swatch) : super(primary);
......
...@@ -97,7 +97,7 @@ class EdgeInsets { ...@@ -97,7 +97,7 @@ class EdgeInsets {
/// ///
/// If you need the current system padding in the context of a widget, /// If you need the current system padding in the context of a widget,
/// consider using [MediaQuery.of] to obtain the current padding rather than /// 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. /// changes.
EdgeInsets.fromWindowPadding(ui.WindowPadding padding, double devicePixelRatio) EdgeInsets.fromWindowPadding(ui.WindowPadding padding, double devicePixelRatio)
: left = padding.left / devicePixelRatio, : left = padding.left / devicePixelRatio,
......
...@@ -56,15 +56,16 @@ class FlutterLogoDecoration extends Decoration { ...@@ -56,15 +56,16 @@ class FlutterLogoDecoration extends Decoration {
/// The lighter of the two colors used to paint the logo. /// 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 /// 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 /// 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 /// [material.Colors.amber], [material.Colors.red], or
/// are Flutter's secondary colors. /// [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, /// In extreme cases where none of those four color schemes will work,
/// [Colors.pink], [Colors.purple], or [Colors.cyan] can be used. /// [material.Colors.pink], [material.Colors.purple], or
/// These are Flutter's tertiary colors. /// [material.Colors.cyan] can be used. These are Flutter's tertiary colors.
final Color lightColor; final Color lightColor;
/// The darker of the two colors used to paint the logo. /// The darker of the two colors used to paint the logo.
......
...@@ -96,7 +96,7 @@ class TextSpan implements TreeDiagnostics { ...@@ -96,7 +96,7 @@ class TextSpan implements TreeDiagnostics {
/// ## Sample code /// ## Sample code
/// ///
/// This example shows how to manage the lifetime of a gesture recognizer /// 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 /// uses the [HapticFeedback] class to vibrate the device when the user
/// long-presses the "find the" span, which is underlined in wavy green. The /// long-presses the "find the" span, which is underlined in wavy green. The
/// hit-testing is handled by the [RichText] widget. /// hit-testing is handled by the [RichText] widget.
......
...@@ -40,11 +40,11 @@ import 'basic_types.dart'; ...@@ -40,11 +40,11 @@ import 'basic_types.dart';
/// ### Opacity /// ### Opacity
/// ///
/// Each line here is progressively more opaque. The base color is /// Each line here is progressively more opaque. The base color is
/// [Colors.black], and [Color.withOpacity] is used to create a derivative color /// [material.Colors.black], and [Color.withOpacity] is used to create a
/// with the desired opacity. The root [TextSpan] for this [RichText] widget is /// derivative color with the desired opacity. The root [TextSpan] for this
/// explicitly given the ambient [DefaultTextStyle], since [RichText] does not /// [RichText] widget is explicitly given the ambient [DefaultTextStyle], since
/// do that automatically. The inner [TextStyle] objects are implicitly mixed /// [RichText] does not do that automatically. The inner [TextStyle] objects are
/// with the parent [TextSpan]'s [TextSpan.style]. /// implicitly mixed with the parent [TextSpan]'s [TextSpan.style].
/// ///
/// ```dart /// ```dart
/// new RichText( /// new RichText(
......
...@@ -836,7 +836,7 @@ class _IntrinsicDimensionsCacheEntry { ...@@ -836,7 +836,7 @@ class _IntrinsicDimensionsCacheEntry {
/// * Implement the [visitChildren] method such that it calls its argument for /// * Implement the [visitChildren] method such that it calls its argument for
/// each child, typically in paint order (back-most to front-most). /// 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. /// for each child.
/// ///
/// Implementing these seven bullet points is essentially all that the two /// Implementing these seven bullet points is essentially all that the two
......
...@@ -122,7 +122,7 @@ class PictureLayer extends Layer { ...@@ -122,7 +122,7 @@ class PictureLayer extends Layer {
/// The bounds that were used for the canvas that drew this layer's [picture]. /// 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 /// 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 /// "flutter run" at the console), which can help debug why certain drawing
/// commands are being culled. /// commands are being culled.
final Rect canvasBounds; final Rect canvasBounds;
...@@ -866,7 +866,7 @@ class LeaderLayer extends ContainerLayer { ...@@ -866,7 +866,7 @@ class LeaderLayer extends ContainerLayer {
/// ///
/// If any of the ancestors of this layer have a degenerate matrix (e.g. scaling /// 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 /// 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 /// 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 /// from the leader layer, for example if the child is to follow the linked
......
...@@ -72,12 +72,12 @@ class PaintingContext { ...@@ -72,12 +72,12 @@ class PaintingContext {
/// A render object provided with this [PaintingContext] (e.g. in its /// A render object provided with this [PaintingContext] (e.g. in its
/// [RenderObject.paint] method) is permitted to paint outside the region that /// [RenderObject.paint] method) is permitted to paint outside the region that
/// the render object occupies during layout, but is not permitted to paint /// the render object occupies during layout, but is not permitted to paint
/// outside these paints bounds. These paint bounds are used to construct /// outside these canvas paints bounds. These paint bounds are used to
/// memory-efficient composited layers, which means attempting to paint /// construct memory-efficient composited layers, which means attempting to
/// outside these bounds can attempt to write to pixels that do not exist in /// paint outside these bounds can attempt to write to pixels that do not
/// the composited layer. /// 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; final Rect canvasBounds;
/// Repaint the given render object. /// Repaint the given render object.
...@@ -1180,7 +1180,7 @@ class PipelineOwner { ...@@ -1180,7 +1180,7 @@ class PipelineOwner {
/// update. /// update.
/// ///
/// Initially, only the root node, as scheduled by /// 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 /// This function is one of the core stages of the rendering pipeline. The
/// semantics are compiled after painting and only after /// semantics are compiled after painting and only after
......
...@@ -177,7 +177,7 @@ class ImageStreamCompleter { ...@@ -177,7 +177,7 @@ class ImageStreamCompleter {
/// object is available. If a concrete image is already available, this object /// object is available. If a concrete image is already available, this object
/// will call the listener synchronously. /// 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. /// this listener will fire multiple times.
/// ///
/// The listener will be passed a flag indicating whether a synchronous call /// The listener will be passed a flag indicating whether a synchronous call
......
...@@ -1378,7 +1378,7 @@ abstract class State<T extends StatefulWidget> { ...@@ -1378,7 +1378,7 @@ abstract class State<T extends StatefulWidget> {
} }
/// Add additional properties to the given description used by /// 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 /// This method makes it easier for subclasses to coordinate to provide
/// high-quality diagnostic data. The [toString] implementation on /// high-quality diagnostic data. The [toString] implementation on
...@@ -3305,7 +3305,7 @@ abstract class Element implements BuildContext, TreeDiagnostics { ...@@ -3305,7 +3305,7 @@ abstract class Element implements BuildContext, TreeDiagnostics {
} }
/// Add additional properties to the given description used by /// 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 /// This method makes it easier for subclasses to coordinate to provide
/// high-quality diagnostic data. The [toString] implementation on /// high-quality diagnostic data. The [toString] implementation on
......
...@@ -439,7 +439,7 @@ class GestureDetector extends StatelessWidget { ...@@ -439,7 +439,7 @@ class GestureDetector extends StatelessWidget {
/// See also: /// See also:
/// ///
/// * [GestureDetector], a less flexible but much simpler widget that does the same thing. /// * [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. /// * [GestureRecognizer], the class that you extend to create a custom gesture recognizer.
class RawGestureDetector extends StatefulWidget { class RawGestureDetector extends StatefulWidget {
/// Creates a widget that detects gestures. /// Creates a widget that detects gestures.
......
...@@ -329,7 +329,7 @@ const PageScrollPhysics _kPagePhysics = const PageScrollPhysics(); ...@@ -329,7 +329,7 @@ const PageScrollPhysics _kPagePhysics = const PageScrollPhysics();
/// * [SingleChildScrollView], when you need to make a single child scrollable. /// * [SingleChildScrollView], when you need to make a single child scrollable.
/// * [ListView], for a scrollable list of boxes. /// * [ListView], for a scrollable list of boxes.
/// * [GridView], for a scrollable grid 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]. /// the scroll position without using a [ScrollController].
class PageView extends StatefulWidget { class PageView extends StatefulWidget {
/// Creates a scrollable list that works page by page from an explicit [List] /// Creates a scrollable list that works page by page from an explicit [List]
......
...@@ -40,7 +40,7 @@ import 'scroll_position_with_single_context.dart'; ...@@ -40,7 +40,7 @@ import 'scroll_position_with_single_context.dart';
/// [PageView]. /// [PageView].
/// * [ScrollPosition], which manages the scroll offset for an individual /// * [ScrollPosition], which manages the scroll offset for an individual
/// scrolling widget. /// 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]. /// the scroll position without using a [ScrollController].
class ScrollController extends ChangeNotifier { class ScrollController extends ChangeNotifier {
/// Creates a controller for a scrollable widget. /// Creates a controller for a scrollable widget.
...@@ -285,9 +285,9 @@ class ScrollController extends ChangeNotifier { ...@@ -285,9 +285,9 @@ class ScrollController extends ChangeNotifier {
/// ## Sample code /// ## Sample code
/// ///
/// In this example each [PageView] page contains a [ListView] and all three /// In this example each [PageView] page contains a [ListView] and all three
/// [ListView]'s share a [TrackingController]. The scroll offsets of all three /// [ListView]'s share a [TrackingScrollController]. The scroll offsets of all
/// list views will track each other, to the extent that's possible given the /// three list views will track each other, to the extent that's possible given
/// different list lengths. /// the different list lengths.
/// ///
/// ```dart /// ```dart
/// new PageView( /// new PageView(
......
...@@ -58,7 +58,7 @@ export 'scroll_activity.dart' show ScrollHoldController; ...@@ -58,7 +58,7 @@ export 'scroll_activity.dart' show ScrollHoldController;
/// other scrollable widgets to control a [ScrollPosition]. /// other scrollable widgets to control a [ScrollPosition].
/// * [ScrollPositionWithSingleContext], which is the most commonly used /// * [ScrollPositionWithSingleContext], which is the most commonly used
/// concrete subclass of [ScrollPosition]. /// 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]. /// the scroll position without using a [ScrollController].
abstract class ScrollPosition extends ViewportOffset with ScrollMetrics { abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
/// Creates an object that determines which portion of the content is visible /// Creates an object that determines which portion of the content is visible
...@@ -92,7 +92,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics { ...@@ -92,7 +92,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
/// Typically implemented by [ScrollableState]. /// Typically implemented by [ScrollableState].
final ScrollContext context; 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. /// this scroll position's scrollable is recreated.
/// ///
/// See also: /// See also:
......
...@@ -42,7 +42,7 @@ import 'viewport.dart'; ...@@ -42,7 +42,7 @@ import 'viewport.dart';
/// of child widgets. /// of child widgets.
/// * [CustomScrollView], which is a [ScrollView] that creates custom scroll /// * [CustomScrollView], which is a [ScrollView] that creates custom scroll
/// effects using slivers. /// 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]. /// the scroll position without using a [ScrollController].
abstract class ScrollView extends StatelessWidget { abstract class ScrollView extends StatelessWidget {
/// Creates a widget that scrolls. /// Creates a widget that scrolls.
...@@ -303,7 +303,7 @@ abstract class ScrollView extends StatelessWidget { ...@@ -303,7 +303,7 @@ abstract class ScrollView extends StatelessWidget {
/// sliver. /// sliver.
/// * [SliverAppBar], which is a sliver that displays a header that can expand /// * [SliverAppBar], which is a sliver that displays a header that can expand
/// and float as the scroll view scrolls. /// 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]. /// the scroll position without using a [ScrollController].
class CustomScrollView extends ScrollView { class CustomScrollView extends ScrollView {
/// Creates a [ScrollView] that creates custom scroll effects using slivers. /// Creates a [ScrollView] that creates custom scroll effects using slivers.
...@@ -438,7 +438,7 @@ abstract class BoxScrollView extends ScrollView { ...@@ -438,7 +438,7 @@ abstract class BoxScrollView extends ScrollView {
/// ## Transitioning to [CustomScrollView] /// ## Transitioning to [CustomScrollView]
/// ///
/// A [ListView] is basically a [CustomScrollView] with a single [SliverList] in /// 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 /// 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 /// 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 { ...@@ -519,7 +519,7 @@ abstract class BoxScrollView extends ScrollView {
/// scroll effects using slivers. /// scroll effects using slivers.
/// * [ListBody], which arranges its children in a similar manner, but without /// * [ListBody], which arranges its children in a similar manner, but without
/// scrolling. /// 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]. /// the scroll position without using a [ScrollController].
class ListView extends BoxScrollView { class ListView extends BoxScrollView {
/// Creates a scrollable, linear array of widgets from an explicit [List]. /// Creates a scrollable, linear array of widgets from an explicit [List].
...@@ -708,7 +708,7 @@ class ListView extends BoxScrollView { ...@@ -708,7 +708,7 @@ class ListView extends BoxScrollView {
/// ## Transitioning to [CustomScrollView] /// ## Transitioning to [CustomScrollView]
/// ///
/// A [GridView] is basically a [CustomScrollView] with a single [SliverGrid] in /// 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 /// 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 /// 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 { ...@@ -804,7 +804,7 @@ class ListView extends BoxScrollView {
/// a fixed number of tiles in the cross axis. /// a fixed number of tiles in the cross axis.
/// * [SliverGridDelegateWithMaxCrossAxisExtent], which creates a layout with /// * [SliverGridDelegateWithMaxCrossAxisExtent], which creates a layout with
/// tiles that have a maximum cross-axis extent. /// 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]. /// the scroll position without using a [ScrollController].
class GridView extends BoxScrollView { class GridView extends BoxScrollView {
/// Creates a scrollable, 2D array of widgets with a custom /// Creates a scrollable, 2D array of widgets with a custom
......
...@@ -67,7 +67,7 @@ typedef Widget ViewportBuilder(BuildContext context, ViewportOffset position); ...@@ -67,7 +67,7 @@ typedef Widget ViewportBuilder(BuildContext context, ViewportOffset position);
/// effects using slivers. /// effects using slivers.
/// * [SingleChildScrollView], which is a scrollable widget that has a single /// * [SingleChildScrollView], which is a scrollable widget that has a single
/// child. /// 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]. /// the scroll position without using a [ScrollController].
class Scrollable extends StatefulWidget { class Scrollable extends StatefulWidget {
/// Creates a widget that scrolls. /// Creates a widget that scrolls.
......
...@@ -6,6 +6,8 @@ import 'package:flutter/cupertino.dart'; ...@@ -6,6 +6,8 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
int count = 0;
void main() { void main() {
testWidgets('Middle still in center with asymmetrical actions', (WidgetTester tester) async { testWidgets('Middle still in center with asymmetrical actions', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -67,4 +69,44 @@ void main() { ...@@ -67,4 +69,44 @@ void main() {
); );
expect(find.byType(BackdropFilter), findsOneWidget); 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<Null>(
settings: settings,
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> 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
...@@ -25,8 +25,7 @@ export 'src/error.dart' show ...@@ -25,8 +25,7 @@ export 'src/error.dart' show
LogRecord, LogRecord,
flutterDriverLog; flutterDriverLog;
export 'src/find.dart' show export 'src/find.dart' show
SerializableFinder, SerializableFinder;
GetTextResult;
export 'src/health.dart' show export 'src/health.dart' show
Health, Health,
HealthStatus; HealthStatus;
......
...@@ -16,7 +16,8 @@ class GetRenderTree extends Command { ...@@ -16,7 +16,8 @@ class GetRenderTree extends Command {
final String kind = 'get_render_tree'; 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 { class RenderTree extends Result {
/// Creates a [RenderTree] object with the given string representation. /// Creates a [RenderTree] object with the given string representation.
RenderTree(this.tree); RenderTree(this.tree);
......
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