Skip to content

Commit ea9acf8

Browse files
author
Kamil Klyta
committed
Start refresh immediately after releasing indicator in the armed state
1 parent 873160b commit ea9acf8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## 2.0.0-dev.2
22
## Breaking changes
3-
- Renamed `extentPercentageToArmed` argument to `containerExtentPercentageToArmed` which better describes what it exactly means.
3+
- Renamed `extentPercentageToArmed` argument to `containerExtentPercentageToArmed` which better describes what it exactly does.
44
- Changed the default value of the `defaultContainerExtentPercentageToArmed` from `0.20` to `0.1(6)` to match the behavior of the built-in indicator widget.
55
- Removed deprecated **IndicatorStateHelper** class. Instead use **CustomRefreshIndicator.onStateChanged** method.
66
- Removed deprecated **leadingGlowVisible** and **trailingGlowVisible** arguments. Instead use **leadingScrollIndicatorVisible** and **trailingScrollIndicatorVisible** accoringly.
@@ -12,6 +12,7 @@
1212
- Added extension with utility getters for **IndicatorState** class.
1313
- Trigger mode support added. Equivalent to trigger mode of the built-in **RefreshIndicator** widget.
1414
- The **PositionedIndicatorContainer** class is no longer exported from this package, however the source code is available in the example application.
15+
- Now the *onRefresh* function will be triggered immediately when the indicator is released in the armed state. Previously, the *onRefresh* function was triggered when the indicator reached a target value in the loading state of `1.0`.
1516
- Multiple minor fixes, improvements and optimizations.
1617
## 1.2.1
1718
- Flutter 3.0.0 migration backward compatibility fix ([#31](https://github.com/gonuit/flutter-custom-refresh-indicator/pull/31)) by [Jordan1122](https://github.com/Jordan1122)

lib/src/custom_refresh_indicator.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,13 @@ class CustomRefreshIndicatorState extends State<CustomRefreshIndicator>
487487
_dragOffset = 0;
488488

489489
setIndicatorState(IndicatorState.loading);
490-
await _animationController.animateTo(1.0,
491-
duration: widget.armedToLoadingDuration);
492-
await widget.onRefresh();
490+
await Future.wait([
491+
widget.onRefresh(),
492+
_animationController.animateTo(
493+
1.0,
494+
duration: widget.armedToLoadingDuration,
495+
),
496+
]);
493497
} finally {
494498
await _hideAfterRefresh();
495499
}

0 commit comments

Comments
 (0)