Carousel class
用于创建一个通用的轮播组件,可以基于它封装各种轮播
- units 表示要轮播的组件列表
- height 表示轮播组件的高度,默认为400.0
- width 表示轮播组件的宽度,默认为0.0
- onUnitTapped 表示当轮播单元被点击时的回调函数,可选
- onIndicatorTapped 表示当指示器被点击时的回调函数,可选
- useindicator 表示是否使用指示器,默认为true
- indicatorColor 表示默认指示器的颜色,默认为白色
- currentIndicatorColor 表示当前选中指示器的颜色,默认为蓝色
- indicatorWidth 表示指示器的宽度,默认为40.0
- indicatorHeight 表示指示器的高度,默认为26.0
- indicatorMargin 表示指示器之间的间距,默认为3.0
- indicatorToBottom 表示指示器距离底部的距离,默认为10.0
- indicatorShape 表示默认指示器的形状,默认为矩形
- pageSnapping 表示是否启用页面快速吸附,默认为true
- padEnds 表示是否在轮播首尾添加额外的页面,默认为true
- controller 表示轮播控制器,可选
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- Carousel
Constructors
-
Carousel(List<
Widget> units, {Key? key, double height = 400.0, double width = 0.0, FunctionWithAInt? onUnitTapped, FunctionWithAInt? onIndicatorTapped, bool useindicator = true, Color indicatorColor = Colors.white, Color currentIndicatorColor = Colors.blue, double indicatorWidth = 40.0, double indicatorHeight = 26.0, double indicatorMargin = 3.0, double indicatorToBottom = 10.0, BoxShape indicatorShape = BoxShape.rectangle, FunctionIndicatorBuilder? indicatorBuilder, bool pageSnapping = true, bool padEnds = true, Clip clipBehavior = Clip.hardEdge, bool reverse = false, Axis scrollDirection = Axis.horizontal, CarouselController? controller}) -
const
Properties
- clipBehavior → Clip
-
final
- controller → CarouselController?
-
轮播控制器,可选
final
- currentIndicatorColor → Color
-
当前选中指示器的颜色
final
- disableIndicatorDefaultCallbacks → bool
-
是否禁用默认指示器回调函数
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
轮播组件的高度
final
- indicatorBuilder → FunctionIndicatorBuilder?
-
自定义指示器构建函数,可选
final
- indicatorColor → Color
-
默认指示器的颜色
final
- indicatorHeight → double
-
指示器的高度
final
- indicatorMargin → double
-
指示器之间的间距
final
- indicatorShape → BoxShape
-
默认指示器的形状,默认为矩形
final
- indicatorToBottom → double
-
指示器距离底部的距离
final
- indicatorWidth → double
-
指示器的宽度
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onIndicatorTapped → FunctionWithAInt?
-
当指示器被点击时的回调函数,可选
final
- onUnitTapped → FunctionWithAInt?
-
当图像被点击时的回调函数,可选
final
- padEnds → bool
-
是否在轮播首尾添加额外的页面, 默认为 true
final
- pageSnapping → bool
-
是否启用页面快速吸附,默认为 true
final
- reverse → bool
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollDirection → Axis
-
final
-
units
→ List<
Widget> -
要轮播的组件列表
final
- useindicator → bool
-
是否使用指示器,默认为 true
final
- width → double
-
轮播组件的宽度
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< Carousel> -
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