SantoTextEllipsis class
多行文本省略
对标 Vant TextEllipsis:内容超出 rows 行时折叠,并在末尾跟上展开操作; 内容未超出时原样展示、不出现操作文案。
省略位置由 position 控制,折叠时超出的文本替换为 dots, 展开操作紧跟在省略号之后,保证与文本同行。
示例:
SantoTextEllipsis(content: '慢慢来,比较快')
SantoTextEllipsis(
content: '慢慢来,比较快',
rows: 2,
expandText: '展开',
collapseText: '收起',
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SantoTextEllipsis
Constructors
-
SantoTextEllipsis({Key? key, String content = '', int rows = 1, String dots = '...', String expandText = '', String collapseText = '', SantoTextEllipsisPosition position = SantoTextEllipsisPosition.end, TextStyle? textStyle, TextStyle? actionStyle, InlineSpan actionBuilder(BuildContext context, bool expanded)?, ValueChanged<
bool> ? onClickAction}) -
const
Properties
- actionBuilder → InlineSpan Function(BuildContext context, bool expanded)?
-
自定义展开/收起操作,expanded 表示当前是否为展开态
final
- actionStyle → TextStyle?
-
展开/收起操作的样式,默认品牌主题色
final
- collapseText → String
-
收起操作的文案
final
- content → String
-
需要展示的文本内容
final
- dots → String
-
折叠时显示的省略文案,默认 '...'
final
- expandText → String
-
展开操作的文案
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onClickAction
→ ValueChanged<
bool> ? -
点击展开/收起操作时的回调,参数为点击后的展开状态
final
- position → SantoTextEllipsisPosition
-
省略位置,默认 SantoTextEllipsisPosition.end
final
- rows → int
-
展示的行数,超出后折叠,默认 1
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textStyle → TextStyle?
-
文本样式,默认字号 14、基础文字色、行高 kSantoTextEllipsisLineHeight
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → SantoTextEllipsisState -
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