ScaffoldConfig class
A configuration class for the Scaffold widget in Flutter.
This class encapsulates all the properties and configurations typically associated
with the Scaffold widget, enabling a flexible and reusable approach to creating
scaffold layouts. It allows you to specify a wide variety of UI elements, such as
app bars, floating action buttons, drawers, bottom sheets, and more.
Example usage:
ScaffoldConfig(
appBar: AppBar(title: Text('Home')),
floatingActionButton: FloatingActionButton(onPressed: () {}),
drawer: Drawer(child: ListView(...)),
backgroundColor: Colors.white,
);
The above code creates a ScaffoldConfig that configures the AppBar, floating action button, drawer, and background color.
The toScaffold method can be used to convert this configuration into a fully constructed
Scaffold widget with a specified body content.
Properties:
- key: The key associated with the
Scaffoldwidget. - appBar: The app bar displayed at the top of the
Scaffold. - floatingActionButton: The floating action button displayed above the body.
- floatingActionButtonLocation: The location of the floating action button.
- floatingActionButtonAnimator: The animation behavior for the floating action button.
- persistentFooterButtons: A list of widgets to display as persistent footer buttons.
- drawer: The drawer displayed to the side of the
Scaffold. - onDrawerChanged: A callback invoked when the drawer is opened or closed.
- endDrawer: The end drawer displayed on the opposite side of the
Scaffold. - onEndDrawerChanged: A callback invoked when the end drawer is opened or closed.
- bottomNavigationBar: The bottom navigation bar to display.
- bottomSheet: The bottom sheet to display.
- backgroundColor: The background color of the
Scaffold. - resizeToAvoidBottomInset: Whether the
Scaffoldshould resize when the keyboard appears. - primary: Whether the
Scaffoldis the primary scrollable area of the app. - drawerDragStartBehavior: The drag behavior for the drawer.
- extendBody: Whether the body of the
Scaffoldextends into the floating action button area. - extendBodyBehindAppBar: Whether the body of the
Scaffoldextends behind the app bar. - drawerScrimColor: The scrim color for the drawer when it is open.
- drawerEdgeDragWidth: The width of the area that triggers the drawer to open.
- drawerEnableOpenDragGesture: Whether the drawer can be opened with a drag gesture.
- endDrawerEnableOpenDragGesture: Whether the end drawer can be opened with a drag gesture.
- restorationId: The restoration ID for state restoration.
Constructors
- ScaffoldConfig({Key? key, PreferredSizeWidget? appBar, Widget? floatingActionButton, FloatingActionButtonLocation? floatingActionButtonLocation, FloatingActionButtonAnimator? floatingActionButtonAnimator, Widget? drawer, void onDrawerChanged(bool)?, Widget? endDrawer, void onEndDrawerChanged(bool)?, Widget? bottomSheet, Color? backgroundColor, bool resizeToAvoidBottomInset = true, bool primary = true, DragStartBehavior drawerDragStartBehavior = DragStartBehavior.start, bool extendBody = false, bool extendBodyBehindAppBar = false, Color? drawerScrimColor, double? drawerEdgeDragWidth, bool drawerEnableOpenDragGesture = true, bool endDrawerEnableOpenDragGesture = true, String? restorationId})
-
Constructor for ScaffoldConfig.
const
Properties
- appBar → PreferredSizeWidget?
-
The app bar displayed at the top of the Scaffold.
final
- backgroundColor → Color?
-
The background color of the Scaffold.
final
-
The bottom navigation bar to display.
final
- bottomSheet → Widget?
-
The bottom sheet to display.
final
- drawer → Widget?
-
The drawer displayed to the side of the Scaffold.
final
- drawerDragStartBehavior → DragStartBehavior
-
The drag behavior for the drawer.
final
- drawerEdgeDragWidth → double?
-
The width of the area that triggers the drawer to open.
final
- drawerEnableOpenDragGesture → bool
-
Whether the drawer can be opened with a drag gesture.
final
- drawerScrimColor → Color?
-
The scrim color for the drawer when it is open.
final
- endDrawer → Widget?
-
The end drawer displayed on the opposite side of the Scaffold.
final
- endDrawerEnableOpenDragGesture → bool
-
Whether the end drawer can be opened with a drag gesture.
final
- extendBody → bool
-
Whether the body of the Scaffold extends into the Scaffold.floatingActionButton area.
final
- extendBodyBehindAppBar → bool
-
Whether the body of the Scaffold extends behind the app bar.
final
- floatingActionButton → Widget?
-
The floating action button displayed above the body.
final
- floatingActionButtonAnimator → FloatingActionButtonAnimator?
-
The animation behavior for the floating action button.
final
- floatingActionButtonLocation → FloatingActionButtonLocation?
-
The location of the floating action button.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
The key associated with the Scaffold widget.
final
- onDrawerChanged → void Function(bool)?
-
A callback invoked when the drawer is opened or closed.
final
- onEndDrawerChanged → void Function(bool)?
-
A callback invoked when the end drawer is opened or closed.
final
-
A list of widgets to display as persistent footer buttons.
final
- primary → bool
-
Whether the Scaffold is the primary scrollable area of the app.
final
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setteroverride
- resizeToAvoidBottomInset → bool
-
Whether the Scaffold should resize when the keyboard appears.
final
- restorationId → String?
-
The restoration ID for state restoration.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true, the toString method will be overridden to output this instance's props.no setterinherited
Methods
-
copyWith(
{PreferredSizeWidget? appBar, Key? key, Widget? floatingActionButton, FloatingActionButtonLocation? floatingActionButtonLocation, FloatingActionButtonAnimator? floatingActionButtonAnimator, Widget? drawer, void onDrawerChanged(bool)?, Widget? endDrawer, void onEndDrawerChanged(bool)?, Widget? bottomSheet, Color? backgroundColor, bool? resizeToAvoidBottomInset, bool? primary, DragStartBehavior? drawerDragStartBehavior, bool? extendBody, bool? extendBodyBehindAppBar, Color? drawerScrimColor, double? drawerEdgeDragWidth, bool? drawerEnableOpenDragGesture, bool? endDrawerEnableOpenDragGesture, String? restorationId}) → ScaffoldConfig - Creates a copy of the current ScaffoldConfig with the provided changes.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toScaffold(
Widget body) → Scaffold - Converts the configuration into a fully constructed Scaffold widget.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited