Skip to content

Commit

Permalink
fix bug:indicator too fast disappear when loadmore complete (temporary)
Browse files Browse the repository at this point in the history
  • Loading branch information
peng8350 committed Sep 22, 2020
1 parent 99f8ad9 commit e9e7005
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gifimage/flutter_gifimage.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

import '../../Item.dart';
Expand Down
3 changes: 3 additions & 0 deletions lib/src/internals/indicator_wrap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ abstract class LoadIndicatorState<T extends LoadIndicator> extends State<T>
return;
}

// this line for patch bug temporary:indicator disappears fastly when load more complete
if(mounted)
Scrollable.of(context).position.correctBy(0.00001);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted && _position?.outOfRange == true) {
activity.delegate.goBallistic(0);
Expand Down
5 changes: 3 additions & 2 deletions lib/src/smart_refresher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -737,17 +737,18 @@ class RefreshController {
}

/// end twoLeveling,will return back first floor
void twoLevelComplete(
Future<void> twoLevelComplete(
{Duration duration: const Duration(milliseconds: 500),
Curve curve: Curves.linear}) {
headerMode?.value = RefreshStatus.twoLevelClosing;
WidgetsBinding.instance.addPostFrameCallback((_) {
position
return position
.animateTo(0.0, duration: duration, curve: curve)
.whenComplete(() {
headerMode.value = RefreshStatus.idle;
});
});
return null;
}

/// request failed,the header display failed state
Expand Down

0 comments on commit e9e7005

Please sign in to comment.