Commit 7f182dac authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

A variety of trivial fixes. (#6752)

parent 106ff332
...@@ -15,7 +15,8 @@ const double _kDrawerHeaderHeight = 160.0 + 1.0; // bottom edge ...@@ -15,7 +15,8 @@ const double _kDrawerHeaderHeight = 160.0 + 1.0; // bottom edge
/// ///
/// Part of the material design [Drawer]. /// Part of the material design [Drawer].
/// ///
/// Requires one of its ancestors to be a [Material] widget. /// Requires one of its ancestors to be a [Material] widget. This condition is
/// satisfied by putting the [DrawerItem] in a [Drawer].
/// ///
/// See also: /// See also:
/// ///
......
...@@ -18,7 +18,8 @@ import 'theme.dart'; ...@@ -18,7 +18,8 @@ import 'theme.dart';
/// ///
/// Part of the material design [Drawer]. /// Part of the material design [Drawer].
/// ///
/// Requires one of its ancestors to be a [Material] widget. /// Requires one of its ancestors to be a [Material] widget. This condition is
/// satisfied by putting the [DrawerItem] in a [Drawer].
/// ///
/// See also: /// See also:
/// ///
...@@ -115,18 +116,20 @@ class DrawerItem extends StatelessWidget { ...@@ -115,18 +116,20 @@ class DrawerItem extends StatelessWidget {
) )
); );
} }
children.add( if (child != null) {
new Flexible( children.add(
child: new Padding( new Flexible(
padding: const EdgeInsets.symmetric(horizontal: 16.0), child: new Padding(
child: new AnimatedDefaultTextStyle( padding: const EdgeInsets.symmetric(horizontal: 16.0),
style: _getTextStyle(themeData), child: new AnimatedDefaultTextStyle(
duration: kThemeChangeDuration, style: _getTextStyle(themeData),
child: child duration: kThemeChangeDuration,
child: child
)
) )
) )
) );
); }
return new MergeSemantics( return new MergeSemantics(
child: new Container( child: new Container(
......
...@@ -247,14 +247,14 @@ class ThemeData { ...@@ -247,14 +247,14 @@ class ThemeData {
/// The background color for major parts of the app (toolbars, tab bars, etc) /// The background color for major parts of the app (toolbars, tab bars, etc)
final Color primaryColor; final Color primaryColor;
/// The brightness of the primaryColor. Used to determine the color of text and /// The brightness of the [primaryColor]. Used to determine the color of text and
/// icons placed on top of the primary color (e.g. toolbar text). /// icons placed on top of the primary color (e.g. toolbar text).
final Brightness primaryColorBrightness; final Brightness primaryColorBrightness;
/// The foreground color for widgets (knobs, text, etc) /// The foreground color for widgets (knobs, text, etc)
final Color accentColor; final Color accentColor;
/// The brightness of the accentColor. Used to determine the color of text /// The brightness of the [accentColor]. Used to determine the color of text
/// and icons placed on top of the accent color (e.g. the icons on a floating /// and icons placed on top of the accent color (e.g. the icons on a floating
/// action button). /// action button).
final Brightness accentColorBrightness; final Brightness accentColorBrightness;
......
...@@ -967,7 +967,7 @@ class BackgroundImage { ...@@ -967,7 +967,7 @@ class BackgroundImage {
this.repeat: ImageRepeat.noRepeat, this.repeat: ImageRepeat.noRepeat,
this.centerSlice, this.centerSlice,
this.colorFilter, this.colorFilter,
this.alignment this.alignment,
}); });
/// The image to be painted into the background. /// The image to be painted into the background.
...@@ -999,6 +999,8 @@ class BackgroundImage { ...@@ -999,6 +999,8 @@ class BackgroundImage {
/// An alignment of (0.0, 0.0) aligns the image to the top-left corner of its /// An alignment of (0.0, 0.0) aligns the image to the top-left corner of its
/// layout bounds. An alignment of (1.0, 0.5) aligns the image to the middle /// layout bounds. An alignment of (1.0, 0.5) aligns the image to the middle
/// of the right edge of its layout bounds. /// of the right edge of its layout bounds.
///
/// Defaults to [FractionalOffset.center].
final FractionalOffset alignment; final FractionalOffset alignment;
@override @override
...@@ -1024,6 +1026,25 @@ class BackgroundImage { ...@@ -1024,6 +1026,25 @@ class BackgroundImage {
} }
/// An immutable description of how to paint a box. /// An immutable description of how to paint a box.
///
/// The following example uses the [Container] widget from the widgets layer to
/// draw a background image with a border:
///
/// ```dart
/// new Container(
/// decoration: new BoxDecoration(
/// backgroundColor: const Color(0xff7c94b6),
/// backgroundImage: new BackgroundImage(
/// image: new ExactAssetImage('images/flowers.jpeg'),
/// fit: ImageFit.cover,
/// ),
/// border: new Border.all(
/// color: Colors.black,
/// width: 8.0,
/// ),
/// ),
/// )
/// ```
class BoxDecoration extends Decoration { class BoxDecoration extends Decoration {
/// Creates a box decoration. /// Creates a box decoration.
/// ///
......
...@@ -248,7 +248,7 @@ class AssetBundleImageKey { ...@@ -248,7 +248,7 @@ class AssetBundleImageKey {
int get hashCode => hashValues(bundle, name, scale); int get hashCode => hashValues(bundle, name, scale);
@override @override
String toString() => '$runtimeType(bundle: $bundle, name: $name, scale: $scale)'; String toString() => '$runtimeType(bundle: $bundle, name: "$name", scale: $scale)';
} }
/// A subclass of [ImageProvider] that knows about [AssetBundle]s. /// A subclass of [ImageProvider] that knows about [AssetBundle]s.
...@@ -432,5 +432,5 @@ class ExactAssetImage extends AssetBundleImageProvider { ...@@ -432,5 +432,5 @@ class ExactAssetImage extends AssetBundleImageProvider {
int get hashCode => hashValues(name, scale, bundle); int get hashCode => hashValues(name, scale, bundle);
@override @override
String toString() => '$runtimeType(name: $name, scale: $scale, bundle: $bundle)'; String toString() => '$runtimeType(name: "$name", scale: $scale, bundle: $bundle)';
} }
...@@ -197,5 +197,5 @@ class AssetImage extends AssetBundleImageProvider { ...@@ -197,5 +197,5 @@ class AssetImage extends AssetBundleImageProvider {
int get hashCode => hashValues(name, bundle); int get hashCode => hashValues(name, bundle);
@override @override
String toString() => '$runtimeType(bundle: $bundle, name: $name)'; String toString() => '$runtimeType(bundle: $bundle, name: "$name")';
} }
...@@ -53,9 +53,6 @@ export 'package:flutter/rendering.dart' show ...@@ -53,9 +53,6 @@ export 'package:flutter/rendering.dart' show
ViewportAnchor, ViewportAnchor,
ViewportDimensions, ViewportDimensions,
ViewportDimensionsChangeCallback; ViewportDimensionsChangeCallback;
export 'package:flutter/services.dart' show
AssetImage,
NetworkImage;
// PAINTING NODES // PAINTING NODES
......
...@@ -4,14 +4,18 @@ ...@@ -4,14 +4,18 @@
import 'dart:io' show Platform; import 'dart:io' show Platform;
import 'package:meta/meta.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:meta/meta.dart';
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
import 'media_query.dart'; import 'media_query.dart';
export 'package:flutter/services.dart' show
AssetImage,
ExactAssetImage,
NetworkImage;
/// Creates an [ImageConfiguration] based on the given [BuildContext] (and /// Creates an [ImageConfiguration] based on the given [BuildContext] (and
/// optionally size). /// optionally size).
/// ///
......
...@@ -6,7 +6,19 @@ import 'package:meta/meta.dart'; ...@@ -6,7 +6,19 @@ import 'package:meta/meta.dart';
import 'framework.dart'; import 'framework.dart';
/// A widget that has exactly one inflated instance in the tree. /// Base class for stateful widgets that have exactly one inflated instance in
/// the tree.
///
/// Such widgets must be given a [GlobalKey]. This key can be generated by the
/// subclass from its [Type] object, e.g. by calling `super(key: new
/// GlobalObjectKey(MyWidget))` where `MyWidget` is the name of the subclass.
///
/// Since only one instance can be inflated at a time, there is only ever one
/// corresponding [State] object. That object is exposed, for convenience, via
/// the [currentState] property.
///
/// When subclassing [UniqueWidget], provide the corresponding [State] subclass
/// as the type argument.
abstract class UniqueWidget<T extends State<StatefulWidget>> extends StatefulWidget { abstract class UniqueWidget<T extends State<StatefulWidget>> extends StatefulWidget {
/// Creates a widget that has exactly one inflated instance in the tree. /// Creates a widget that has exactly one inflated instance in the 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