EnvSwitcher<E extends Enum> class
Wraps child with a gesture that opens the envify debug panel.
The panel can be disabled entirely via enabled, or restricted to non-release builds with enableInRelease. Use triggerMode to choose between a long-press and a configurable rapid-tap gesture.
Long-press (default)
EnvSwitcher<Environment>(
child: const AppLogo(),
)
Tap-count
EnvSwitcher<Environment>(
triggerMode: EnvTriggerMode.tapCount,
tapCount: 5,
tapWindowMs: 3000,
child: const AppLogo(),
)
Disable in release builds (opt-in lockdown)
EnvSwitcher<Environment>(
enableInRelease: false, // panel only shows in debug/profile
child: const AppLogo(),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- EnvSwitcher
Constructors
- EnvSwitcher({Key? key, required Widget child, bool enabled = true, bool enableInRelease = true, bool showRestartToggle = true, EnvTriggerMode triggerMode = EnvTriggerMode.longPress, int tapCount = 5, int tapWindowMs = 3000, VoidCallback? onSwitched})
-
Creates an EnvSwitcher.
const
Properties
- child → Widget
-
The widget tree to wrap.
final
- enabled → bool
-
Whether the debug panel gesture is active.
final
- enableInRelease → bool
-
Whether the debug panel gesture is active in release builds.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onSwitched → VoidCallback?
-
Optional callback fired after the environment switch (and optional app
restart) completes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showRestartToggle → bool
-
Whether to show the restart-after-switch toggle in the debug panel.
final
- tapCount → int
-
Number of taps required when triggerMode is EnvTriggerMode.tapCount.
final
- tapWindowMs → int
-
Millisecond window within which tapCount taps must occur.
final
- triggerMode → EnvTriggerMode
-
Which gesture opens the debug panel.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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