bottomSheetTheme static method

BottomSheetThemeData bottomSheetTheme({
  1. Color? backgroundColor,
  2. Color? modalBackgroundColor,
  3. double? elevation,
  4. double? modalElevation,
  5. double? radius,
  6. Clip? clipBehavior,
  7. BoxConstraints? constraints,
  8. Color? shadowColor,
  9. Color? surfaceTintColor,
})

A theme helper for BottomSheetThemeData for customizing the theme for BottomSheet.

Corner radius defaults to kBottomSheetBorderRadius = 28, elevation to kBottomSheetElevation = 4 and modalElevation to kBottomSheetModalElevation = 8.

The named parameters are:

If null, defaults to Flutter's default, which is theme canvas color in M2 mode and surfaceContainerLow in M3 mode.

If null, defaults to Flutter's default, which is theme canvas color in M2 mode and surfaceContainerLow in M3 mode.

  • elevation The none modal bottom sheet elevation.

If null, defaults to kBottomSheetElevation = 1.

  • modalElevation The modal bottom sheet elevation.

If null, defaults to kBottomSheetModalElevation = 2.

  • radius The corner radius of the top corners.

If not defined, defaults to kBottomSheetBorderRadius 28p.

Follows Material M3 guide as default value. https://m3.material.io/components/bottom-sheets/specs

Use this property to enable clipping of content when the bottom sheet has a custom shape and the content can extend past this shape. For example, a bottom sheet with rounded corners and an edge-to-edge Image at the top.

If this property is null then then the behavior will be Clip.none, via Flutter's default values.

If null, the bottom sheet's size will be unconstrained.

  • shadowColor Overrides the default value of BottomSheet.shadowColor.

  • surfaceTintColor Overrides the default value for surfaceTintColor.

See Material.surfaceTintColor for more details.

Implementation

static BottomSheetThemeData bottomSheetTheme({
  /// Default value for [BottomSheet.backgroundColor].
  ///
  /// If null, defaults to Flutter's default, which is theme canvas color in
  /// M2 mode and surfaceContainerLow in M3 mode.
  final Color? backgroundColor,

  /// Value for [BottomSheet.backgroundColor] when the Bottom sheet is
  /// presented as a modal bottom sheet.
  ///
  /// If null, defaults to Flutter's default, which is theme canvas color in
  /// M2 mode and surfaceContainerLow in M3 mode.
  final Color? modalBackgroundColor,

  /// The none modal bottom sheet elevation.
  ///
  /// If null, defaults to [kBottomSheetElevation] = 1.
  final double? elevation,

  /// The modal bottom sheet elevation.
  ///
  /// If null, defaults to [kBottomSheetModalElevation] = 2.
  final double? modalElevation,

  /// The corner radius of the top corners.
  ///
  /// If not defined, defaults to [kBottomSheetBorderRadius] 28p.
  ///
  /// Follows Material M3 guide as default value.
  /// https://m3.material.io/components/bottom-sheets/specs
  final double? radius,

  /// Defines the bottom sheet's [Material.clipBehavior]
  /// by overriding the default value for [BottomSheet.clipBehavior].
  ///
  /// Use this property to enable clipping of content when the bottom sheet
  /// has a custom [shape] and the content can extend past this shape.
  /// For example, a bottom sheet with rounded corners and an edge-to-edge
  /// [Image] at the top.
  ///
  /// If this property is null then then the behavior will be [Clip.none],
  /// via Flutter's default values.
  final Clip? clipBehavior,

  /// Constrains the size of the [BottomSheet].
  ///
  /// If null, the bottom sheet's size will be unconstrained.
  final BoxConstraints? constraints,

  /// Overrides the default value of [BottomSheet.shadowColor].
  final Color? shadowColor,

  /// Overrides the default value for surfaceTintColor.
  ///
  /// See [Material.surfaceTintColor] for more details.
  final Color? surfaceTintColor,
}) =>
    _bottomSheetTheme(
      backgroundColor: backgroundColor,
      modalBackgroundColor: modalBackgroundColor,
      elevation: elevation,
      modalElevation: modalElevation,
      radius: radius,
      clipBehavior: clipBehavior,
      constraints: constraints,
      shadowColor: shadowColor,
      surfaceTintColor: surfaceTintColor,
    );