Skip to content

Commit 7937a30

Browse files
committed
refactor: deprecate completeStateDuration in favor of completeDuration
1 parent bd7f47a commit 7937a30

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## 3.0.0
22
- **CustomRefreshIndicator**:
3-
- Deprecated *indicatorFinalizeDuration*, *indicatorSettleDuration* and *indicatorCancelDuration* parameters in favor of *finalizeDuration*, *settleDuration* and *cancelDuration*.
3+
- Deprecated *indicatorFinalizeDuration*, *indicatorSettleDuration*, *indicatorCancelDuration* and *completeStateDuration* parameters in favor of *finalizeDuration*, *settleDuration*, *cancelDuration* and *completeDuration*.
44
- The indicator widget will now be rebuilt every time *state* changes, even if the *autoRebuilt* parameter is set to false. This will make managing the state of the indicator widget simpler.
55
- **IndicatorController**:
66
- The controller now extends *Animation<double>*. This allows it to be used directly with *Transition* widgets to further improve animation performance.

example/lib/indicators/check_mark_indicator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class _CheckMarkIndicatorState extends State<CheckMarkIndicator> with SingleTick
5151
Widget build(BuildContext context) {
5252
return CustomRefreshIndicator(
5353
onRefresh: () => Future.delayed(const Duration(seconds: 2)),
54-
completeStateDuration: const Duration(seconds: 2),
54+
completeDuration: const Duration(seconds: 2),
5555
onStateChanged: (change) {
5656
/// set [_renderCompleteState] to true when controller.state become completed
5757
if (change.didChange(to: IndicatorState.complete)) {

lib/src/custom_refresh_indicator.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class CustomRefreshIndicator extends StatefulWidget {
6666

6767
/// Duration for which the indicator remains at value of *1.0* and
6868
/// [IndicatorState.complete] state after the [onRefresh] function completes.
69-
final Duration? completeStateDuration;
69+
final Duration? completeDuration;
7070

7171
/// Determines whether the received [ScrollNotification] should
7272
/// be handled by this widget.
@@ -161,7 +161,8 @@ class CustomRefreshIndicator extends StatefulWidget {
161161
Duration settleDuration = const Duration(milliseconds: 150),
162162
@Deprecated('In favor of finalizeDuration') Duration? indicatorFinalizeDuration,
163163
Duration finalizeDuration = const Duration(milliseconds: 100),
164-
this.completeStateDuration,
164+
@Deprecated('In favor of completeDuration') Duration? completeStateDuration,
165+
Duration? completeDuration,
165166
this.leadingScrollIndicatorVisible = false,
166167
this.trailingScrollIndicatorVisible = true,
167168
}) : assert(
@@ -172,6 +173,7 @@ class CustomRefreshIndicator extends StatefulWidget {
172173
cancelDuration = indicatorCancelDuration ?? cancelDuration,
173174
finalizeDuration = indicatorFinalizeDuration ?? finalizeDuration,
174175
settleDuration = indicatorSettleDuration ?? settleDuration,
176+
completeDuration = completeStateDuration ?? completeDuration,
175177
// set the default extent percentage value if not provided
176178
containerExtentPercentageToArmed = containerExtentPercentageToArmed ?? defaultContainerExtentPercentageToArmed,
177179
super(key: key);
@@ -542,7 +544,7 @@ class CustomRefreshIndicatorState extends State<CustomRefreshIndicator> with Tic
542544
if (!mounted) return;
543545

544546
/// optional complete state
545-
final completeStateDuration = widget.completeStateDuration;
547+
final completeStateDuration = widget.completeDuration;
546548
if (completeStateDuration != null) {
547549
setIndicatorState(IndicatorState.complete);
548550
await Future.delayed(completeStateDuration);

test/src/custom_refresh_indicator_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ void main() {
10111011
onStateChanged: (change) => changes.add(change),
10121012
builder: buildWithoutIndicator,
10131013
onRefresh: fakeRefresh.instantRefresh,
1014-
completeStateDuration: const Duration(milliseconds: 300),
1014+
completeDuration: const Duration(milliseconds: 300),
10151015
child: const DefaultList(itemsCount: 1),
10161016
),
10171017
),

0 commit comments

Comments
 (0)