/// A Material Design bottom sheet.
///
/// There are two kinds of bottom sheets in Material Design:
///
/// * _Persistent_. A persistent bottom sheet shows information that
/// supplements the primary content of the app. A persistent bottom sheet
/// remains visible even when the user interacts with other parts of the app.
/// Persistent bottom sheets can be created and displayed with the
/// [ScaffoldState.showBottomSheet] function or by specifying the
/// [Scaffold.bottomSheet] constructor parameter.
///
/// * _Modal_. A modal bottom sheet is an alternative to a menu or a dialog and
/// prevents the user from interacting with the rest of the app. Modal bottom
/// sheets can be created and displayed with the [showModalBottomSheet]
/// function.
///
/// The [BottomSheet] widget itself is rarely used directly. Instead, prefer to
/// create a persistent bottom sheet with [ScaffoldState.showBottomSheet] or
/// [Scaffold.bottomSheet], and a modal bottom sheet with [showModalBottomSheet].
///
/// See also:
///
/// * [showBottomSheet] and [ScaffoldState.showBottomSheet], for showing
/// non-modal "persistent" bottom sheets.
/// * [showModalBottomSheet], which can be used to display a modal bottom
/// sheet.
/// * [BottomSheetThemeData], which can be used to customize the default
/// bottom sheet property values.
/// * The Material 2 spec at <https://m2.material.io/components/sheets-bottom>.
/// * The Material 3 spec at <https://m3.material.io/components/bottom-sheets/overview>.
class BottomSheet extends StatefulWidget {
/// Creates a bottom sheet.
///
/// Typically, bottom sheets are created implicitly by
/// [ScaffoldState.showBottomSheet], for persistent bottom sheets, or by
/// [showModalBottomSheet], for modal bottom sheets.
const BottomSheet({
super.key,
this.animationController,
this.enableDrag = true,
this.showDragHandle,
this.dragHandleColor,
this.dragHandleSize,
this.onDragStart,
this.onDragEnd,
this.backgroundColor,
this.shadowColor,
this.elevation,
this.shape,
this.clipBehavior,
this.constraints,
required this.onClosing,
required this.builder,
}) : assert(elevation == null || elevation >= 0.0);
A Material Design bottom sheet.
一个 Material 设计的底部纸片控件
There are two kinds of bottom sheets in Material Design:
他们在 Matrial 设计有两种底部纸片类型:
A persistent bottom sheet shows information that supplements the primary content of the app.
一个持续的底部纸片为App展示主要内容的补充信息
A persistent bottom sheet remains visible even when the user interacts with other parts of the app
一个持续的底部纸片仍然是可见的当用户与app的其他部分交互时
Persistent bottom sheets can be created and displayed with the [ScaffoldState.showBottomSheet] function or by specifying the [Scaffold.bottomSheet] constructor parameter.
持续的底部纸片能够通过[ScaffoldState.showBottomSheet]函数和有明确参数 [Scaffold.bottomSheet]的构造方法创建和展示
A modal bottom sheet is an alternative to a menu or a dialog and prevents the user from interacting with the rest of the app. Modal bottom sheets can be created and displayed with the [showModalBottomSheet] function.
模态底部纸片是一个菜单或弹窗的替代选项,阻止用户与App的其他部分交互,模态底部纸片能够被[showModalBottomSheet] 函数创建和展示
The [BottomSheet] widget itself is rarely used directly. Instead, prefer to create a persistent bottom sheet with [ScaffoldState.showBottomSheet] or
[Scaffold.bottomSheet], and a modal bottom sheet with [showModalBottomSheet].
底部纸片控件本身很少直接使用,相反,更喜欢使用[ScaffoldState.showBottomSheet]或[Scaffold.bottomSheet]创建一个持续的底部纸片,[showModalBottomSheet]创建一个模态底部纸片。
[BottomSheetThemeData], which can be used to customize the default bottom sheet property values.
[BottomSheetThemeData],可以用来自定义底部纸片的默认参数