ArcoCarousel class
轮播(Carousel)。
对齐官方 components/Carousel(编译产物 .arco-carousel-* 系列规则):
- 三种动画 ArcoCarouselAnimation:
slide平移 /card卡片预览 /fade淡入淡出;水平与垂直两方向; - 指示器 ArcoCarouselIndicatorType.dot(6×6 圆点间距 8)/
line(12×4 横条)/slider(单一滑动条)/never隐藏; - ArcoCarouselShowArrow:圆形半透明箭头(24px、半透明白底、悬停加深,
hover模式悬停时才淡入); - 自动播放 autoPlay:默认 3s、悬停暂停;单张时不自动播放;
moveSpeed 切换时长(默认 500ms)+ timingFunc 缓动
(默认
cubic-bezier(0.34, 0.69, 0.1, 1)); - 受控 currentIndex 或回调 onChange。点击子项跳到对应索引。
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ArcoCarousel
Constructors
-
ArcoCarousel({Key? key, required List<
Widget> items, int? currentIndex, ArcoCarouselAnimation animation = ArcoCarouselAnimation.slide, ArcoCarouselDirection direction = ArcoCarouselDirection.horizontal, Duration moveSpeed = const Duration(milliseconds: 500), Curve timingFunc = ArcoMotion.standard, ArcoCarouselIndicatorType indicatorType = ArcoCarouselIndicatorType.dot, ArcoCarouselIndicatorPosition indicatorPosition = ArcoCarouselIndicatorPosition.bottom, ArcoCarouselShowArrow showArrow = ArcoCarouselShowArrow.always, ArcoCarouselTrigger trigger = ArcoCarouselTrigger.click, ArcoCarouselAutoPlay? autoPlay, void onChange(int newIndex, int oldIndex, bool isManual)?}) -
创建轮播。
const
Properties
- animation → ArcoCarouselAnimation
-
动画类型(默认 slide)。
final
- autoPlay → ArcoCarouselAutoPlay?
-
自动播放配置(默认关闭)。
final
- currentIndex → int?
-
受控当前索引(官方
currentIndex)。final - direction → ArcoCarouselDirection
-
方向(默认 horizontal)。
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- indicatorPosition → ArcoCarouselIndicatorPosition
-
指示器位置(默认 bottom)。
final
- indicatorType → ArcoCarouselIndicatorType
-
指示器类型(默认 dot)。
final
-
items
→ List<
Widget> -
轮播项(官方 children)。
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- moveSpeed → Duration
-
切换时长(官方
moveSpeed,默认 500ms)。final - onChange → void Function(int newIndex, int oldIndex, bool isManual)?
-
索引变化回调(官方
onChange,参数依次为 new / old / isManual)。final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showArrow → ArcoCarouselShowArrow
-
箭头显示策略(默认 always)。
final
- timingFunc → Curve
-
缓动曲线(官方
timingFunc,默认 standard)。final - trigger → ArcoCarouselTrigger
-
指示器触发方式(默认 click)。
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ArcoCarousel> -
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