ScreenLayout class

A widget that will layout child at the given size in breakpoints. ScreenLayoutBreakpoints.portraitStandardBreakpoint while in portrait mode, or ScreenLayoutBreakpoints.landscapeStandardBreakpoint while in landscape mode. After laying out at that size, ScreenLayout will scale the child so as to fix the current screen size, up to a maximum scale ratio of maxScale, or ScreenLayoutBreakpoints.portraitConstrainedWidth while in portrait mode, or ScreenLayoutBreakpoints.landscapeConstrainedWidth while in landscape mode.

This is useful for when you have a design where the base design is created with a given width, and all UI elements are meant to be shown exactly as the design shows relative to the current device's screen size. In other words, this widget will implement a non-responsive UI that automatically scales children up or down to match the current screen size. It is usually a bad design practice to scale up to fullscreen on devices like a tablet or PC, and you can control the maximum things will scale by using the above-mentioned settings to avoid that and show a more reasonable UI design.

example:

ScreenLayout(
  breakpoints: const ScreenLayoutBreakpoints(
    portraitStandardBreakpoint: 375.0,
    portraitConstrainedWidth: double.infinity,
    landscapeStandardBreakpoint: 375.0,
    landscapeConstrainedWidth: double.infinity,
    maxScale: 1.2,
  ),
  child: HogehogeWidget(),
),
Inheritance

Constructors

ScreenLayout({Key? key, Widget? child, ScreenLayoutBreakpoints? breakpoints, String? name})
Creates a ScreenLayout with the name name that adjusts the size of the widget specified in child based on the configuration in breakpoints.
const
ScreenLayout.named({Key? key, Widget? child, required String name})
Creates a ScreenLayout with the name name that adjusts the size of the widget specified in child.
factory

Properties

breakpoints ScreenLayoutBreakpoints?
Breakpoints for adjusting the size of the widget.
final
child Widget?
The widget below this widget in the tree.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
name String?
Name of the ScreenLayout widget.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() SingleChildRenderObjectElement
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
inherited
createRenderObject(BuildContext context) RenderObject
Creates an instance of the RenderObject class that this RenderObjectWidget represents, using the configuration described by this RenderObjectWidget.
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
didUnmountRenderObject(covariant RenderObject renderObject) → void
A render object previously associated with this widget has been removed from the tree. The given RenderObject will be of the same type as returned by this object's createRenderObject.
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
updateRenderObject(BuildContext context, covariant _ScreenLayoutRenderObject renderObject) → void
Copies the configuration described by this RenderObjectWidget to the given RenderObject, which will be of the same type as returned by this object's createRenderObject.
override

Operators

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