mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Update several comments related to theme normalization (#179457)
## Description This PR updates some comments in various widgets to reflect the changes related to Theme normalization. ## Related Issue Related to https://github.com/flutter/flutter/issues/91772 ## Tests - Documentation only
This commit is contained in:
parent
362b1de299
commit
2296b2b2a2
@ -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]
|
||||
|
||||
@ -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].
|
||||
///
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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<CardTheme>();
|
||||
return cardTheme?.data ?? Theme.of(context).cardTheme;
|
||||
|
||||
@ -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}
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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].
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user