SmartRefresher class
This is the most important component that provides drop-down refresh and up loading. RefreshController must not be null,Only one controller to one SmartRefresher
header,I have finished a lot indicators,you can checkout ClassicHeader,WaterDropMaterialHeader,MaterialClassicHeader,WaterDropHeader,BezierCircleHeader footer,ClassicFooter If you need to custom header or footer,You should check out CustomHeader or CustomFooter
See also:
-
RefreshConfiguration, A global configuration for all SmartRefresher in subtrees
-
RefreshController, A controller controll header and footer indicators state
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SmartRefresher
Constructors
- SmartRefresher({Key? key, required RefreshController controller, Widget? child, Widget? header, bool enablePullDown = true, bool enablePullUp = false, bool enableTwoLevel = false, VoidCallback? onRefresh, VoidCallback? onLoading, VoidCallback? onTwoLevel, OnOffsetChange? onOffsetChange, DragStartBehavior? dragStartBehavior, bool? primary, double? cacheExtent, int? semanticChildCount, bool? reverse, ScrollPhysics? physics, Axis? scrollDirection, ScrollController? scrollController})
- creates a widget help attach the refresh and load more function controller must not be null, child is your refresh content,Note that there's a big difference between children inheriting from ScrollView or not. If child is extends ScrollView,inner will get the slivers from ScrollView,if not,inner will wrap child into SliverToBoxAdapter. If your child inner container Scrollable,please consider about converting to Sliver,and use CustomScrollView,or use builder constructor such as AnimatedList,RecordableList,doesn't allow to put into child,it will wrap it into SliverToBoxAdapter If you don't need pull down refresh ,just enablePullDown = false, If you need pull up load ,just enablePullUp = true
- SmartRefresher.builder({Key? key, required RefreshController controller, required RefresherBuilder? builder, bool enablePullDown = true, bool enablePullUp = false, bool enableTwoLevel = false, VoidCallback? onRefresh, VoidCallback? onLoading, VoidCallback? onTwoLevel, OnOffsetChange? onOffsetChange})
- creates a widget help attach the refresh and load more function controller must not be null,builder must not be null this constructor use to handle some special third party widgets,this widget need to pass slivers ,but they are not extends ScrollView,so my widget inner will wrap child to SliverToBoxAdapter,which cause scrollable wrapping scrollable. for example,NestedScrollView is a StalessWidget,it's headerSliversbuilder can return a slivers array,So if we want to do refresh above NestedScrollVIew,we must use this constrctor to implements refresh above NestedScrollView,but for now,NestedScrollView can not support overscroll out of edge
Properties
- builder → RefresherBuilder?
-
child content builder
final
- cacheExtent → double?
-
copy from ScrollView,for setting in SingleChildView,not ScrollView
final
- child → Widget?
-
Refresh Content
final
- controller → RefreshController
-
Controll inner state
final
- dragStartBehavior → DragStartBehavior?
-
copy from ScrollView,for setting in SingleChildView,not ScrollView
final
- enablePullDown → bool
-
This bool will affect whether or not to have the function of drop-down refresh.
final
- enablePullUp → bool
-
final
- enableTwoLevel → bool
-
controll whether open the second floor function
final
-
footer indicator display after content
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- header → Widget?
-
header indicator displace before content
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onLoading → VoidCallback?
-
callback when footer loading more data
final
- onOffsetChange → OnOffsetChange?
-
callback when the indicator scroll out of edge
final
- onRefresh → VoidCallback?
-
callback when header refresh
final
- onTwoLevel → VoidCallback?
-
callback when header ready to twoLevel
final
- physics → ScrollPhysics?
-
copy from ScrollView,for setting in SingleChildView,not ScrollView
final
- primary → bool?
-
copy from ScrollView,for setting in SingleChildView,not ScrollView
final
- reverse → bool?
-
copy from ScrollView,for setting in SingleChildView,not ScrollView
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
copy from ScrollView,for setting in SingleChildView,not ScrollView
final
- scrollDirection → Axis?
-
copy from ScrollView,for setting in SingleChildView,not ScrollView
final
- semanticChildCount → int?
-
copy from ScrollView,for setting in SingleChildView,not ScrollView
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< StatefulWidget> -
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}) → 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
Static Methods
-
of(
BuildContext context) → SmartRefresher? -
ofState(
BuildContext context) → SmartRefresherState?