TwinDebugOverlay class
Shows the fold, the segments and the screen state on top of the app, and simulates foldable devices.
Place it inside TwinScreenScope, above your app:
void main() => runApp(
const TwinScreenScope(child: TwinDebugOverlay(child: MyApp())),
);
A small button opens a draggable panel with the current mode, posture,
hinge angle, window class, size, platform and data source. The panel's
simulator renders the app at the logical size of a device preset (iPhone
Duo, Galaxy Z Fold, Galaxy Z Flip, Pixel Fold, Surface Duo, Xiaomi Mix
Flip) and fakes MediaQuery and the platform report, so every posture and
orientation can be tried without the hardware.
The overlay is off in release builds unless enabled is set.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- TwinDebugOverlay
Constructors
-
TwinDebugOverlay({Key? key, required Widget child, bool enabled = !kReleaseMode, TwinSimulatorController? controller, List<
TwinDevicePreset> presets = TwinDevicePreset.all, bool drawFeatures = true, bool showPanel = true}) -
Creates a debug overlay.
const
Properties
- child → Widget
-
The app.
final
- controller → TwinSimulatorController?
-
Drives the simulator. When null the overlay creates its own, with the
simulator off.
final
- drawFeatures → bool
-
Whether to draw segments, the hinge and cutouts over the app.
final
- enabled → bool
-
Whether the overlay does anything. Defaults to true in debug and profile
builds and false in release builds. When false, child is returned
unchanged.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
presets
→ List<
TwinDevicePreset> -
The presets offered in the panel.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showPanel → bool
-
Whether to show the panel button. Turn it off to drive the simulator
from code only, for example in widget tests.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< TwinDebugOverlay> -
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, 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