WRowButtonsController class

横向滚动按钮控制器,用于管理按钮的选中状态和滚动

该控制器提供以下功能:

  • 管理按钮数量和当前选中索引
  • 处理滚动动画逻辑
  • 提供索引变化通知机制
  • 支持自定义滚动曲线和对齐方式

Constructors

WRowButtonsController({required int length, int initialIndex = 0, Duration? animationDuration, bool scrollToCenter = true, Curve scrollCurve = Curves.ease, bool animateScroll = true, double overScroll = 0.0, double scrollThreshold = 0.5})
构造函数

Properties

animateScroll bool
是否启用滚动动画,默认 true
final
animationDuration Duration?
动画持续时间,默认 600 毫秒
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
index int
获取当前选中的索引
no setter
length int
按钮数量
final
overScroll double
过度滚动量,默认 0.0
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ScrollController
滚动控制器,用于控制横向滚动
getter/setter pair
scrollCurve Curve
滚动曲线,默认 Curves.ease
final
scrollThreshold double
滚动阈值,默认 0.5
final
scrollToCenter bool
是否滚动到中心,默认 true
getter/setter pair
selectedIndexNotifier ValueNotifier<int>
获取选中状态通知器
no setter

Methods

addListener(VoidCallback listener) → void
添加监听器
animateTo(int value, {Curve? curve}) → void
动画滚动到指定索引
dispose() → void
释放资源
jumpTo(int value) → void
直接跳转到指定索引
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeListener(VoidCallback listener) → void
移除监听器
toString() String
A string representation of this object.
inherited
updateBoxConstraints(BoxConstraints constraints) → void
更新布局约束

Operators

operator ==(Object other) bool
The equality operator.
inherited