ResponsiveScaffold class

A simplistic animated responsive Scaffold.

Q: Is this Flexfold? A: No, it is not, this is simpler, but feel free to use it.

This is just a straw-man for a "real" responsive animated Scaffold. It can give you some ideas about how you can make a simple one. It has hard coded menu and items, but you could easily make them and many other things configurable properties too.

About the animated menu solution for this menu. I wanted to test if it could be built with just one single implicit AnimatedContainer. As can be seen it can. I thought it would be simpler than using more explicit animation controllers. Turned out getting hold of widths and states got very cumbersome and complex, not really an approach I recommend, but an interesting experiment.

This is not really a Flutter "Universal" Widget that only depends on the SDK, it also depends on another widget in the project the universal MaybeTooltip. It of course also contains code that is not reusable since it is app specific. Hence the 'app' level widget classification. This widget could however easily be made "universal" and become quite useful.

(c) BSD 3-clause - Mike Rydstrom (@RydMike)

Inheritance

Constructors

ResponsiveScaffold({Key? key, Widget? title, Widget? menuTitle, ValueChanged<String>? onSelect, double railWidth = _kRailWidth, double menuWidth = _kMenuWidth, double breakpointShowFullMenu = _kBreakpointShowFullMenu, Widget? body, Widget? floatingActionButton, FloatingActionButtonLocation? floatingActionButtonLocation, FloatingActionButtonAnimator? floatingActionButtonAnimator, List<Widget>? persistentFooterButtons, DrawerCallback? onDrawerChanged, Widget? endDrawer, DrawerCallback? onEndDrawerChanged, Widget? bottomNavigationBar, Widget? bottomSheet, Color? backgroundColor, bool? resizeToAvoidBottomInset, 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, required List<MenuItemInfo> menuItems, Widget? menuFooter, Widget? menuHeader, AppBar? appBar, String? currentSelectedMenuItemId})
const

Properties

appBar AppBar?
An app bar to display at the top of the scaffold.
final
backgroundColor Color?
The color of the Material widget that underlies the entire Scaffold.
final
body Widget?
The primary content of the scaffold.
final
bottomNavigationBar Widget?
A bottom navigation bar to display at the bottom of the scaffold.
final
bottomSheet Widget?
The persistent bottom sheet to display.
final
breakpointShowFullMenu double
Breakpoint when we want to show the full sized menu.
final
currentSelectedMenuItemId String?
final
drawerDragStartBehavior DragStartBehavior
Configuration of offset passed to DragStartDetails.
final
drawerEdgeDragWidth double?
The width of the area within which a horizontal swipe will open the drawer.
final
drawerEnableOpenDragGesture bool
Determines if the Scaffold.drawer can be opened with a drag gesture.
final
drawerScrimColor Color?
The color to use for the scrim that obscures primary content while a drawer is open.
final
endDrawer Widget?
A panel displayed to the side of the body, often hidden on mobile devices. Swipes in from right-to-left (TextDirection.ltr) or left-to-right (TextDirection.rtl)
final
endDrawerEnableOpenDragGesture bool
Determines if the Scaffold.endDrawer can be opened with a drag gesture.
final
extendBody bool
If true, and bottomNavigationBar or persistentFooterButtons is specified, then the body extends to the bottom of the Scaffold, instead of only extending to the top of the bottomNavigationBar or the persistentFooterButtons.
final
extendBodyBehindAppBar bool
If true, and an AppBar is specified, then the height of the body is extended to include the height of the app bar and the top of the body is aligned with the top of the app bar.
final
floatingActionButton Widget?
A button displayed floating above body, in the bottom right corner.
final
floatingActionButtonAnimator FloatingActionButtonAnimator?
Animator to move the floatingActionButton to a new floatingActionButtonLocation.
final
floatingActionButtonLocation FloatingActionButtonLocation?
Responsible for determining where the floatingActionButton should go.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
Widget rendered after the MenuItem list
final
Widget rendered before the MenuItem list
final
final
The widget displayed in the app bar on the menu as app title or a logo.
final
The width of the menu when it is full sized.
final
onDrawerChanged DrawerCallback?
Optional callback that is called when the Scaffold.drawer is opened or closed.
final
onEndDrawerChanged DrawerCallback?
Optional callback that is called when the Scaffold.endDrawer is opened or closed.
final
onSelect ValueChanged<String>?
Callback called with menu item id when user taps on a menu item.
final
persistentFooterButtons List<Widget>?
A set of buttons that are displayed at the bottom of the scaffold.
final
primary bool
Whether this scaffold is being displayed at the top of the screen.
final
railWidth double
The width of the menu when it is rail sized.
final
resizeToAvoidBottomInset bool?
If true the body and the scaffold's floating widgets should size themselves to avoid the onscreen keyboard whose height is defined by the ambient MediaQuery's MediaQueryData.viewInsets bottom property.
final
restorationId String?
Restoration ID to save and restore the state of the Scaffold.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
title Widget?
The primary widget displayed in the app bar, just you normal AppBar title.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _ResponsiveScaffoldState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited