UserSwitchingLockButton class
A reusable lock-icon button that triggers the clock-out flow.
Place this widget in the Sell Page header or DashboardActions grid.
Visibility should be gated on the enableUserSwitching feature flag
by the consuming widget (e.g. DashboardHeader).
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- UserSwitchingLockButton
Constructors
- UserSwitchingLockButton({Key? key, required String currentMerchantId, required dynamic onBeforeSwitch(), required void onUserClockedIn(BuildContext context, UserSwitchingResult result), required dynamic onLogout(BuildContext context), IconData icon = Icons.groups_outlined, Color? iconColor, double iconSize = 24, String tooltip = 'Switch User', bool disabled = false, dynamic disabledOnTap(BuildContext context)?})
-
const
Properties
- currentMerchantId → String
-
final
- disabled → bool
-
Whether the button is disabled.
final
- disabledOnTap → dynamic Function(BuildContext context)?
-
Callback invoked when the button is tapped while disabled is
true.final - hashCode → int
-
The hash code for this object.
no setterinherited
- icon → IconData
-
Optional icon override. Defaults to Icons.groups_outlined to reflect the
user-switching action this button triggers.
final
- iconColor → Color?
-
Optional icon color override.
final
- iconSize → double
-
Optional icon size override. Defaults to 24.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onBeforeSwitch → dynamic Function()
-
Optional hook called after user selection but before the session-switch.
final
- onLogout → dynamic Function(BuildContext context)
-
Performs the sign-out. MUST NOT show a confirmation dialog — the package
owns the logout confirmation; this callback only does the sign-out work.
final
- onUserClockedIn → void Function(BuildContext context, UserSwitchingResult result)
-
Called when a user has successfully clocked in.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tooltip → String
-
Optional tooltip text. Defaults to "Switch User".
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