ElText class

Inheritance
Implementers
Available extensions

Constructors

ElText(dynamic data, {Key? key, TextStyle? style, StrutStyle? strutStyle, TextAlign? textAlign, TextDirection? textDirection, Locale? locale, bool? softWrap, TextOverflow? overflow, TextScaler? textScaler, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, Color? selectionColor})
Element UI 文本小部件,内部直接基于 RichText 进行封装,同时简化了富文本的写法
const

Properties

data → dynamic
渲染的文本内容,支持传递类型数据,它们会统一使用 toString 转成字符串, 如果是List集合,则会当做富文本进行渲染。
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
locale Locale?
指定语言
final
maxLines int?
文本最大行数
final
overflow TextOverflow?
文本超出样式
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectionColor Color?
文本选中颜色
final
semanticsLabel String?
语义化标签
final
softWrap bool?
是否自动换行
final
strutStyle StrutStyle?
文本基线对齐样式
final
style TextStyle?
文本样式
final
textAlign TextAlign?
文本水平对齐方式,默认左对齐
final
textDirection TextDirection?
控制文本方向:ltr、rtl
final
textHeightBehavior TextHeightBehavior?
final
textScaler TextScaler?
文本缩放倍数,如果要放大2倍,设置 TextScaler.linear(2) 即可
final
textWidthBasis TextWidthBasis?
测量一行或多行文本宽度的不同方法:
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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
noScrollbarBehavior(BuildContext context, {Key? key, bool? overscroll, bool enabled = true}) Widget

Available on Widget, provided by the FlutterWidgetExt extension

不使用祖先提供的默认滚动条,当使用自定义滚动条时请添加此扩展方法,防止与祖先提供的默认滚动条重叠
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