You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+72-58Lines changed: 72 additions & 58 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,24 @@ If there is something that can be improved, fixed or you just have some great id
6
6
7
7
If you implemented your own custom refresh indicator with this library and you want it to be mentioned here or provided as an example to the eample app, just open a pull request [HERE](https://github.com/gonuit/flutter-custom-refresh-indicator/pulls).
-[Controller state and value changes.](#controller-state-and-value-changes)
24
+
-[`didStateChange`](#didstatechange)
25
+
26
+
# QUICK START
12
27
13
28
```dart
14
29
CustomRefreshIndicator(
@@ -51,88 +66,87 @@ CustomRefreshIndicator(
51
66
)
52
67
```
53
68
54
-
### How the controller data change
55
-
56
-
The best way to understand how the "CustomRefreshIndicator" widget changes its controller data is to see the example 😉. An example is available in the example application.
57
-
58
-

59
-
60
-
## Examples
69
+
# Examples
61
70
62
71
Almost all of these examples are available in the example application.
CustomRefreshIndicator is idle (There is no action)
99
+
# Documentation
97
100
98
-
```dart
99
-
controller.value == 0.0
100
-
```
101
-
102
-
#### `dragging`
103
-
104
-
Whether the user is dragging a scrollable widget.
105
-
Ending the scroll **WILL NOT** result in `onRefresh` function call
106
-
107
-
```dart
108
-
controller.value < 1.0
109
-
```
110
-
111
-
#### `armed`
112
-
113
-
CustomRefreshIndicator is armed ending the scroll **WILL** result in:
101
+
## CustomRefreshIndicator widget
114
102
115
-
-`onRefresh` function call
116
-
- change of indicator status to `loading`
117
-
- decreasing controller.value to `1.0` in duration specified by `armedToLoadingDuration` CustomRefreshIndicator widget argument
103
+
`CustomRefreshIndicator` widget provides an absolute minimum functionality that allows you to create and set your own custom indicators.
118
104
119
-
```dart
120
-
controller.value >= 1.0
121
-
```
105
+
## IndicatorController
122
106
123
-
#### `hiding`
107
+
###Controller state and value changes.
124
108
125
-
CustomRefreshIndicator is hiding its indicator. After the future returned from `onRefresh` function is completed or scroll ended when the state was equal to `dragging` or the user started scrolling through the list.
126
-
controller value decreases to `0.0` in duration specified by `draggingToIdleDuration` CustomRefreshIndicator widget argument.
109
+
The best way to understand how the "CustomRefreshIndicator" widget changes its controller data is to see the example 😉. An example is available in the example application.
110
+
111
+

127
112
128
-
```dart
129
-
controller.value <= 1.0
130
-
```
113
+
| state | value | value description | Description |
|**idle**|`==0.0`| Value eqals `0.0`. | No user action. |
116
+
|**dragging**|`=<0.0`| Value is eqal `0.0` or larger but lower than `1.0`. | User is dragging the indicator. |
117
+
|**armed**|`>=1.0`| Value is larger than `1.0`. | User dragged the indicator further than the distance declared by `extentPercentageToArmed` or `offsetToArmed`. User still keeps the finger on the screen. |
118
+
|**loading**|`>=1.0`| Value decreses from last `armed` state value in duration of `armedToLoadingDuration` argument to `1.0`. | User finished dragging (took his finger off the screen), when state was equal to `armed`. `onRefresh` function is called. |
119
+
|**hiding**|`<=1.0`| Value decreses in duration of `draggingToIdleDuration` or `loadingToIdleDuration` arguments to `0.0`. | Indicator is hiding after:<br />- User ended dragging when indicator was in `dragging` state.<br />- Future returned from `onRefresh` function is resolved.<br />- Complete state ended.<br />- User started scrolling through the list. |
120
+
|**complete**|`==1.0`| Value equals `1.0` for duration of `completeStateDuration` argument. |**This state is OPTIONAL, provide `completeStateDuration` argument with non null value to enable it.**<br /> Loading is completed. |
131
121
132
-
#### `loading`
122
+
___
133
123
134
-
CustomRefreshIndicator widget is awaiting on future returned from `onRefresh` function. After future completed state will be change into `hiding` and controller value will decrease from `1.0` to `0.0` in duration specified by `loadingToIdleDuration` CustomRefreshIndicator widget argument.
124
+
### `didStateChange`
125
+
With this method, you can easily check if the indicator's state has changed.
0 commit comments