Skip to content

Commit

Permalink
fix: [EasyRefreshController.callRefresh] and [EasyRefreshController.c…
Browse files Browse the repository at this point in the history
…allLoad] add force (#633) (#642). Thanks percival888 for (#639).
  • Loading branch information
xuelongqy committed Nov 16, 2022
1 parent 5d6c4d4 commit 425c47e
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 235 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Next
> fix: [EasyRefreshController.callRefresh] and [EasyRefreshController.callLoad] add force [#633](https://github.com/xuelongqy/flutter_easy_refresh/issues/633) [#642](https://github.com/xuelongqy/flutter_easy_refresh/issues/642). Thanks percival888 for [PR#639](https://github.com/xuelongqy/flutter_easy_refresh/issues/639).
## V 3.0.4+4
> fix: Type 'SpringDescription' not found [#638](https://github.com/xuelongqy/flutter_easy_refresh/issues/638).
Expand Down
3 changes: 0 additions & 3 deletions example/lib/config/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:example/page/sample/chat_page.dart';
import 'package:example/page/sample/listener_header_page.dart';
import 'package:example/page/sample/nested_scroll_view.dart';
import 'package:example/page/sample/page_view_page.dart';
import 'package:example/page/sample/refresh_multiple_times_page.dart';
import 'package:example/page/sample/refresh_on_start_page.dart';
import 'package:example/page/sample/sample_page.dart';
import 'package:example/page/sample/secondary_page.dart';
Expand Down Expand Up @@ -37,7 +36,6 @@ class Routes {
static const nestedScrollViewSample = '/sample/nested-scroll-view';
static const carouselSample = '/sample/carousel';
static const refreshOnStartSample = '/sample/refresh-on-start';
static const refreshMutipleTimes = '/sample/refresh-mutiple-times';
static const listenerSample = '/sample/listener';
static const secondarySample = '/sample/secondary';
static const chatSample = '/sample/chat';
Expand Down Expand Up @@ -72,7 +70,6 @@ class Routes {
name: nestedScrollViewSample, page: () => const NestedScrollViewPage()),
GetPage(name: carouselSample, page: () => const CarouselPage()),
GetPage(name: refreshOnStartSample, page: () => const RefreshOnStartPage()),
GetPage(name: refreshMutipleTimes, page: () => const RefreshMutipleTimesPage()),
GetPage(name: listenerSample, page: () => const ListenerHeaderPage()),
GetPage(name: secondarySample, page: () => const SecondaryPage()),
GetPage(name: chatSample, page: () => const ChatPage()),
Expand Down
211 changes: 0 additions & 211 deletions example/lib/page/sample/refresh_multiple_times_page.dart

This file was deleted.

8 changes: 0 additions & 8 deletions example/lib/page/sample/sample_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ class _SamplePageState extends State<SamplePage> {
icon: Icons.refresh,
onTap: () => Get.toNamed(Routes.refreshOnStartSample),
),
ListItem(
title: 'Refresh mutiple times'.tr,
subtitle:
'Modify the filter conditions during the refresh process and refresh again'
.tr,
icon: Icons.refresh,
onTap: () => Get.toNamed(Routes.refreshMutipleTimes),
),
ListItem(
title: 'Listener'.tr,
subtitle: 'Use listener to respond anywhere'.tr,
Expand Down
3 changes: 1 addition & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ dependencies:
url_launcher: ^6.1.5
flutter_spinkit: ^5.1.0
flare_flutter: ^3.0.2
extended_nested_scroll_view: 5.1.3
# path: ../../extended_nested_scroll_view
extended_nested_scroll_view: ^5.1.3
get: ^4.6.5
convert: ^3.0.2
carousel_slider: ^4.1.1
Expand Down
6 changes: 3 additions & 3 deletions example/windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

#include "generated_plugin_registrant.h"

#include <url_launcher_windows/url_launcher_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
UrlLauncherPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
6 changes: 6 additions & 0 deletions lib/src/controller/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,20 @@ class EasyRefreshController {
/// [duration] See [ScrollPosition.animateTo].
/// [curve] See [ScrollPosition.animateTo].
/// [scrollController] When position is not [ScrollPosition], you can use [ScrollController].
/// [force] Enforce execution even if the task is in progress. But you have to handle the completion event.
Future callRefresh({
double? overOffset,
Duration? duration = const Duration(milliseconds: 200),
Curve curve = Curves.linear,
ScrollController? scrollController,
bool force = false,
}) async {
await _state?._callRefresh(
overOffset: overOffset,
duration: duration,
curve: curve,
scrollController: scrollController,
force: force,
);
}

Expand All @@ -48,17 +51,20 @@ class EasyRefreshController {
/// [duration] See [ScrollPosition.animateTo].
/// [curve] See [ScrollPosition.animateTo].
/// [scrollController] When position is not [ScrollPosition], you can use [ScrollController].
/// [force] Enforce execution even if the task is in progress. But you have to handle the completion event.
Future callLoad({
double? overOffset,
Duration? duration = const Duration(milliseconds: 300),
Curve curve = Curves.linear,
ScrollController? scrollController,
bool force = false,
}) async {
await _state?._callLoad(
overOffset: overOffset,
duration: duration,
curve: curve,
scrollController: scrollController,
force: force,
);
}

Expand Down
8 changes: 7 additions & 1 deletion lib/src/easy_refresh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class EasyRefresh extends StatefulWidget {
super(key: key);

@override
_EasyRefreshState createState() => _EasyRefreshState();
State<StatefulWidget> createState() => _EasyRefreshState();

static EasyRefreshData of(BuildContext context) {
final inheritedEasyRefresh =
Expand Down Expand Up @@ -418,17 +418,20 @@ class _EasyRefreshState extends State<EasyRefresh>
/// [duration] See [ScrollPosition.animateTo].
/// [curve] See [ScrollPosition.animateTo].
/// [scrollController] When position is not [ScrollPosition], you can use [ScrollController].
/// [force] Enforce execution even if the task is in progress. But you have to handle the completion event.
Future _callRefresh({
double? overOffset,
Duration? duration,
Curve curve = Curves.linear,
ScrollController? scrollController,
bool force = false,
}) {
return _headerNotifier.callTask(
overOffset: overOffset ?? widget.callRefreshOverOffset,
duration: duration,
curve: curve,
scrollController: scrollController ?? widget.scrollController,
force: force,
);
}

Expand All @@ -437,17 +440,20 @@ class _EasyRefreshState extends State<EasyRefresh>
/// [duration] See [ScrollPosition.animateTo].
/// [curve] See [ScrollPosition.animateTo].
/// [scrollController] When position is not [ScrollPosition], you can use [ScrollController].
/// [force] Enforce execution even if the task is in progress. But you have to handle the completion event.
Future _callLoad({
double? overOffset,
Duration? duration,
Curve curve = Curves.linear,
ScrollController? scrollController,
bool force = false,
}) {
return _footerNotifier.callTask(
overOffset: overOffset ?? widget.callRefreshOverOffset,
duration: duration,
curve: curve,
scrollController: scrollController ?? widget.scrollController,
force: force,
);
}

Expand Down
Loading

0 comments on commit 425c47e

Please sign in to comment.