diff --git a/packages/flutter/lib/src/material/bottom_app_bar_theme.dart b/packages/flutter/lib/src/material/bottom_app_bar_theme.dart index 647673be9ef..38f98953570 100644 --- a/packages/flutter/lib/src/material/bottom_app_bar_theme.dart +++ b/packages/flutter/lib/src/material/bottom_app_bar_theme.dart @@ -16,7 +16,7 @@ import 'theme.dart'; /// Defines default property values for descendant [BottomAppBar] widgets. /// /// Descendant widgets obtain the current [BottomAppBarThemeData] object using -/// `[BottomAppBarTheme.of]`. Instances of [BottomAppBarThemeData] can be +/// [BottomAppBarTheme.of]. Instances of [BottomAppBarThemeData] can be /// customized with [BottomAppBarThemeData.copyWith]. /// /// Typically a [BottomAppBarThemeData] is specified as part of the overall [Theme] diff --git a/packages/flutter/lib/src/material/bottom_navigation_bar_theme.dart b/packages/flutter/lib/src/material/bottom_navigation_bar_theme.dart index cbc5d177269..96bc66e7268 100644 --- a/packages/flutter/lib/src/material/bottom_navigation_bar_theme.dart +++ b/packages/flutter/lib/src/material/bottom_navigation_bar_theme.dart @@ -17,7 +17,7 @@ import 'theme.dart'; /// widgets. /// /// Descendant widgets obtain the current [BottomNavigationBarThemeData] object -/// using `BottomNavigationBarTheme.of(context)`. Instances of +/// using [BottomNavigationBarTheme.of]. Instances of /// [BottomNavigationBarThemeData] can be customized with /// [BottomNavigationBarThemeData.copyWith]. /// diff --git a/packages/flutter/lib/src/material/card.dart b/packages/flutter/lib/src/material/card.dart index 5f37916f308..3d397fe0eaa 100644 --- a/packages/flutter/lib/src/material/card.dart +++ b/packages/flutter/lib/src/material/card.dart @@ -131,7 +131,7 @@ class Card extends StatelessWidget { /// The color to paint the shadow below the card. /// - /// If null then the ambient [CardTheme]'s shadowColor is used. + /// If null then the ambient [CardThemeData.shadowColor] is used. /// If that's null too, then the overall theme's [ThemeData.shadowColor] /// (default black) is used. final Color? shadowColor; @@ -158,16 +158,16 @@ class Card extends StatelessWidget { /// /// Defines the card's [Material.elevation]. /// - /// If this property is null then [CardTheme.elevation] of - /// [ThemeData.cardTheme] is used. If that's null, the default value is 1.0. + /// If this property is null then the ambient [CardThemeData.elevation] is + /// used. If that's null, the default value is 1.0. final double? elevation; /// The shape of the card's [Material]. /// /// Defines the card's [Material.shape]. /// - /// If this property is null then [CardTheme.shape] of [ThemeData.cardTheme] - /// is used. If that's null then the shape will be a [RoundedRectangleBorder] + /// If this property is null then the ambient [CardThemeData.shape] is used. + /// If that's null then the shape will be a [RoundedRectangleBorder] /// with a circular corner radius of 12.0 and if [ThemeData.useMaterial3] is /// false, then the circular corner radius will be 4.0. final ShapeBorder? shape; @@ -180,17 +180,17 @@ class Card extends StatelessWidget { /// {@macro flutter.material.Material.clipBehavior} /// - /// If this property is null then [CardTheme.clipBehavior] of - /// [ThemeData.cardTheme] is used. If that's null then the behavior will be [Clip.none]. + /// If this property is null then the ambient [CardThemeData.clipBehavior] is + /// used. If that's null then the behavior will be [Clip.none]. final Clip? clipBehavior; /// The empty space that surrounds the card. /// /// Defines the card's outer [Container.margin]. /// - /// If this property is null then [CardTheme.margin] of - /// [ThemeData.cardTheme] is used. If that's null, the default margin is 4.0 - /// logical pixels on all sides: `EdgeInsets.all(4.0)`. + /// If this property is null then the ambient [CardThemeData.margin] is used. + /// If that's null, the default margin is 4.0 logical pixels on + /// all sides: `EdgeInsets.all(4.0)`. final EdgeInsetsGeometry? margin; /// Whether this widget represents a single semantic container, or if false diff --git a/packages/flutter/lib/src/material/card_theme.dart b/packages/flutter/lib/src/material/card_theme.dart index 505ac06a3c4..02833700f79 100644 --- a/packages/flutter/lib/src/material/card_theme.dart +++ b/packages/flutter/lib/src/material/card_theme.dart @@ -13,16 +13,19 @@ import 'package:flutter/widgets.dart'; import 'theme.dart'; +// Examples can assume: +// late BuildContext context; + /// Defines default property values for descendant [Card] widgets. /// -/// Descendant widgets obtain the current [CardTheme] object using -/// `CardTheme.of(context)`. Instances of [CardTheme] can be -/// customized with [CardTheme.copyWith]. +/// Descendant widgets obtain the current [CardThemeData] object using +/// [CardTheme.of]. Instances of [CardThemeData] can be +/// customized with [CardThemeData.copyWith]. /// -/// Typically a [CardTheme] is specified as part of the overall [Theme] +/// Typically a [CardThemeData] is specified as part of the overall [Theme] /// with [ThemeData.cardTheme]. /// -/// All [CardTheme] properties are `null` by default. When null, the [Card] +/// All [CardThemeData] properties are `null` by default. When null, the [Card] /// will use the values from [ThemeData] if they exist, otherwise it will /// provide its own defaults. /// @@ -157,7 +160,15 @@ class CardTheme extends InheritedWidget with Diagnosticable { ); } - /// The [ThemeData.cardTheme] property of the ambient [Theme]. + /// Returns the configuration [data] from the closest [CardTheme] ancestor. + /// + /// If there is no ancestor, it returns [ThemeData.cardTheme]. + /// + /// Typical usage is as follows: + /// + /// ```dart + /// CardThemeData theme = CardTheme.of(context); + /// ``` static CardThemeData of(BuildContext context) { final CardTheme? cardTheme = context.dependOnInheritedWidgetOfExactType(); return cardTheme?.data ?? Theme.of(context).cardTheme; diff --git a/packages/flutter/lib/src/material/checkbox.dart b/packages/flutter/lib/src/material/checkbox.dart index a3923751026..17f648b5940 100644 --- a/packages/flutter/lib/src/material/checkbox.dart +++ b/packages/flutter/lib/src/material/checkbox.dart @@ -352,7 +352,7 @@ class Checkbox extends StatefulWidget { /// The shape of the checkbox's [Material]. /// {@endtemplate} /// - /// If this property is null then [CheckboxThemeData.shape] of [ThemeData.checkboxTheme] + /// If this property is null then the ambient [CheckboxThemeData.shape] /// is used. If that's null then the shape will be a [RoundedRectangleBorder] /// with a circular corner radius of 1.0 in Material 2, and 2.0 in Material 3. final OutlinedBorder? shape; @@ -378,9 +378,8 @@ class Checkbox extends StatefulWidget { /// compatibility. /// {@endtemplate} /// - /// If this property is null, then [CheckboxThemeData.side] of - /// [ThemeData.checkboxTheme] is used. If that is also null, then the side - /// will be width 2. + /// If this property is null, then the ambient [CheckboxThemeData.side] is + /// used. If that is also null, then the side will be width 2. final BorderSide? side; /// {@template flutter.material.checkbox.isError} diff --git a/packages/flutter/lib/src/material/checkbox_list_tile.dart b/packages/flutter/lib/src/material/checkbox_list_tile.dart index 3af47fa43b4..bcf57bb079d 100644 --- a/packages/flutter/lib/src/material/checkbox_list_tile.dart +++ b/packages/flutter/lib/src/material/checkbox_list_tile.dart @@ -400,9 +400,8 @@ class CheckboxListTile extends StatelessWidget { /// Whether this list tile is intended to display three lines of text. /// - /// If null, the value from [ListTileThemeData.isThreeLine] is used. - /// If that is also null, the value from [ThemeData.listTileTheme] is used. - /// If still null, the default value is `false`. + /// If null then the ambient [ListTileThemeData.isThreeLine] is used. + /// If that is also null, the default value is `false`. final bool? isThreeLine; /// Whether this list tile is part of a vertically dense list. diff --git a/packages/flutter/lib/src/material/checkbox_theme.dart b/packages/flutter/lib/src/material/checkbox_theme.dart index f5f82056833..4a32c81db5c 100644 --- a/packages/flutter/lib/src/material/checkbox_theme.dart +++ b/packages/flutter/lib/src/material/checkbox_theme.dart @@ -20,7 +20,7 @@ import 'theme_data.dart'; /// Defines default property values for descendant [Checkbox] widgets. /// /// Descendant widgets obtain the current [CheckboxThemeData] object using -/// `CheckboxTheme.of(context)`. Instances of [CheckboxThemeData] can be +/// [CheckboxTheme.of]. Instances of [CheckboxThemeData] can be /// customized with [CheckboxThemeData.copyWith]. /// /// Typically a [CheckboxThemeData] is specified as part of the overall [Theme] diff --git a/packages/flutter/lib/src/material/data_table_theme.dart b/packages/flutter/lib/src/material/data_table_theme.dart index 044e840666b..bd12cfd4a2f 100644 --- a/packages/flutter/lib/src/material/data_table_theme.dart +++ b/packages/flutter/lib/src/material/data_table_theme.dart @@ -19,9 +19,8 @@ import 'theme.dart'; /// widgets. /// /// Descendant widgets obtain the current [DataTableThemeData] object -/// using `DataTableTheme.of(context)`. Instances of -/// [DataTableThemeData] can be customized with -/// [DataTableThemeData.copyWith]. +/// using [DataTableTheme.of]. Instances of [DataTableThemeData] can +/// be customized with [DataTableThemeData.copyWith]. /// /// Typically a [DataTableThemeData] is specified as part of the /// overall [Theme] with [ThemeData.dataTableTheme].