ScreenLayout<S extends Screen> class
abstract
The base class for all layouts returned by Screen.buildMobilePortrait, Screen.buildMobileLandscape, Screen.buildTabletPortrait, and Screen.buildTabletLandscape.
Extends ScreenLayout the same way you would extend State: override build, lifecycle hooks (initState, dispose, etc.), and access the owning screen via screen — no constructor parameter required.
class HomePortraitLayout extends ScreenLayout<HomeScreen> {
const HomePortraitLayout({super.key});
@override
void initState() {
// screen is available here
screen.data.load();
}
@override
Widget build(BuildContext context, HomeScreen screen) {
return Text('count: ${screen.data.counter}');
}
@override
void dispose() {
screen.data.cancel();
}
}
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ScreenLayout
Constructors
- ScreenLayout({Key? key})
-
const
Properties
- context → BuildContext
-
The BuildContext for this layout.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- mounted → bool
-
Whether this layout is currently mounted in the widget tree.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- screen → S
-
The owning Screen instance, automatically resolved from the widget tree.
no setter
Methods
-
activate(
) → void - Called when this layout is reinserted after deactivate.
-
build(
BuildContext context, S screen) → Widget - Describes the UI for this layout.
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ScreenLayout< S> > -
Creates the mutable state for this widget at a given location in the tree.
override
-
deactivate(
) → void - Called when this layout is temporarily removed from the widget tree.
-
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
-
didChangeDependencies(
) → void - Called when an InheritedWidget this layout depends on changes.
-
didUpdateWidget(
covariant ScreenLayout< S> oldWidget) → void - Called when the parent widget rebuilds with a new configuration.
-
dispose(
) → void - Called when this layout is permanently removed from the widget tree.
-
initState(
) → void - Called when this layout is inserted into the widget tree.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reassemble(
) → void - Called during hot reload. Override to re-read configuration.
-
setState(
VoidCallback fn) → void - Triggers a rebuild of this layout.
-
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, int wrapWidth = 65}) → 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