ImageSwitch class

create_user: zhengzaihong email:1096877329@qq.com create_date: 2024/4/19 create_time: 16:53 describe: 自定义开关组件 简单示例 eg:

Inheritance
Available Extensions

Constructors

ImageSwitch({Key? key, required bool value, BuilderSwitch? builder, bool rotate = false, ValueChanged<bool>? onChanged, double width = _kDefaultWidth, double height = _kDefaultHeight, double radius = _kDefaultHeight / 2, Color? activeBorderColor, Color? inactiveBorderColor, Color activeTrackColor = _kDefaultActiveColor, Color inactiveTrackColor = _kDefaultInactiveColor, Color? activeThumbColor = Colors.greenAccent, Color? inactiveThumbColor = Colors.grey, Widget? activeImage, Widget? inactiveImage, Duration duration = _kDefaultDuration, double paddingHorizontal = 1.5, double defaultStyleSize = _kDefaultHeight - 4, double defaultStyleRadius = 15})
const

Properties

activeBorderColor Color?
开启状态下边框颜色
final
activeImage Widget?
开启状态下滑块的组件 自定义视图 activeThumbColor失效
final
activeThumbColor Color?
开启状态下滑块的颜色
final
activeTrackColor Color
开启状态下轨道的颜色
final
builder BuilderSwitch?
final
defaultStyleRadius double
默认样式的圆角度
final
defaultStyleSize double
默认样式的大小
final
duration Duration
过度动画时长
final
hashCode int
The hash code for this object.
no setterinherited
height double
开关 height
final
inactiveBorderColor Color?
关闭状态下边框颜色
final
inactiveImage Widget?
关闭状态下滑块的组件 自定义视图 inactiveThumbColor失效
final
inactiveThumbColor Color?
关闭状态下滑块的颜色
final
inactiveTrackColor Color
关闭状态下轨道的颜色
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onChanged ValueChanged<bool>?
开关发生变化时回调
final
paddingHorizontal double
final
radius double
轨道圆角度数
final
rotate bool
是否开启滚动
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value bool
开关是开还是关,不能设置为null
final
width double
开关 width
final

Methods

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