# Label
Label is a widget that extends the functionality of Text.
# FLCopyableLabel
FLCopyableLabel supports long press to pop up copy menu, and you can click it to copy text to clipboard.
FLCopyableLabel(
copyData: 'copy data',
showMenu: true,
child: Padding(
padding: const EdgeInsets.all(5),
child: Text('This is a copyable label', style: TextStyle(fontSize: 17)),
),
afterCopyCallback: () {},
),
Tips
In Flutter 1.9 and above version, you can use the official widget SelectableText, which can support selecting part of content to copy on Android.
# FLMarqueeLabel
FLMarqueeLabel supports text scrolling effects, often used as notifications or other scenes to be displayed. FLNoticeBar is a widget used as a scrolling notification, you can set leading widget and it is also closable, you can see FLNoticeBar.
# usage
FLMarqueeLabel(
text: 'Notice: For Flutter 1.9 or above, you can use SelectableText to support copy function',
)
# space & velocity
space is the distance between the scrolling texts, velocity controls the scrolling speed, and the interval range is 0 - 1.
FLMarqueeLabel(
text: 'Notice: FLUI is a widget kit for Google Flutter',
style: TextStyle(
color: Colors.blueAccent,
fontSize: 16
),
velocity: 1,
space: 150,
)
WARNING
Text width + space must be greater than widget width.
# loop
loop default value is true, scrolling will loop indefinitely, and it can be set to false if only scrolls once.
FLMarqueeLabel(
text: 'Notice: This is a notification',
style: TextStyle(
color: Colors.lightGreen,
fontSize: 16
),
loop: false,
velocity: 0.7,
),
# API
# FLCopyableLabel
property | description | type | default value |
---|---|---|---|
copyData | the data string to be copied | String | |
showMenu | show popup menu or not | bool | false |
child | child widget | Widget | |
afterCopyCallback | call back after copy action | VoidCallback |
# FLMarqueeLabel
property | description | type | default value |
---|---|---|---|
text | text | String | |
style | style of text | TextStyle | |
space | space after the scrollable text | double | |
velocity | velocity ,range between 0 - 1 | double | 0.4 |
loop | is loop animation or not | bool | true |
height | the height of widget | double | 36 |
padding | padding | EdgeInsetsGeometry | |
backgroundColor | background color of widget | Color | Colors.transparent |
delay | duration before animate | Duration |