LiteSwitch class

Inheritance

Constructors

LiteSwitch.new({Key? key, required String name, LiteSwitchPosition switchPosition = LiteSwitchPosition.left, LiteSwitchReactionArea reactionArea = LiteSwitchReactionArea.full, ValueChanged<bool>? onChanged, String? label, MarkdownTapLinkCallback? onTapLink, double paddingTop = 0.0, double paddingBottom = 0.0, double paddingLeft = 0.0, double paddingRight = 0.0, LiteFormValueSerializer serializer = nonConvertingValueConvertor, LiteFormValueDeserializer? initialValueDeserializer, List<LiteValidator>? validators, Object? initialValue, AutovalidateMode? autovalidateMode, SwitchStyle type = SwitchStyle.adaptive, CustomLiteToggleBuilder? customLiteToggleBuilder, Color? activeColor, ImageProvider<Object>? activeThumbImage, Color? activeTrackColor, bool autofocus = false, DragStartBehavior dragStartBehavior = DragStartBehavior.start, Color? focusColor, FocusNode? focusNode, Color? hoverColor, Color? inactiveThumbColor, Color? inactiveTrackColor, MaterialTapTargetSize? materialTapTargetSize, MouseCursor? mouseCursor, ImageErrorListener? onActiveThumbImageError, ValueChanged<bool>? onFocusChange, MaterialStateProperty<Color?>? overlayColor, double? splashRadius, MaterialStateProperty<Color?>? thumbColor, MaterialStateProperty<Icon?>? thumbIcon, MaterialStateProperty<Color?>? trackColor, EdgeInsets childPadding = const EdgeInsets.symmetric(vertical: 8.0), Widget? child, String? text, bool useMarkdown = false, bool readOnly = false, bool useSmoothError = true, MarkdownStyleSheet? markdownStyleSheet, TextStyle? style, ImageErrorListener? onInactiveThumbImageError, EdgeInsets? smoothErrorPadding = const EdgeInsets.only(top: 8.0), TextStyle? errorStyle})

Properties

activeColor Color?
final
activeThumbImage ImageProvider<Object>?
final
activeTrackColor Color?
final
autofocus bool
final
autovalidateMode AutovalidateMode?
final
child Widget?
final
childPadding EdgeInsets
final
customLiteToggleBuilder CustomLiteToggleBuilder?
If you don't want the toggle to look like Cupertino or Material you may provide you own toggle builder here
final
dragStartBehavior DragStartBehavior
final
errorStyle TextStyle?
final
focusColor Color?
final
focusNode FocusNode?
final
hashCode int
The hash code for this object.
no setterinherited
hoverColor Color?
final
inactiveThumbColor Color?
final
inactiveTrackColor Color?
final
initialValue Object?
even though the type here is specified as Object? it is assumed that the default value type is bool If you pass something other than bool, make sure you also provide initialValueDeserializer which will convert initialValue to bool
final
initialValueDeserializer LiteFormValueDeserializer?
Allows you to convert initial value to a proper data type or format before using it. E.g. you have a iso8601 format but you need to have a DateTime object to work with in a date picker. Use initialValueDeserializer to convert iso8601 value to a DateTime like so: initialValueDeserializer: (value) => DateTime.parse(value); and you will get a DateTime as an initial value. You can use any custom conversions you want
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String?
final
markdownStyleSheet → MarkdownStyleSheet?
You can use a custom markdown style sheet. It makes sense only if useMarkdown == true
final
materialTapTargetSize MaterialTapTargetSize?
final
mouseCursor MouseCursor?
final
name String
final
onActiveThumbImageError ImageErrorListener?
final
onChanged ValueChanged<bool>?
final
onFocusChange ValueChanged<bool>?
final
onInactiveThumbImageError ImageErrorListener?
final
Called when the user taps a link.
final
overlayColor MaterialStateProperty<Color?>?
final
paddingBottom double
final
paddingLeft double
final
paddingRight double
final
paddingTop double
final
reactionArea LiteSwitchReactionArea
Determines the tap area which will activate / deactivate the switch LiteSwitchReactionArea.full by default. It means you can tap even on a text to control the switch. LiteSwitchReactionArea.toggleOnly means that only the toggle itself will be reactive
final
readOnly bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serializer LiteFormValueSerializer
Allows you to prepare the data for some general usage like sending it to an api endpoint. E.g. you have a Date Picker which returns a DateTime object but you need to send it to a backend in a iso8601 string format. Just pass the serializer like this: serializer: (value) => value.toIso8601String() And it will always store this date as a string in a form map which you can easily send wherever you need
final
smoothErrorPadding EdgeInsets?
makes sense only of useSmoothError is true
final
splashRadius double?
final
style TextStyle?
A style for text. Makes sense only if text != null
final
switchPosition LiteSwitchPosition
The position of the switch relative to a child or a text
final
text String?
final
thumbColor MaterialStateProperty<Color?>?
final
thumbIcon MaterialStateProperty<Icon?>?
final
trackColor MaterialStateProperty<Color?>?
final
type SwitchStyle
The look and feel of the switch.
final
useMarkdown bool
If you need to use markdown in the text description, pass true here.
final
useSmoothError bool
if true, this will use a smoothly animated error that uses AnimateSize to display, unlike the standard Flutter's input error
final
validators List<LiteValidator>?
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<LiteSwitch>
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