Commit 6f824bce authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

More documentation (#10519)

parent 18d1be4a
......@@ -448,6 +448,25 @@ class ElasticInOutCurve extends Curve {
// PREDEFINED CURVES
/// A collection of common animation curves.
///
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_bounce_in.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_bounce_in_out.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_bounce_out.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_decelerate.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_ease.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_ease_in.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_ease_in_out.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_ease_out.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_elastic_in.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_elastic_in_out.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_elastic_out.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_fast_out_slow_in.png)
/// ![](https://flutter.github.io/assets-for-api-docs/animation/curve_linear.png)
///
/// See also:
///
/// * [Curve], the interface implemented by the constants available from the
/// [Curves] class.
class Curves {
Curves._();
......
......@@ -15,7 +15,7 @@ const double _kTabBarHeight = 50.0;
const Color _kDefaultTabBarBackgroundColor = const Color(0xCCF8F8F8);
const Color _kDefaultTabBarBorderColor = const Color(0x4C000000);
/// An iOS styled bottom navigation tab bar.
/// An iOS-styled bottom navigation tab bar.
///
/// Displays multiple tabs using [BottomNavigationBarItem] with one tab being
/// active, the first tab by default.
......@@ -29,9 +29,10 @@ const Color _kDefaultTabBarBorderColor = const Color(0x4C000000);
///
/// If the given [backgroundColor]'s opacity is not 1.0 (which is the case by
/// default), it will produce a blurring effect to the content behind it.
///
//
// TODO(xster): document using with a CupertinoScaffold.
class CupertinoTabBar extends StatelessWidget {
/// Creates a tab bar in the iOS style.
CupertinoTabBar({
Key key,
@required this.items,
......
......@@ -4,6 +4,7 @@
import 'dart:ui' show Color;
/// [Color] constants that describe colors commonly used in iOS applications.
class CupertinoColors {
CupertinoColors._();
......
......@@ -15,7 +15,7 @@ const double _kNavBarHeight = 44.0;
const Color _kDefaultNavBarBackgroundColor = const Color(0xCCF8F8F8);
const Color _kDefaultNavBarBorderColor = const Color(0x4C000000);
/// An iOS styled navigation bar.
/// An iOS-styled navigation bar.
///
/// The navigation bar is a toolbar that minimally consists of a widget, normally
/// a page title, in the [middle] of the toolbar.
......@@ -28,11 +28,12 @@ const Color _kDefaultNavBarBorderColor = const Color(0x4C000000);
///
/// If the given [backgroundColor]'s opacity is not 1.0 (which is the case by
/// default), it will produce a blurring effect to the content behind it.
///
//
// TODO(xster): document automatic addition of a CupertinoBackButton.
// TODO(xster): add sample code using icons.
// TODO(xster): document integration into a CupertinoScaffold.
class CupertinoNavigationBar extends StatelessWidget implements PreferredSizeWidget {
/// Creates a navigation bar in the iOS style.
const CupertinoNavigationBar({
Key key,
this.leading,
......
......@@ -10,6 +10,8 @@ import 'theme.dart';
/// A "back" icon that's appropriate for the current [TargetPlatform].
///
/// The current platform is determined by querying for the ambient [Theme].
///
/// See also:
///
/// * [BackButton], an [IconButton] with a [BackButtonIcon] that calls
......@@ -17,7 +19,10 @@ import 'theme.dart';
/// * [IconButton], which is a more general widget for creating buttons
/// with icons.
/// * [Icon], a material design icon.
/// * [ThemeData.platform], which specifies the current platform.
class BackButtonIcon extends StatelessWidget {
/// Creates an icon that shows the appropriate "back" image for
/// the current platform (as obtained from the [Theme]).
const BackButtonIcon({ Key key }) : super(key: key);
/// Returns tha appropriate "back" icon for the given `platform`.
......
......@@ -31,6 +31,9 @@ import 'theme.dart';
/// [secondary] widget is placed on the opposite side. This maps to the
/// [ListTile.leading] and [ListTile.trailing] properties of [ListTile].
///
/// To show the [CheckboxListTile] as disabled, pass null as the [onChanged]
/// callback.
///
/// ## Sample code
///
/// This widget shows a checkbox that, when checked, slows down all animations
......
......@@ -91,6 +91,16 @@ class MaterialAccentColor extends ColorSwatch<int> {
/// colors selected for the current theme, such as [ThemeData.primaryColor] and
/// [ThemeData.accentColor] (among many others).
///
/// Most swatches have colors from 100 to 900 in increments of one hundred, plus
/// the color 50. The smaller the number, the more pale the color. The greater
/// the number, the darker the color. The accent swatches (e.g. [redAccent]) only
/// have the values 100, 200, 400, and 700.
///
/// In addition, a series of blacks and whites with common opacities are
/// available. For example, [black54] is a pure black with 54% opacity.
///
/// ## Sample code
///
/// To select a specific color from one of the swatches, index into the swatch
/// using an integer for the specific color desired, as follows:
///
......@@ -98,7 +108,7 @@ class MaterialAccentColor extends ColorSwatch<int> {
/// Colors.green[400] // Selects a mid-range green.
/// ```
///
/// Each [ColorSwatch] constant is a color and can used directly. For example
/// Each [ColorSwatch] constant is a color and can used directly. For example:
///
/// ```dart
/// new Container(
......@@ -106,13 +116,73 @@ class MaterialAccentColor extends ColorSwatch<int> {
/// )
/// ```
///
/// Most swatches have colors from 100 to 900 in increments of one hundred, plus
/// the color 50. The smaller the number, the more pale the color. The greater
/// the number, the darker the color. The accent swatches (e.g. [redAccent]) only
/// have the values 100, 200, 400, and 700.
/// ## Color palettes
///
/// In addition, a series of blacks and whites with common opacities are
/// available. For example, [black54] is a pure black with 54% opacity.
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pink.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pinkAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.red.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.redAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrangeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orangeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amber.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amberAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellow.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellowAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lime.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.limeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreen.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.green.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.greenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.teal.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.tealAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyan.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyanAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigo.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigoAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purpleAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurpleAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueGrey.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.brown.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.grey.png)
///
/// ## Blacks and whites
///
/// These colors are identified by their transparency. The low transparency
/// levels (e.g. [Colors.white12] and [Colors.white10]) are very hard to see and
/// should be avoided in general. They are intended for very subtle effects.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blacks.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.whites.png)
///
/// The [Colors.transparent] color isn't shown here because it is entirely
/// invisible!
class Colors {
Colors._();
......@@ -120,54 +190,97 @@ class Colors {
static const Color transparent = const Color(0x00000000);
/// Completely opaque black.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blacks.png)
///
/// See also:
///
/// * [black87], [black54], [black45], [black38], [black26], [black12], which
/// are variants on this color but with different opacities.
/// * [white], a solid white color.
/// * [transparent], a fully-transparent color.
static const Color black = const Color(0xFF000000);
/// Black with 87% opacity.
///
/// This is a good contrasting color for text in light themes.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blacks.png)
///
/// See also:
///
/// * [Typography.black], which uses this color for its text styles.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// * [black], [black54], [black45], [black38], [black26], [black12], which
/// are variants on this color but with different opacities.
static const Color black87 = const Color(0xDD000000);
/// Black with 54% opacity.
///
/// This is a color commonly used for headings in light themes.
/// This is a color commonly used for headings in light themes. It's also used
/// as the mask color behind dialogs.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blacks.png)
///
/// See also:
///
/// * [Typography.black], which uses this color for its text styles.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// * [black], [black87], [black45], [black38], [black26], [black12], which
/// are variants on this color but with different opacities.
static const Color black54 = const Color(0x8A000000);
/// Black with 45% opacity.
///
/// Used for disabled icons.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blacks.png)
///
/// See also:
///
/// * [black], [black87], [black54], [black38], [black26], [black12], which
/// are variants on this color but with different opacities.
static const Color black45 = const Color(0x73000000);
/// Black with 38% opacity.
///
/// Used for the placeholder text in data tables in light themes.
static const Color black38 = const Color(0x61000000);
/// Black with 45% opacity.
///
/// Used for modal barriers.
static const Color black45 = const Color(0x73000000);
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blacks.png)
///
/// See also:
///
/// * [black], [black87], [black54], [black45], [black26], [black12], which
/// are variants on this color but with different opacities.
static const Color black38 = const Color(0x61000000);
/// Black with 26% opacity.
///
/// Used for disabled radio buttons and the text of disabled flat buttons in light themes.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blacks.png)
///
/// See also:
///
/// * [ThemeData.disabledColor], which uses this color by default in light themes.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// * [black], [black87], [black54], [black45], [black38], [black12], which
/// are variants on this color but with different opacities.
static const Color black26 = const Color(0x42000000);
/// Black with 12% opacity.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blacks.png)
///
/// Used for the background of disabled raised buttons in light themes.
///
/// See also:
///
/// * [black], [black87], [black54], [black45], [black38], [black26], which
/// are variants on this color but with different opacities.
static const Color black12 = const Color(0x1F000000);
/// Completely opaque white.
......@@ -175,45 +288,85 @@ class Colors {
/// This is a good contrasting color for the [ThemeData.primaryColor] in the
/// dark theme. See [ThemeData.brightness].
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.whites.png)
///
/// See also:
///
/// * [Typography.white], which uses this color for its text styles.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// * [white70, white30, white12, white10], which are variants on this color
/// but with different opacities.
/// * [black], a solid black color.
/// * [transparent], a fully-transparent color.
static const Color white = const Color(0xFFFFFFFF);
/// White with 70% opacity.
///
/// This is a color commonly used for headings in dark themes.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.whites.png)
///
/// See also:
///
/// * [Typography.white], which uses this color for its text styles.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// * [white, white30, white12, white10], which are variants on this color
/// but with different opacities.
static const Color white70 = const Color(0xB3FFFFFF);
/// White with 32% opacity.
///
/// Used for disabled radio buttons and the text of disabled flat buttons in dark themes.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.whites.png)
///
/// See also:
///
/// * [ThemeData.disabledColor], which uses this color by default in dark themes.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// * [white, white70, white12, white10], which are variants on this color
/// but with different opacities.
static const Color white30 = const Color(0x4DFFFFFF);
/// White with 12% opacity.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.whites.png)
///
/// Used for the background of disabled raised buttons in dark themes.
///
/// See also:
///
/// * [white, white70, white30, white10], which are variants on this color
/// but with different opacities.
static const Color white12 = const Color(0x1FFFFFFF);
/// White with 10% opacity.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.whites.png)
///
/// See also:
///
/// * [white, white70, white30, white12], which are variants on this color
/// but with different opacities.
/// * [transparent], a fully-transparent color, not far from this one.
static const Color white10 = const Color(0x1AFFFFFF);
/// The red primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.red.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.redAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrangeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pink.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pinkAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -224,6 +377,7 @@ class Colors {
/// See also:
///
/// * [redAccent], the corresponding accent colors.
/// * [deepOrange] and [pink], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor red = const MaterialColor(
......@@ -245,6 +399,17 @@ class Colors {
/// The red accent swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.red.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.redAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrangeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pink.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pinkAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -255,6 +420,7 @@ class Colors {
/// See also:
///
/// * [red], the corresponding primary colors.
/// * [deepOrangeAccent] and [pinkAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor redAccent = const MaterialAccentColor(
......@@ -270,6 +436,17 @@ class Colors {
/// The pink primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pink.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pinkAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.red.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.redAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purpleAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -280,6 +457,7 @@ class Colors {
/// See also:
///
/// * [pinkAccent], the corresponding accent colors.
/// * [red] and [purple], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor pink = const MaterialColor(
......@@ -301,6 +479,17 @@ class Colors {
/// The pink accent color swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pink.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pinkAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.red.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.redAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purpleAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -311,6 +500,7 @@ class Colors {
/// See also:
///
/// * [pink], the corresponding primary colors.
/// * [redAccent] and [purpleAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor pinkAccent = const MaterialAccentColor(
......@@ -326,6 +516,17 @@ class Colors {
/// The purple primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purpleAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurpleAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pink.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pinkAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -336,6 +537,7 @@ class Colors {
/// See also:
///
/// * [purpleAccent], the corresponding accent colors.
/// * [deepPurple] and [pink], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor purple = const MaterialColor(
......@@ -357,6 +559,17 @@ class Colors {
/// The purple accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purpleAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurpleAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pink.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.pinkAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -367,6 +580,7 @@ class Colors {
/// See also:
///
/// * [purple], the corresponding primary colors.
/// * [deepPurpleAccent] and [pinkAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor purpleAccent = const MaterialAccentColor(
......@@ -382,6 +596,17 @@ class Colors {
/// The deep purple primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurpleAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purpleAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigo.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigoAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -392,6 +617,7 @@ class Colors {
/// See also:
///
/// * [deepPurpleAccent], the corresponding accent colors.
/// * [purple] and [indigo], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor deepPurple = const MaterialColor(
......@@ -413,6 +639,17 @@ class Colors {
/// The deep purple accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurpleAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.purpleAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigo.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigoAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -423,6 +660,7 @@ class Colors {
/// See also:
///
/// * [deepPurple], the corresponding primary colors.
/// * [purpleAccent] and [indigoAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor deepPurpleAccent = const MaterialAccentColor(
......@@ -438,6 +676,17 @@ class Colors {
/// The indigo primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigo.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigoAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurpleAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -448,6 +697,7 @@ class Colors {
/// See also:
///
/// * [indigoAccent], the corresponding accent colors.
/// * [blue] and [deepPurple], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor indigo = const MaterialColor(
......@@ -469,6 +719,17 @@ class Colors {
/// The indigo accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigo.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigoAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurple.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepPurpleAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -479,6 +740,7 @@ class Colors {
/// See also:
///
/// * [indigo], the corresponding primary colors.
/// * [blueAccent] and [deepPurpleAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor indigoAccent = const MaterialAccentColor(
......@@ -494,6 +756,19 @@ class Colors {
/// The blue primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigo.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigoAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueGrey.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -504,6 +779,7 @@ class Colors {
/// See also:
///
/// * [blueAccent], the corresponding accent colors.
/// * [indigo], [lightBlue], and [blueGrey], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor blue = const MaterialColor(
......@@ -525,6 +801,17 @@ class Colors {
/// The blue accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigo.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.indigoAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlueAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -535,6 +822,7 @@ class Colors {
/// See also:
///
/// * [blue], the corresponding primary colors.
/// * [indigoAccent] and [lightBlueAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor blueAccent = const MaterialAccentColor(
......@@ -550,6 +838,17 @@ class Colors {
/// The light blue primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyan.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyanAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -560,6 +859,7 @@ class Colors {
/// See also:
///
/// * [lightBlueAccent], the corresponding accent colors.
/// * [blue] and [cyan], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor lightBlue = const MaterialColor(
......@@ -581,6 +881,17 @@ class Colors {
/// The light blue accent swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyan.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyanAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -591,6 +902,7 @@ class Colors {
/// See also:
///
/// * [lightBlue], the corresponding primary colors.
/// * [blueAccent] and [cyanAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor lightBlueAccent = const MaterialAccentColor(
......@@ -606,6 +918,19 @@ class Colors {
/// The cyan primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyan.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyanAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.teal.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.tealAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueGrey.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -616,6 +941,7 @@ class Colors {
/// See also:
///
/// * [cyanAccent], the corresponding accent colors.
/// * [lightBlue], [teal], and [blueGrey], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor cyan = const MaterialColor(
......@@ -637,6 +963,17 @@ class Colors {
/// The cyan accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyan.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyanAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlue.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightBlueAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.teal.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.tealAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -647,6 +984,7 @@ class Colors {
/// See also:
///
/// * [cyan], the corresponding primary colors.
/// * [lightBlueAccent] and [tealAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor cyanAccent = const MaterialAccentColor(
......@@ -662,6 +1000,17 @@ class Colors {
/// The teal primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.teal.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.tealAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.green.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.greenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyan.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyanAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -672,6 +1021,7 @@ class Colors {
/// See also:
///
/// * [tealAccent], the corresponding accent colors.
/// * [green] and [cyan], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor teal = const MaterialColor(
......@@ -693,6 +1043,17 @@ class Colors {
/// The teal accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.teal.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.tealAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.green.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.greenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyan.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyanAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -703,6 +1064,7 @@ class Colors {
/// See also:
///
/// * [teal], the corresponding primary colors.
/// * [greenAccent] and [cyanAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor tealAccent = const MaterialAccentColor(
......@@ -718,6 +1080,20 @@ class Colors {
/// The green primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.green.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.greenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.teal.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.tealAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreen.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lime.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.limeAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -728,6 +1104,7 @@ class Colors {
/// See also:
///
/// * [greenAccent], the corresponding accent colors.
/// * [teal], [lightGreen], and [lime], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor green = const MaterialColor(
......@@ -749,6 +1126,20 @@ class Colors {
/// The green accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.green.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.greenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.teal.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.tealAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreen.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lime.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.limeAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -759,6 +1150,7 @@ class Colors {
/// See also:
///
/// * [green], the corresponding primary colors.
/// * [tealAccent], [lightGreenAccent], and [limeAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor greenAccent = const MaterialAccentColor(
......@@ -774,6 +1166,17 @@ class Colors {
/// The light green primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreen.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.green.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.greenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lime.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.limeAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -784,6 +1187,7 @@ class Colors {
/// See also:
///
/// * [lightGreenAccent], the corresponding accent colors.
/// * [green] and [lime], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor lightGreen = const MaterialColor(
......@@ -805,6 +1209,17 @@ class Colors {
/// The light green accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreen.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.green.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.greenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lime.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.limeAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -815,6 +1230,7 @@ class Colors {
/// See also:
///
/// * [lightGreen], the corresponding primary colors.
/// * [greenAccent] and [limeAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor lightGreenAccent = const MaterialAccentColor(
......@@ -830,6 +1246,17 @@ class Colors {
/// The lime primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lime.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.limeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreen.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellow.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellowAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -840,6 +1267,7 @@ class Colors {
/// See also:
///
/// * [limeAccent], the corresponding accent colors.
/// * [lightGreen] and [yellow], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor lime = const MaterialColor(
......@@ -861,6 +1289,17 @@ class Colors {
/// The lime accent primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lime.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.limeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreen.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lightGreenAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellow.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellowAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -871,6 +1310,7 @@ class Colors {
/// See also:
///
/// * [lime], the corresponding primary colors.
/// * [lightGreenAccent] and [yellowAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor limeAccent = const MaterialAccentColor(
......@@ -886,6 +1326,17 @@ class Colors {
/// The yellow primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellow.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellowAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lime.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.limeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amber.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amberAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -896,6 +1347,7 @@ class Colors {
/// See also:
///
/// * [yellowAccent], the corresponding accent colors.
/// * [lime] and [amber], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor yellow = const MaterialColor(
......@@ -917,6 +1369,17 @@ class Colors {
/// The yellow accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellow.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellowAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.lime.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.limeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amber.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amberAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -927,6 +1390,7 @@ class Colors {
/// See also:
///
/// * [yellow], the corresponding primary colors.
/// * [limeAccent] and [amberAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor yellowAccent = const MaterialAccentColor(
......@@ -942,6 +1406,17 @@ class Colors {
/// The amber primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amber.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amberAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellow.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellowAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orangeAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -952,6 +1427,7 @@ class Colors {
/// See also:
///
/// * [amberAccent], the corresponding accent colors.
/// * [yellow] and [orange], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor amber = const MaterialColor(
......@@ -973,6 +1449,17 @@ class Colors {
/// The amber accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amber.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amberAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellow.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.yellowAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orangeAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -983,6 +1470,7 @@ class Colors {
/// See also:
///
/// * [amber], the corresponding primary colors.
/// * [yellowAccent] and [orangeAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor amberAccent = const MaterialAccentColor(
......@@ -998,6 +1486,19 @@ class Colors {
/// The orange primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orangeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amber.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amberAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrangeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.brown.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -1008,6 +1509,7 @@ class Colors {
/// See also:
///
/// * [orangeAccent], the corresponding accent colors.
/// * [amber], [deepOrange], and [brown], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor orange = const MaterialColor(
......@@ -1029,6 +1531,17 @@ class Colors {
/// The orange accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orangeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amber.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.amberAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrangeAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -1039,6 +1552,7 @@ class Colors {
/// See also:
///
/// * [orange], the corresponding primary colors.
/// * [amberAccent] and [deepOrangeAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor orangeAccent = const MaterialAccentColor(
......@@ -1054,6 +1568,19 @@ class Colors {
/// The deep orange primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrangeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orangeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.red.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.redAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.brown.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -1064,6 +1591,7 @@ class Colors {
/// See also:
///
/// * [deepOrangeAccent], the corresponding accent colors.
/// * [orange], [red], and [brown], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor deepOrange = const MaterialColor(
......@@ -1085,6 +1613,17 @@ class Colors {
/// The deep orange accent color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.deepOrangeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orange.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orangeAccent.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.red.png)
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.redAccent.png)
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -1095,6 +1634,7 @@ class Colors {
/// See also:
///
/// * [deepOrange], the corresponding primary colors.
/// * [orangeAccent] [redAccent], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialAccentColor deepOrangeAccent = const MaterialAccentColor(
......@@ -1110,6 +1650,16 @@ class Colors {
/// The brown primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.brown.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.orange.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueGrey.png)
///
/// This swatch has no corresponding accent color and swatch.
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -1117,10 +1667,9 @@ class Colors {
/// ),
/// ```
///
/// This swatch has no corresponding accent color and swatch.
///
/// See also:
///
/// * [orange] and [blueGrey], vaguely similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor brown = const MaterialColor(
......@@ -1142,12 +1691,11 @@ class Colors {
/// The grey primary color and swatch.
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
/// color: Colors.grey[400],
/// ),
/// ```
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.grey.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueGrey.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.brown.png)
///
/// This swatch has no corresponding accent swatch.
///
......@@ -1156,8 +1704,20 @@ class Colors {
/// used for raised button while pressed in light themes, and 850 is used for
/// the background color of the dark theme. See [ThemeData.brightness].
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
/// color: Colors.grey[400],
/// ),
/// ```
///
/// See also:
///
/// * [blueGrey] and [brown], somewhat similar colors.
/// * [black], [black87], [black54], [black45], [black38], [black26], [black12], which
/// provide a different approach to showing shades of grey.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor grey = const MaterialColor(
......@@ -1181,6 +1741,18 @@ class Colors {
/// The blue-grey primary color and swatch.
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blueGrey.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.grey.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.cyan.png)
///
/// ![](https://flutter.github.io/assets-for-api-docs/material/Colors.blue.png)
///
/// This swatch has no corresponding accent swatch.
///
/// ## Sample code
///
/// ```dart
/// new Icon(
/// icon: Icons.widgets,
......@@ -1188,10 +1760,9 @@ class Colors {
/// ),
/// ```
///
/// This swatch has no corresponding accent swatch.
///
/// See also:
///
/// * [grey], [cyan], and [blue], similar colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
static const MaterialColor blueGrey = const MaterialColor(
......@@ -1211,7 +1782,7 @@ class Colors {
);
static const int _blueGreyPrimaryValue = 0xFF607D8B;
/// The material design primary color swatches (except grey).
/// The material design primary color swatches, excluding grey.
static const List<MaterialColor> primaries = const <MaterialColor>[
red,
pink,
......@@ -1230,7 +1801,9 @@ class Colors {
orange,
deepOrange,
brown,
// grey intentionally omitted
// The grey swatch is intentionally omitted because when picking a color
// randomly from this list to colorize an application, picking grey suddenly
// makes the app look disabled.
blueGrey,
];
......
......@@ -34,6 +34,9 @@ import 'theme.dart';
/// [secondary] widget is placed on the opposite side. This maps to the
/// [ListTile.leading] and [ListTile.trailing] properties of [ListTile].
///
/// To show the [RadioListTile] as disabled, pass null as the [onChanged]
/// callback.
///
/// ## Sample code
///
/// This widget shows a pair of radio buttons that control the `_character`
......
......@@ -32,6 +32,9 @@ import 'theme.dart';
/// [ListTile.leading] slot. This cannot be changed; there is not sufficient
/// space in a [ListTile]'s [ListTile.leading] slot for a [Switch].
///
/// To show the [SwitchListTile] as disabled, pass null as the [onChanged]
/// callback.
///
/// ## Sample code
///
/// This widget shows a switch that, when toggled, changes the state of a [bool]
......
......@@ -1411,7 +1411,7 @@ class DecorationImage {
///
/// The [BoxDecoration] class provides a variety of ways to draw a box.
///
/// The box has a [border], a body, and may cast a [shadow].
/// The box has a [border], a body, and may cast a [boxShadow].
///
/// The [shape] of the box can be a circle or a rectangle. If it is a rectangle,
/// then the [borderRadius] property controls the roundness of the corners.
......@@ -1421,7 +1421,7 @@ class DecorationImage {
/// the box. Finally there is the [image], the precise alignment of which is
/// controlled by the [DecorationImage] class.
///
/// The [border] paints over the body; the [shadow], naturally, paints below it.
/// The [border] paints over the body; the [boxShadow], naturally, paints below it.
///
/// ## Sample code
///
......
......@@ -58,7 +58,32 @@ class TextSelectionPoint {
}
}
/// Displays some text in a scrollable container with a potentially blinking
/// cursor and with gesture recognizers.
///
/// This is the renderer for an editable text field. It does not directly
/// provide affordances for editing the text, but it does handle text selection
/// and manipulation of the text cursor.
///
/// The [text] is displayed, scrolled by the given [offset], aligned according
/// to [textAlign]. The [maxLines] property controls whether the text displays
/// on one line or many. The [selection], if it is not collapsed, is painted in
/// the [selectionColor]. If it _is_ collapsed, then it represents the cursor
/// position. The cursor is shown while [showCursor] is true. It is painted in
/// the [cursorColor].
///
/// If, when the render object paints, the caret is found to have changed
/// location, [onCaretChanged] is called.
///
/// The user may interact with the render object by tapping or long-pressing.
/// When the user does so, the selection is updated, and [onSelectionChanged] is
/// called.
///
/// Keyboard handling, IME handling, scrolling, toggling the [showCursor] value
/// to actually blink the cursor, and other features not mentioned above are the
/// responsibility of higher layers and not handled by this object.
class RenderEditable extends RenderBox {
/// Creates a render object that implements the visual aspects of a text field.
RenderEditable({
TextSpan text,
TextAlign textAlign,
......
......@@ -1233,8 +1233,8 @@ class PipelineOwner {
/// Update the semantics for render objects marked as needing a semantics
/// update.
///
/// Initially, only the root node, as scheduled by [scheduleInitialSemantics],
/// needs a semantics update.
/// Initially, only the root node, as scheduled by
/// [RenderObjectscheduleInitialSemantics], 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
......
......@@ -1509,7 +1509,7 @@ class RenderTransform extends RenderProxyBox {
/// child as it is painted. When set to false, hit tests are performed
/// ignoring the transformation.
///
/// applyPaintTransform(), and therefore localToGlobal() and globalToLocal(),
/// [applyPaintTransform], and therefore [localToGlobal] and [globalToLocal],
/// always honor the transformation, regardless of the value of this property.
bool transformHitTests;
......@@ -2890,12 +2890,14 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
}
}
/// Causes the semantics of all siblings and cousins painted before it in the
/// same semantic container to be dropped.
/// Causes the semantics of all earlier render objects below the same semantic
/// boundary to be dropped.
///
/// This is useful in a stack where an overlay should prevent interactions
/// with the underlying layers.
/// This is useful in a stack where an opaque mask should prevent interactions
/// with the render objects painted below the mask.
class RenderBlockSemantics extends RenderProxyBox {
/// Create a render object that blocks semantics for nodes below it in paint
/// order.
RenderBlockSemantics({ RenderBox child }) : super(child);
@override
......
......@@ -35,6 +35,7 @@ abstract class RenderSliverPersistentHeader extends RenderSliver with RenderObje
/// child changes its intrinsic dimensions.
double get minExtent;
/// The dimension of the child in the main axis.
@protected
double get childExtent {
if (child == null)
......
......@@ -19,6 +19,13 @@ import 'image_stream.dart';
/// Configuration information passed to the [ImageProvider.resolve] method to
/// select a specific image.
///
/// See also:
///
/// * [createLocalImageConfiguration], which creates an [ImageConfiguration]
/// based on ambient configuration in a [Widget] environment.
/// * [ImageProvider], which uses [ImageConfiguration] objects to determine
/// which image to obtain.
@immutable
class ImageConfiguration {
/// Creates an object holding the configuration information for an [ImageProvider].
......@@ -149,6 +156,80 @@ class ImageConfiguration {
///
/// The type argument does not have to be specified when using the type as an
/// argument (where any image provider is acceptable).
///
/// ## Sample code
///
/// The following shows the code required to write a widget that fully conforms
/// to the [ImageProvider] and [Widget] protocols.
///
/// ```dart
/// class Picture extends StatefulWidget {
/// const Picture({
/// Key key,
/// @required this.imageProvider,
/// }) : assert(imageProvider != null),
/// super(key: key);
///
/// final ImageProvider imageProvider;
///
/// @override
/// _PictureState createState() => new _PictureState();
/// }
///
/// class _PictureState extends State<Picture> {
/// ImageStream _imageStream;
/// ImageInfo _imageInfo;
///
/// @override
/// void didChangeDependencies() {
/// super.didChangeDependencies();
/// // We call _getImage here because createLocalImageConfiguration() needs to
/// // be called again if the dependencies changed, in case the changes relate
/// // to the DefaultAssetBundle, MediaQuery, etc, which that method uses.
/// _getImage();
/// }
///
/// @override
/// void didUpdateWidget(Picture oldWidget) {
/// super.didUpdateWidget(oldWidget);
/// if (widget.imageProvider != oldWidget.imageProvider)
/// _getImage();
/// }
///
/// void _getImage() {
/// final ImageStream oldImageStream = _imageStream;
/// _imageStream = widget.imageProvider.resolve(createLocalImageConfiguration(context));
/// if (_imageStream.key != oldImageStream?.key) {
/// // If the keys are the same, then we got the same image back, and so we don't
/// // need to update the listeners. If the key changed, though, we must make sure
/// // to switch our listeners to the new image stream.
/// oldImageStream?.removeListener(_updateImage);
/// _imageStream.addListener(_updateImage);
/// }
/// }
///
/// void _updateImage(ImageInfo imageInfo, bool synchronousCall) {
/// setState(() {
/// // Trigger a build whenever the image changes.
/// _imageInfo = imageInfo;
/// });
/// }
///
/// @override
/// void dispose() {
/// _imageStream.removeListener(_updateImage);
/// super.dispose();
/// }
///
/// @override
/// Widget build(BuildContext context) {
/// return new RawImage(
/// image: _imageInfo?.image, // this is a dart:ui Image object
/// scale: _imageInfo?.scale ?? 1.0,
/// );
/// }
/// }
/// ```
@optionalTypeArgs
abstract class ImageProvider<T> {
/// Abstract const constructor. This constructor enables subclasses to provide
......
......@@ -44,10 +44,14 @@ class ImageInfo {
/// Signature for callbacks reporting that an image is available.
///
/// synchronousCall is true if the listener is being invoked during the call
/// to addListener.
///
/// Used by [ImageStream].
///
/// The `synchronousCall` argument is true if the listener is being invoked
/// during the call to addListener. This can be useful if, for example,
/// [ImageStream.addListener] is invoked during a frame, so that a new rendering
/// frame is requested if the call was asynchronous (after the current frame)
/// and no rendering frame is requested if the call was synchronous (within the
/// same stack frame as the call to [ImageStream.addListener]).
typedef void ImageListener(ImageInfo image, bool synchronousCall);
/// A handle to an image resource.
......@@ -61,6 +65,11 @@ typedef void ImageListener(ImageInfo image, bool synchronousCall);
/// loading.
///
/// ImageStream objects are backed by [ImageStreamCompleter] objects.
///
/// See also:
///
/// * [ImageProvider], which has an example that includes the use of an
/// [ImageStream] in a [Widget].
class ImageStream {
/// Create an initially unbound image stream.
///
......
......@@ -38,6 +38,26 @@ enum CrossFadeState {
/// width. In the case where the two children have different heights, the
/// animation crops overflowing children during the animation by aligning their
/// top edge, which means that the bottom will be clipped.
///
/// ## Sample code
///
/// This code fades between two representations of the Flutter logo. It depends
/// on a global boolean `_on`; when `_on` is true, the first logo is shown,
/// otherwise the second logo is shown.
///
/// ```dart
/// new AnimatedCrossFade(
/// duration: const Duration(seconds: 3),
/// firstChild: const FlutterLogo(style: FlutterLogoStyle.horizontal, size: 100.0),
/// secondChild: const FlutterLogo(style: FlutterLogoStyle.stacked, size: 100.0),
/// crossFadeState: _on ? CrossFadeState.showFirst : CrossFadeState.showSecond,
/// )
/// ```
///
/// See also:
///
/// * [AnimatedSize], the lower-level widget which [AnimatedCrossFade] uses to
/// automatically change size.
class AnimatedCrossFade extends StatefulWidget {
/// Creates a cross-fade animation widget.
///
......@@ -99,6 +119,14 @@ class AnimatedCrossFade extends StatefulWidget {
@override
_AnimatedCrossFadeState createState() => new _AnimatedCrossFadeState();
@override
void debugFillDescription(List<String> description) {
super.debugFillDescription(description);
description.add('$crossFadeState');
if (alignment != FractionalOffset.topCenter)
description.add('alignment: $alignment');
}
}
class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProviderStateMixin {
......@@ -212,4 +240,13 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid
),
);
}
@override
void debugFillDescription(List<String> description) {
super.debugFillDescription(description);
description.add('${widget.crossFadeState}');
description.add('$_controller');
if (widget.alignment != FractionalOffset.topCenter)
description.add('alignment: ${widget.alignment}');
}
}
......@@ -80,6 +80,8 @@ export 'package:flutter/rendering.dart' show
/// See also:
///
/// * [ShaderMask], which can apply more elaborate effects to its child.
/// * [Transform], which applies an arbitrary transform to its child widget at
/// paint time.
class Opacity extends SingleChildRenderObjectWidget {
/// Creates a widget that makes its child partially transparent.
///
......@@ -147,6 +149,7 @@ class Opacity extends SingleChildRenderObjectWidget {
/// * [Opacity], which can apply a uniform alpha effect to its child.
/// * [CustomPaint], which lets you draw directly on the canvas.
/// * [DecoratedBox], for another approach at decorating child widgets.
/// * [BackdropFilter], which applies an image filter to the background.
class ShaderMask extends SingleChildRenderObjectWidget {
/// Creates a widget that applies a mask generated by a [Shader] to its child.
///
......@@ -196,6 +199,11 @@ class ShaderMask extends SingleChildRenderObjectWidget {
///
/// This effect is relatively expensive, especially if the filter is non-local,
/// such as a blur.
///
/// See also:
///
/// * [DecoratedBox], which draws a background under (or over) a widget.
/// * [Opacity], which changes the opacity of the widget itself.
class BackdropFilter extends SingleChildRenderObjectWidget {
/// Creates a backdrop filter.
///
......@@ -547,6 +555,11 @@ class ClipPath extends SingleChildRenderObjectWidget {
///
/// Physical layers cast shadows based on an [elevation] which is nominally in
/// logical pixels, coming vertically out of the rendering surface.
///
/// See also:
///
/// * [DecoratedBox], which can apply more arbitrary shadow effects.
/// * [ClipRect], which applies a clip to its child.
class PhysicalModel extends SingleChildRenderObjectWidget {
/// Creates a physical model with a rounded-rectangular clip.
///
......@@ -607,6 +620,32 @@ class PhysicalModel extends SingleChildRenderObjectWidget {
// POSITIONING AND SIZING NODES
/// A widget that applies a transformation before painting its child.
///
/// ## Sample code
///
/// This example rotates and skews an orange box containing text, keeping the
/// top right corner pinned to its original position.
///
/// ```dart
/// new Container(
/// color: Colors.black,
/// child: new Transform(
/// alignment: FractionalOffset.topRight,
/// transform: new Matrix4.skewY(0.3)..rotateZ(-math.PI / 12.0),
/// child: new Container(
/// padding: const EdgeInsets.all(8.0),
/// color: const Color(0xFFE8581C),
/// child: const Text('Apartment for rent!'),
/// ),
/// ),
/// )
/// ```
///
/// See also:
/// * [RotatedBox], which rotates the child widget during layout, not just
/// during painting.
/// * [FittedBox], which sizes and positions its child widget to fit the parent
/// according to a given [BoxFit] discipline.
class Transform extends SingleChildRenderObjectWidget {
/// Creates a widget that transforms its child.
///
......@@ -617,10 +656,41 @@ class Transform extends SingleChildRenderObjectWidget {
this.origin,
this.alignment,
this.transformHitTests: true,
Widget child
Widget child,
}) : assert(transform != null),
super(key: key, child: child);
/// Creates a widget that transforms its child using a rotation around the
/// center.
///
/// The `angle` argument must not be null. It gives the rotation in clockwise
/// radians.
///
/// ## Sample code
///
/// This example rotates an orange box containing text around its center by
/// fifteen degrees.
///
/// ```dart
/// new Transform.rotate(
/// angle: -math.PI / 12.0,
/// child: new Container(
/// padding: const EdgeInsets.all(8.0),
/// color: const Color(0xFFE8581C),
/// child: const Text('Apartment for rent!'),
/// ),
/// )
/// ```
Transform.rotate({
Key key,
@required double angle,
this.origin,
this.alignment: FractionalOffset.center,
this.transformHitTests: true,
Widget child,
}) : transform = new Matrix4.rotationZ(angle),
super(key: key, child: child);
/// The matrix to transform the child by during painting.
final Matrix4 transform;
......@@ -659,6 +729,11 @@ class Transform extends SingleChildRenderObjectWidget {
}
/// Scales and positions its child within itself according to [fit].
///
/// See also:
///
/// * [Transform], which applies an arbitrary transform to its child widget at
/// paint time.
class FittedBox extends SingleChildRenderObjectWidget {
/// Creates a widget that scales and positions its child within itself according to [fit].
///
......
......@@ -27,6 +27,50 @@ export 'dart:ui' show AppLifecycleState, Locale;
/// handlers, or can used with the `implements` keyword, in which case all the
/// handlers must be implemented (and the analyzer will list those that have
/// been omitted).
///
/// ## Sample code
///
/// This [StatefulWidget] implements the parts of the [State] and
/// [WidgetsBindingObserver] protocols necessary to react to application
/// lifecycle messages. See [didChangeAppLifecycleState].
///
/// ```dart
/// class Reactor extends StatefulWidget {
/// const Reactor({ Key key }) : super(key: key);
///
/// @override
/// _ReactorState createState() => new _ReactorState();
/// }
///
/// class _ReactorState extends State<Reactor> with WidgetsBindingObserver {
/// @override
/// void initState() {
/// super.initState();
/// WidgetsBinding.instance.addObserver(this);
/// }
///
/// @override
/// void dispose() {
/// WidgetsBinding.instance.removeObserver(this);
/// super.dispose();
/// }
///
/// AppLifecycleState _notification;
///
/// @override
/// void didChangeAppLifecycleState(AppLifecycleState state) {
/// setState(() { _notification = state; });
/// }
///
/// @override
/// Widget build(BuildContext context) {
/// return new Text('Last notification: $_notification');
/// }
/// }
/// ```
///
/// To respond to other notifications, replace the [didChangeAppLifecycleState]
/// method above with other methods from this class.
abstract class WidgetsBindingObserver {
/// Called when the system tells the app to pop the current route.
/// For example, on Android, this is called when the user presses
......@@ -52,6 +96,56 @@ abstract class WidgetsBindingObserver {
/// Called when the application's dimensions change. For example,
/// when a phone is rotated.
///
/// ## Sample code
///
/// This [StatefulWidget] implements the parts of the [State] and
/// [WidgetsBindingObserver] protocols necessary to react when the device is
/// rotated (or otherwise changes dimensions).
///
/// ```dart
/// class Reactor extends StatefulWidget {
/// const Reactor({ Key key }) : super(key: key);
///
/// @override
/// _ReactorState createState() => new _ReactorState();
/// }
///
/// class _ReactorState extends State<Reactor> with WidgetsBindingObserver {
/// @override
/// void initState() {
/// super.initState();
/// WidgetsBinding.instance.addObserver(this);
/// }
///
/// @override
/// void dispose() {
/// WidgetsBinding.instance.removeObserver(this);
/// super.dispose();
/// }
///
/// Size _lastSize;
///
/// @override
/// void didChangeMetrics() {
/// setState(() { _lastSize = ui.window.physicalSize; });
/// }
///
/// @override
/// Widget build(BuildContext context) {
/// return new Text('Last size: $_lastSize');
/// }
/// }
/// ```
///
/// In general, this is unnecessary as the layout system takes care of
/// automatically recomputing the application geometry when the application
/// size changes.
///
/// See also:
///
/// * [MediaQuery.of], which provides a similar service with less
/// boilerplate.
void didChangeMetrics() { }
/// Called when the system tells the app that the user's locale has
......@@ -61,6 +155,9 @@ abstract class WidgetsBindingObserver {
/// Called when the system puts the app in the background or returns
/// the app to the foreground.
///
/// An example of implementing this method is provided in the class-level
/// documentation for the [WidgetsBindingObserver] class.
void didChangeAppLifecycleState(AppLifecycleState state) { }
/// Called when the system is running low on memory.
......@@ -159,11 +256,21 @@ abstract class WidgetsBinding extends BindingBase with GestureBinding, RendererB
/// [MediaQuery.of] static method and (implicitly) the
/// [InheritedWidget] mechanism to be notified whenever the screen
/// size changes (e.g. whenever the screen rotates).
///
/// See also:
///
/// * [removeObserver], to release the resources reserved by this method.
/// * [WidgetsBindingObserver], which has an example of using this method.
void addObserver(WidgetsBindingObserver observer) => _observers.add(observer);
/// Unregisters the given observer. This should be used sparingly as
/// it is relatively expensive (O(N) in the number of registered
/// observers).
///
/// See also:
///
/// * [addObserver], for the method that adds observers in the first place.
/// * [WidgetsBindingObserver], which has an example of using this method.
bool removeObserver(WidgetsBindingObserver observer) => _observers.remove(observer);
/// Called when the system metrics change.
......
......@@ -146,7 +146,7 @@ class DecoratedBox extends SingleChildRenderObjectWidget {
/// The [constraints] are set to fit the font size plus ample headroom
/// vertically, while expanding horizontally to fit the parent. The [padding] is
/// used to make sure there is space between the contents and the text. The
/// [color] makes the box teal. The [alignment] causes the [child] to be
/// `color` makes the box teal. The [alignment] causes the [child] to be
/// centered in the box. The [foregroundDecoration] overlays a nine-patch image
/// onto the text. Finally, the [transform] applies a slight rotation to the
/// entire contraption to complete the effect.
......
......@@ -1452,7 +1452,7 @@ abstract class ParentDataWidget<T extends RenderObjectWidget> extends ProxyWidge
///
/// Sometimes, the `of` method returns the data rather than the inherited
/// widget; for example, in this case it could have returned a [Color] instead
/// of the [FrogColor] widget.
/// of the `FrogColor` widget.
///
/// Occasionally, the inherited widget is an implementation detail of another
/// class, and is therefore private. The `of` method in that case is typically
......
......@@ -25,6 +25,15 @@ export 'package:flutter/services.dart' show
///
/// This is the object that must be passed to [BoxPainter.paint] and to
/// [ImageProvider.resolve].
///
/// If this is not called from a build method, then it should be reinvoked
/// whenever the dependencies change, e.g. by calling it from
/// [State.didChangeDependencies], so that any changes in the environement are
/// picked up (e.g. if the device pixel ratio changes).
///
/// See also:
///
/// * [ImageProvider], which has an example showing how this might be used.
ImageConfiguration createLocalImageConfiguration(BuildContext context, { Size size }) {
return new ImageConfiguration(
bundle: DefaultAssetBundle.of(context),
......
......@@ -13,7 +13,7 @@ import 'framework.dart';
/// widgets along a horizontal axis that's sensible for an application's
/// navigation bar such as in Material Design and in iOS.
///
/// [leading] and [trailing] widgets occupy the edges of the widget with
/// The [leading] and [trailing] widgets occupy the edges of the widget with
/// reasonable size constraints while the [middle] widget occupies the remaining
/// space in either a center aligned or start aligned fashion.
///
......@@ -21,6 +21,8 @@ import 'framework.dart';
/// the iOS [CupertinoNavigationBar] or wrap this widget with more theming
/// specifications for your own custom app bar.
class NavigationToolbar extends StatelessWidget {
/// Creates a widget that lays out its children in a manner suitable for a
/// toolbar.
const NavigationToolbar({
Key key,
this.leading,
......
......@@ -25,6 +25,11 @@ import 'sliver.dart';
import 'ticker_provider.dart';
/// Signature used by [NestedScrollView] for building its header.
///
/// The `innerBoxIsScrolled` argument is typically used to control the
/// [SliverAppBar.forceElevated] property to ensure that the app bar shows a
/// shadow, since it would otherwise not necessarily be aware that it had
/// content ostensibly below it.
typedef List<Widget> NestedScrollViewHeaderSliversBuilder(BuildContext context, bool innerBoxIsScrolled);
// TODO(abarth): Make this configurable with a controller.
......@@ -73,8 +78,18 @@ class NestedScrollView extends StatefulWidget {
/// Defaults to matching platform conventions.
final ScrollPhysics physics;
/// A builder for any widgets that are to precede the inner scroll views (as
/// given by [body]).
///
/// Typically this is used to create a [SliverAppBar] with a [TabBar].
final NestedScrollViewHeaderSliversBuilder headerSliverBuilder;
/// The widget to show inside the [NestedScrollView].
///
/// Typically this will be [TabBarView].
///
/// The [body] is built in a context that provides a [PrimaryScrollController]
/// that interacts with the [NestedScrollView]'s scroll controller.
final Widget body;
List<Widget> _buildSlivers(BuildContext context, ScrollController innerController, bool bodyIsScrolled) {
......
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:math' as math;
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
......@@ -171,4 +173,26 @@ void main() {
final Matrix4 transform = layer.transform;
expect(transform.getTranslation(), equals(new Vector3(100.0, 75.0, 0.0)));
});
testWidgets('Transform.rotate', (WidgetTester tester) async {
await tester.pumpWidget(
new Transform.rotate(
angle: math.PI / 2.0,
child: new Opacity(opacity: 0.5, child: new Container()),
),
);
final List<Layer> layers = tester.layers
..retainWhere((Layer layer) => layer is TransformLayer);
expect(layers.length, 2);
// The first transform is from the render view.
final TransformLayer layer = layers[1];
final Matrix4 transform = layer.transform;
expect(transform.storage, <dynamic>[
moreOrLessEquals(0.0), 1.0, 0.0, 0.0,
-1.0, moreOrLessEquals(0.0), 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
700.0, -100.0, 0.0, 1.0,
]);
});
}
......@@ -16,7 +16,6 @@ class GetHealth extends Command {
GetHealth.deserialize(Map<String, String> json) : super.deserialize(json);
}
/// Application health status.
enum HealthStatus {
/// Application is known to be in a good shape and should be able to respond.
ok,
......@@ -28,7 +27,6 @@ enum HealthStatus {
final EnumIndex<HealthStatus> _healthStatusIndex =
new EnumIndex<HealthStatus>(HealthStatus.values);
/// Application health status.
class Health extends Result {
/// Creates a [Health] object with the given [status].
Health(this.status) {
......@@ -40,7 +38,6 @@ class Health extends Result {
return new Health(_healthStatusIndex.lookupBySimpleName(json['status']));
}
/// Health status
final HealthStatus status;
@override
......
......@@ -17,7 +17,7 @@ import 'package:flutter/widgets.dart';
/// one, for example the results of calling `where` on this iterable
/// are also cached.
Iterable<Element> collectAllElementsFrom(Element rootElement, {
@required bool skipOffstage
@required bool skipOffstage,
}) {
return new CachingIterable<Element>(new _DepthFirstChildIterator(rootElement, skipOffstage));
}
......
......@@ -89,6 +89,10 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
// Services binding omitted to avoid dragging in the licenses code.
WidgetsBinding {
/// Constructor for [TestWidgetsFlutterBinding].
///
/// This constructor overrides the [debugPrint] global hook to point to
/// [debugPrintOverride], which can be overridden by subclasses.
TestWidgetsFlutterBinding() {
debugPrint = debugPrintOverride;
}
......
......@@ -236,6 +236,9 @@ abstract class Finder {
/// [Offstage] widgets, as well as children of inactive [Route]s.
final bool skipOffstage;
/// Returns all the [Element]s that will be considered by this finder.
///
/// See [collectAllElementsFrom].
@protected
Iterable<Element> get allCandidates {
return collectAllElementsFrom(
......
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