PlaceholderTip class

PlaceholderTip

页面中心提示组件,通常用于空页面的占位显示(如无数据、无网络、错误信息等)。

参数

代码示例

PlaceholderTip(
  image: Icon(Icons.cloud_off, size: 100, color: Colors.grey),
  text: '无网络连接,请检查您的网络设置。',
  button: ElevatedButton(
    onPressed: () {},
    child: Text('重试'),
  ),
)

返回

返回一个 Widget,通常为页面中央的占位提示,包括图片、文本和可选按钮。

Inheritance

Constructors

PlaceholderTip({Key? key, required Widget image, required String text, TextStyle? textStyle, Widget? button})
创建一个 PlaceholderTip 组件。
const

Properties

button Widget?
可选的操作按钮。
final
hashCode int
The hash code for this object.
no setterinherited
image Widget
显示的图片组件。
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
text String
提示文本。
final
textStyle TextStyle?
提示文本的样式,默认为灰色14号字体。
final

Methods

build(BuildContext context) 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
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