LuckyWheel class
受控大转盘;例如 LuckyWheel(config: config, onStart: controller.play)。
未给宽高时父约束必须有界。外部 controller 由调用者释放;点击不自动 play。
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- LuckyWheel
Constructors
-
LuckyWheel({Key? key, required WheelConfig config, WheelController? controller, double? width, double? height, AlignmentGeometry alignment = Alignment.topLeft, VoidCallback? onStart, LuckyButtonTapCallback? onButtonTap, ValueChanged<
LuckyResult< ? onEnd, ValueChanged<WheelPrize> >LuckyPhase> ? onPhaseChanged, ValueChanged<int> ? onSectorPassed, ValueChanged<LuckyImageError> ? onImageError, VoidCallback? onReady, LuckyHooks hooks = const LuckyHooks(), List<LuckyLayer< layers = const [], LuckyRenderer<WheelLayout, WheelFrame> >WheelConfig, WheelLayout, WheelFrame, LuckyResult< ? renderer, Widget overlayBuilder(BuildContext context, LuckySurfaceData<WheelPrize> >WheelConfig, WheelLayout, WheelFrame> data)?, LuckyPerformanceOptions performance = const LuckyPerformanceOptions(), LuckyTextScaling textScaling = LuckyTextScaling.none, String? semanticsLabel, String semanticsValueBuilder(LuckyPhase phase, LuckyResult<WheelPrize> ? result)?}) -
创建转盘,结构变化在减速期间延后到本局结束应用。
const
Properties
- alignment → AlignmentGeometry
-
转盘在非正方形盒子中的位置。
final
- config → WheelConfig
-
不可变转盘配置。
final
- controller → WheelController?
-
可选外部控制器,未指定时宿主创建并释放。
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
逻辑高度,null 时取父约束。
final
- hooks → LuckyHooks
-
初始化、尺寸和绘制钩子。
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
layers
→ List<
LuckyLayer< WheelLayout, WheelFrame> > -
按插入位置绘制的用户层。
final
- onButtonTap → LuckyButtonTapCallback?
-
任意阶段命中按钮时触发,提供按钮下标及阶段。
final
-
onEnd
→ ValueChanged<
LuckyResult< ?WheelPrize> > -
正常结束或作废后返回本局结果。
final
-
onImageError
→ ValueChanged<
LuckyImageError> ? -
图片失败通知,不阻塞其它内容呈现。
final
-
onPhaseChanged
→ ValueChanged<
LuckyPhase> ? -
运动阶段变化通知。
final
- onReady → VoidCallback?
-
全部图片请求成功或失败后触发。
final
-
onSectorPassed
→ ValueChanged<
int> ? -
指针越过扇区时返回下标。
final
- onStart → VoidCallback?
-
命中按钮且允许开始时触发。
final
-
overlayBuilder
→ Widget Function(BuildContext context, LuckySurfaceData<
WheelConfig, WheelLayout, WheelFrame> data)? -
在渲染表面上构建可选奖品 Widget 层;data 提供已应用的布局、帧及通知器。
final
- performance → LuckyPerformanceOptions
-
缓存和采样选项。
final
-
renderer
→ LuckyRenderer<
WheelConfig, WheelLayout, WheelFrame, LuckyResult< ?WheelPrize> > -
自定义后端,null 使用 WheelCanvasRenderer。
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticsLabel → String?
-
默认无障碍标签的覆盖值。
final
-
semanticsValueBuilder
→ String Function(LuckyPhase phase, LuckyResult<
WheelPrize> ? result)? -
可选的阶段和结果播报文本。
final
- textScaling → LuckyTextScaling
-
系统文字缩放策略。
final
- width → double?
-
逻辑宽度,null 时取父约束。
final
Methods
-
build(
BuildContext context) → 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