Fluent2Switch class
Fluent 2's Switch: a 40 by 20 track (32 by 16 small) 8 in from its
edges, its 14 thumb 3 inside the stroke, and its label 4 beside it in
body1, the whole row one switch. Off, the accessible stroke and thumb;
on, the brand fill (compoundBrandBackground) with the white thumb at
its end, sliding over durationNormal. A press or Space asks
onChanged for the other state; null onChanged draws it disabled.
style restyles the track over Fluent2ThemeData.switchTheme, in its
states (selected while on, hovered, pressed, disabled): fill (the
track), foreground (the thumb), edge, side, shape (the track's
outline; the thumb follows it), minimumSize (the track's size) and
textStyle (the label's). The track is a pill unless shape says
otherwise, and the thumb rounds in step.
Fluent2Switch(value: away, label: 'Show me as away', onChanged: (v) => setState(() => away = v))
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- Fluent2Switch
Constructors
-
Fluent2Switch({required bool value, required ValueChanged<
bool> ? onChanged, String? label, String? semanticLabel, Fluent2LabelPosition labelPosition = Fluent2LabelPosition.after, Fluent2SwitchSize size = Fluent2SwitchSize.medium, Fluent2Style? style, FocusNode? focusNode, bool autofocus = false, Key? key}) -
A switch holding
value.const
Properties
- autofocus → bool
-
Whether the control takes focus when it first builds.
final
- focusNode → FocusNode?
-
The control's focus node; null makes and disposes its own.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
The switch's label, shown and spoken; null shows none.
final
- labelPosition → Fluent2LabelPosition
-
Fluent2LabelPosition.after, Fluent2LabelPosition.before or
Fluent2LabelPosition.above.
final
-
onChanged
→ ValueChanged<
bool> ? -
Called with the new state when the user flips it; null puts it out of use.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
What a screen reader says; null says label.
final
- size → Fluent2SwitchSize
-
Fluent's
size: medium or small.final - style → Fluent2Style?
-
This switch's own look, slot by slot, over the switch theme.
final
- value → bool
-
Whether it is on.
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.
override
-
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