Carousel class
Used to create a generic carousel component that can be customized for various carousels.
用于创建通用的轮播组件,可为各种轮播自定义
-
units represents a list of components to be carousel-ed.
-
units 表示要轮播的组件列表
-
height represents the height of the carousel component, defaults to 400.0.
-
height 表示轮播组件的高度,默认为400.0
-
width represents the width of the carousel component, defaults to 0.0.
-
width 表示轮播组件的宽度,默认为0.0
-
onUnitTapped represents a callback function when a carousel unit is tapped, optional.
-
onUnitTapped 表示当轮播单元被点击时的回调函数,可选
-
onIndicatorTapped represents a callback function when an indicator is tapped, optional.
-
onIndicatorTapped 表示当指示器被点击时的回调函数,可选
-
useindicator indicates whether to use indicators, defaults to true.
-
useindicator 表示是否使用指示器,默认为true
-
indicatorColor represents the default indicator color, defaults to white.
-
indicatorColor 表示默认指示器的颜色,默认为白色
-
currentIndicatorColor represents the color of the currently selected indicator, defaults to blue.
-
currentIndicatorColor 表示当前选中指示器的颜色,默认为蓝色
-
indicatorWidth represents the width of the indicators, defaults to 40.0.
-
indicatorWidth 表示指示器的宽度,默认为40.0
-
indicatorHeight represents the height of the indicators, defaults to 26.0.
-
indicatorHeight 表示指示器的高度,默认为26.0
-
indicatorMargin represents the spacing between the indicators, defaults to 3.0.
-
indicatorMargin 表示指示器之间的间距,默认为3.0
-
indicatorToBottom represents the distance of the indicators from the bottom, defaults to 10.0.
-
indicatorToBottom 表示指示器距离底部的距离,默认为10.0
-
indicatorShape represents the default shape of the indicators, defaults to a rectangle.
-
indicatorShape 表示默认指示器的形状,默认为矩形
-
pageSnapping indicates whether to enable page snapping, defaults to true.
-
pageSnapping 表示是否启用页面快速吸附,默认为true
-
padEnds indicates whether to add extra pages at the beginning and end of the carousel, default is true.
-
padEnds 表示是否在轮播首尾添加额外的页面,默认为true
-
controller represents the carousel controller, optional.
-
controller 表示轮播控制器,可选
-
disableIndicatorDefaultCallbacks Whether to disable default indicator callback functions.
-
disableIndicatorDefaultCallbacks 是否禁用默认的指示器回调函数
- 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, bool disableIndicatorDefaultCallbacks = false, CarouselController? controller}) -
const
Properties
- clipBehavior → Clip
-
The behavior for the clip.
剪裁的行为
final
- controller → CarouselController?
-
Carousel controller, optional.
轮播控制器,可选
final
- currentIndicatorColor → Color
-
Color of the currently selected indicator.
当前选中指示器的颜色
final
- disableIndicatorDefaultCallbacks → bool
-
Whether to disable default indicator callback functions, default is false.
是否禁用默认指示器回调函数,默认为false。
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
Height of the carousel component.
轮播组件的高度
final
- indicatorBuilder → FunctionIndicatorBuilder?
-
Custom indicator builder function, optional.
自定义指示器构建函数,可选
final
- indicatorColor → Color
-
Default indicator color.
默认指示器颜色
final
- indicatorHeight → double
-
Indicator height.
指示器高度
final
- indicatorMargin → double
-
Spacing between indicators.
指示器之间的间距
final
- indicatorShape → BoxShape
-
Default indicator shape, defaults to a rectangle.
默认指示器形状,默认为矩形
final
- indicatorToBottom → double
-
Distance of indicators from the bottom.
指示器距离底部的距离
final
- indicatorWidth → double
-
Indicator width.
指示器宽度
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onIndicatorTapped → FunctionWithAInt?
-
Callback function when an indicator is clicked, optional.
当指示器被点击时的回调函数,可选
final
- onUnitTapped → FunctionWithAInt?
-
Callback function when a unit in the carousel is clicked, optional.
当轮播单元被点击时的回调函数,可选
final
- padEnds → bool
-
Whether to add extra pages at the beginning and end of the carousel, default is true.
是否在轮播首尾添加额外的页面,默认为true
final
- pageSnapping → bool
-
Whether to enable page snapping, defaults to true.
是否启用页面快速吸附,默认为true
final
- reverse → bool
-
Whether to reverse the order of items.
是否倒序项目的顺序
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollDirection → Axis
-
The axis along which the page view scrolls.
页面视图滚动的轴
final
-
units
→ List<
Widget> -
List of components to be carousel-ed.
要轮播的组件列表
final
- useindicator → bool
-
Whether to use indicators, defaults to true.
是否使用指示器,默认为true
final
- width → double
-
Width of the carousel component.
轮播组件的宽度
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