NZPullToRefresh class

NZPullToRefresh 是一个符合 NezhaUI 设计规范的下拉刷新组件。

它在原生 RefreshIndicator 的基础上进行了封装,支持:

  1. 隐藏默认的加载圆圈 (noSpinner)。
  2. 自定义提示文本 (Label)。
  3. 自定义色彩和圆角。
Inheritance

Constructors

NZPullToRefresh({Key? key, required Widget child, required Future<void> onRefresh(), bool showSpinner = true, String? label, String? readyLabel = '释放立即刷新', String? refreshingLabel = '正在刷新...', String? successLabel = '刷新成功', TextStyle? labelStyle, bool showIcon = true, IconData? successIcon = Icons.check_circle_outline_rounded, Color? backgroundColor, Color? color, double displacement = 40.0, double triggerDistance = 60.0, Duration refreshDelay = Duration.zero, bool enableHaptic = true})
const

Properties

backgroundColor Color?
刷新指示器的背景颜色
final
child Widget
刷新时展示的内容(通常是一个 ScrollView)
final
color Color?
刷新指示器的进度条颜色
final
displacement double
刷新指示器的出现偏移量
final
enableHaptic bool
是否开启震动反馈
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String?
自定义提示文本(初始状态/下拉时)。 当 showSpinner 为 false 时生效。
final
labelStyle TextStyle?
提示文本的样式
final
onRefresh Future<void> Function()
刷新时的回调函数
final
readyLabel String?
释放即可刷新的提示文本。
final
refreshDelay Duration
刷新结束后的延迟时间。 默认不延迟。
final
refreshingLabel String?
正在刷新时的提示文本。
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showIcon bool
是否显示图标。
final
showSpinner bool
是否显示默认的加载圆圈。 默认为 true。如果设置为 false,将不会显示 Spinner。
final
successIcon IconData?
刷新成功后的图标。
final
successLabel String?
刷新成功后的提示文本。
final
triggerDistance double
触发刷新的拉动距离 默认为 60.0
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<NZPullToRefresh>
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