# marquee_text包介绍
介绍
文本超过容器宽度可以自动滚动,不超出时不滚动
# Github地址
flutter-marquee-text (opens new window)
# 截图
# 简单使用
添加依赖
marquee_text
到pubspec.yaml
文件中.dependencies: marquee_text: ^1.1.0
1
2然后再项目中使用,示例如下:
Container( width: 100, color: Colors.green child: MarqueeText( text: '永和九年,岁在癸丑,暮春之初,会于会稽山阴之兰亭,修禊事也。', style: TextStyle( fontSize: 24, color: Colors.white, ), speed: 30, ), )
1
2
3
4
5
6
7
8
9
10
11
12
# 属性
属性 | 类型 | 必传 | 默认值 |
---|---|---|---|
text | String | true | / |
style | TextStyle | false | / |
speed | double | false | 50 |
alwaysScroll | bool | false | false |
textDirection | TextDirection | false | TextDirection.ltr |
marqueeDirection | MarqueeDirection | false | MarqueeDirection.rtl |