ComMarqueeList class
跑马灯列表组件(无缝循环滚动)
一个专门用于显示列表项目的跑马灯组件,支持无缝循环滚动。 适用于公告栏、新闻列表等场景。
主要特性:
- 支持垂直和水平滚动
- 可自定义可见项目数量
- 支持项目间距设置
- 支持鼠标悬停暂停
- 内置控制器支持
使用示例:
ComMarqueeList(
children: [
Text('第一条公告'),
Text('第二条公告'),
Text('第三条公告'),
],
direction: MarqueeDirection.up,
visibleItemCount: 2,
itemHeight: 40.0,
)
参数说明:
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ComMarqueeList
Constructors
-
ComMarqueeList({Key? key, required List<
Widget> children, MarqueeDirection direction = MarqueeDirection.up, double speed = 30.0, int visibleItemCount = 3, double itemSpacing = 8.0, bool infinite = true, bool autoStart = true, int pauseDuration = 0, double itemHeight = 60.0, double itemWidth = 120.0, MarqueeController? controller, bool pauseOnHover = false, VoidCallback? onComplete}) -
const
Properties
- autoStart → bool
-
是否自动开始
final
-
children
→ List<
Widget> -
列表Widget数据
final
- controller → MarqueeController?
-
控制器
final
- direction → MarqueeDirection
-
滚动方向
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- infinite → bool
-
是否无限循环
final
- itemHeight → double
-
项目高度(垂直滚动时使用)
final
- itemSpacing → double
-
项目间距
final
- itemWidth → double
-
项目宽度(水平滚动时使用)
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onComplete → VoidCallback?
-
滚动完成回调
final
- pauseDuration → int
-
每轮滚动完成后的停留时间(毫秒)
final
- pauseOnHover → bool
-
是否在鼠标悬停时暂停
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- speed → double
-
滚动速度
final
- visibleItemCount → int
-
显示的项目数量
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ComMarqueeList> -
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