WoltModalSheetPage class
WoltModalSheetPage is a specialized subclass of SliverWoltModalSheetPage, designed for scenarios where the main content of a modal sheet is a single non-sliver widget. This class provides a convenient shortcut for creating a modal sheet page with standard box widgets, encapsulating them in a sliver-compatible format.
This class is particularly useful when:
- The content of the modal sheet is simple and does not require the complex scroll behaviors or layout structures that slivers enable.
- You need to quickly wrap a single widget, such as a container or a column, within a modal sheet without the need to manually convert it into a sliver.
Key Features:
- Simplification: Streamlines the process of embedding standard Flutter widgets
within a scrollable modal sheet, by automatically wrapping the provided
child
widget in aSliverToBoxAdapter
. - Consistency: Maintains the layered structure and behavior established by
SliverWoltModalSheetPage
, ensuring a consistent user experience across different types of modal sheet pages. - Flexibility: Allows for easy customization and inclusion of common modal sheet elements such as top bars, navigation bars, hero images, and action bars.
Usage Example:
WoltModalSheetPage(
child: MyCustomContentWidget(),
pageTitle: Text('My Page Title'),
// Other properties...
)
This creates a modal sheet page with MyCustomContentWidget
as the main content,
wrapped in a sliver to seamlessly integrate with the scrolling behavior of the modal sheet.
See also:
- SliverWoltModalSheetPage, for more complex pages that require multiple slivers.
- SliverToBoxAdapter, the underlying widget used to wrap the
child
in a sliver.
- Inheritance
-
- Object
- SliverWoltModalSheetPage
- WoltModalSheetPage
Constructors
- WoltModalSheetPage.new({required Widget child, Object? id, Widget? pageTitle, Widget? topBarTitle, Widget? heroImage, double? heroImageHeight, Color? backgroundColor, Color? surfaceTintColor, bool? hasSabGradient, Color? sabGradientColor, bool? enableDrag, bool forceMaxHeight = false, bool? resizeToAvoidBottomInset, bool? isTopBarLayerAlwaysVisible, bool? hasTopBarLayer, ScrollController? scrollController, Widget? stickyActionBar, Widget? topBar, bool? useSafeArea})
- Creates a WoltModalSheetPage with a single child main content.
Properties
- backgroundColor → Color?
-
The background color of the page.
finalinherited
- child → Widget
-
A Widget that represents the main content displayed in the page.
This is a shortcut for providing a list of Sliver widgets with only one Sliver widget.
final
- enableDrag → bool?
-
Controls the draggability of the bottom sheet. This setting overrides the value provided
via WoltModalSheet.show specifically for this page when the modal is displayed as a bottom sheet.
finalinherited
- forceMaxHeight → bool
-
Indicates whether the page height should be at maximum even if the content size is smaller.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasSabGradient → bool?
-
Indicates whether a gentle gradient overlay should be rendered above the
stickyActionBar. The purpose of this gradient is to visually suggest
to the user that additional content might be present below the action bar.
finalinherited
- hasTopBarLayer → bool?
-
On z axis, the Top Bar layer resides above the main content layer and below the transparent
navigation bar layer.
finalinherited
- heroImage → Widget?
-
A Widget representing the hero image displayed on top of the main content. A Hero Image
is positioned at the top of the main content. This widget immediately grabs the user's
attention, effectively conveying the primary theme or message of the content.
finalinherited
- heroImageHeight → double?
-
The height of the heroImage.
finalinherited
- id → Object?
-
An object representing the identity of this page.
finalinherited
- isTopBarLayerAlwaysVisible → bool?
-
Indicates whether the top bar should always remain visible, regardless of the page scroll
position. When set to true, the top bar will be permanently displayed; when false, it may
be hidden or revealed based on the page's scrolling behavior.
finalinherited
-
A widget representing leading widget in the navigation toolbar. This widget is usually
a the back button.
finalinherited
-
mainContentSliversBuilder
→ List<
Widget> Function(BuildContext context) -
Use this method to dynamically build the list of sliver widgets within the modal sheet
based on the available BuildContext. This approach is more flexible and recommended
for most use cases.
finalinherited
-
Height of the navigation bar. This value will also be the height of the top bar.
finalinherited
- pageTitle → Widget?
-
Represents the widget that stands for the page title. A page title above the main content
provides users with a quick understanding of what to expect from the page. As the user
scrolls, this title becomes hidden, at which point the top bar title continues to serve
this context-providing purpose.
finalinherited
- resizeToAvoidBottomInset → bool?
-
If there is an onscreen keyboard displayed above the
modal sheet, the main content can be resized to avoid overlapping the keyboard, which
prevents widgets inside the main content from being obscured by the keyboard.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sabGradientColor → Color?
-
The color of the gentle gradient overlay that is rendered above the stickyActionBar. The
purpose of this gradient is to visually suggest to the user that additional content might
be present below the action bar.
finalinherited
- scrollController → ScrollController?
-
A ScrollController that controls the scrolling behavior of the page.
finalinherited
- stickyActionBar → Widget?
-
A widget representing the action widgets located at the bottom of the page.
finalinherited
- surfaceTintColor → Color?
-
The color of the surface tint overlay applied to the material color
to indicate elevation for the modal sheet page. The surfaceTintColor is applied to the
modal sheet background color, top bar color, and the sticky action bar wrapper colors.
finalinherited
- topBar → Widget?
-
An optional Widget representing the top bar.
finalinherited
- topBarTitle → Widget?
-
A Widget representing the title displayed in the top bar.
finalinherited
-
A widget representing trailing widget in the navigation toolbar. This widget is usually
a the close button.
finalinherited
- useSafeArea → bool?
-
A boolean that determines whether the modal should avoid system UI intrusions such as the
notch and system gesture areas.
finalinherited
Methods
-
copyWith(
{Object? id, Widget? pageTitle, Widget? topBarTitle, Widget? topBar, bool? hasTopBarLayer, bool? isTopBarLayerAlwaysVisible, List< Widget> mainContentSliversBuilder(BuildContext context)?, Widget? heroImage, double? heroImageHeight, Color? backgroundColor, Color? surfaceTintColor, bool? forceMaxHeight, ScrollController? scrollController, Widget? stickyActionBar, bool? hasSabGradient, bool? enableDrag, Color? sabGradientColor, bool? resizeToAvoidBottomInset, bool? useSafeArea}) → SliverWoltModalSheetPage -
inherited
-
copyWithChild(
{required Widget child, Object? id, Widget? pageTitle, Widget? topBarTitle, Widget? topBar, bool? hasTopBarLayer, bool? isTopBarLayerAlwaysVisible, Widget? heroImage, double? heroImageHeight, Color? backgroundColor, Color? surfaceTintColor, bool? forceMaxHeight, ScrollController? scrollController, Widget? stickyActionBar, bool? hasSabGradient, bool? enableDrag, Color? sabGradientColor, bool? resizeToAvoidBottomInset, bool? useSafeArea}) → SliverWoltModalSheetPage -
Creates a SliverWoltModalSheetPage from a page whose main content is provided as a single
widget.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited