Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3版本下拉刷新有几率不会弹 #572

Closed
LailaiMaster opened this issue Jul 18, 2022 · 17 comments
Closed

v3版本下拉刷新有几率不会弹 #572

LailaiMaster opened this issue Jul 18, 2022 · 17 comments

Comments

@LailaiMaster
Copy link

大概是因为IndicatorMode.done之后 不会变成IndicatorMode.inactive

@LailaiMaster
Copy link
Author

CupertinoHeader 没问题,ClassicHeader 有这个问题

@xuelongqy
Copy link
Owner

不回弹是指?有简单的示例吗?

@LailaiMaster
Copy link
Author

不回弹是指?有简单的示例吗?

刚刚我在v3的example里尝试复现,发现是在嵌套https://pub.dev/packages/card_swiper 这个后会出现这种情况。

@LailaiMaster
Copy link
Author

https://github.com/LailaiMaster/flutter_easy_refresh/tree/issue 我在这里写了一个demo。您可以看下。

@xuelongqy
Copy link
Owner

如果有滚动嵌套,请使用EasyRefresh.builder或用ScrollConfiguration设置作用域。README中写得有哈

@syssam
Copy link

syssam commented Jul 18, 2022

@xuelongqy 沒有滾動嵌套都會出現這個問題

@xuelongqy
Copy link
Owner

EasyRefresh.builder

我试过EasyRefresh.builder,没有问题哈

@LailaiMaster
Copy link
Author

EasyRefresh.builder

我试过EasyRefresh.builder,没有问题哈

可以给个demo吗,v3的example里没有builder的使用例子 @xuelongqy

@xuelongqy
Copy link
Owner

readme

@syssam
Copy link

syssam commented Jul 19, 2022

class _MyHomePageState extends State<MyHomePage> {
  int _count = 15;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: EasyRefresh(
        header: const CupertinoHeader(),
        onRefresh: () async {
          if (!mounted) {
            return IndicatorResult.none;
          }
          await Future.delayed(const Duration(seconds: 1));
          setState(() {
            _count = 15;
          });
          return IndicatorResult.success;
        },
        onLoad: () async {
          if (!mounted) {
            return IndicatorResult.none;
          }
          await Future.delayed(const Duration(seconds: 1));
          setState(() {
            _count += 5;
          });
          return IndicatorResult.success;
        },
        footer: const CupertinoFooter(),
        child: ListView.builder(
          padding: EdgeInsets.zero,
          itemCount: _count,
          itemBuilder: (context, index) {
            return ListTile(
              title: Text(index.toString()),
            );
          },
        ),
      ),
    );
  }
}

測試步驟:

  1. 加載更多
  2. 向上刷新

結果: 向上刷新不會停止

@xuelongqy please follow up

@xuelongqy xuelongqy reopened this Jul 19, 2022
@syssam
Copy link

syssam commented Jul 20, 2022

E/flutter (17473): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: LateInitializationError: Field '_position@336089737' has not been initialized.
E/flutter (17473): #0      IndicatorNotifier._position (package:easy_refresh/src/notifier/indicator_notifier.dart)
E/flutter (17473): #1      HeaderNotifier.animateToOffset (package:easy_refresh/src/notifier/indicator_notifier.dart:879:8)
E/flutter (17473): #2      IndicatorNotifier.callTask (package:easy_refresh/src/notifier/indicator_notifier.dart:375:12)
E/flutter (17473): #3      _EasyRefreshState._callRefresh (package:easy_refresh/src/easy_refresh.dart:417:28)
E/flutter (17473): #4      _EasyRefreshState.initState.<anonymous closure> (package:easy_refresh/src/easy_refresh.dart:288:9)
E/flutter (17473): #5      new Future.<anonymous closure> (dart:async/future.dart:252:37)
E/flutter (17473): #6      _rootRun (dart:async/zone.dart:1418:47)
E/flutter (17473): #7      _CustomZone.run (dart:async/zone.dart:1328:19)
E/flutter (17473): #8      _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
E/flutter (17473): #9      _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
E/flutter (17473): #10     _rootRun (dart:async/zone.dart:1426:13)
E/flutter (17473): #11     _CustomZone.run (dart:async/zone.dart:1328:19)
E/flutter (17473): #12     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1260:23)
E/flutter (17473): #13     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
E/flutter (17473): #14     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter (17473): #15     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter (17473): #16     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

@xuelongqy please follow up

@xyhuangjia
Copy link

E/flutter (17473): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: LateInitializationError: Field '_position@336089737' has not been initialized.
E/flutter (17473): #0      IndicatorNotifier._position (package:easy_refresh/src/notifier/indicator_notifier.dart)
E/flutter (17473): #1      HeaderNotifier.animateToOffset (package:easy_refresh/src/notifier/indicator_notifier.dart:879:8)
E/flutter (17473): #2      IndicatorNotifier.callTask (package:easy_refresh/src/notifier/indicator_notifier.dart:375:12)
E/flutter (17473): #3      _EasyRefreshState._callRefresh (package:easy_refresh/src/easy_refresh.dart:417:28)
E/flutter (17473): #4      _EasyRefreshState.initState.<anonymous closure> (package:easy_refresh/src/easy_refresh.dart:288:9)
E/flutter (17473): #5      new Future.<anonymous closure> (dart:async/future.dart:252:37)
E/flutter (17473): #6      _rootRun (dart:async/zone.dart:1418:47)
E/flutter (17473): #7      _CustomZone.run (dart:async/zone.dart:1328:19)
E/flutter (17473): #8      _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
E/flutter (17473): #9      _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
E/flutter (17473): #10     _rootRun (dart:async/zone.dart:1426:13)
E/flutter (17473): #11     _CustomZone.run (dart:async/zone.dart:1328:19)
E/flutter (17473): #12     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1260:23)
E/flutter (17473): #13     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
E/flutter (17473): #14     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter (17473): #15     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter (17473): #16     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

@xuelongqy please follow up

我也出现这个问题了?要怎么改啊

@xuelongqy
Copy link
Owner

已修复。可以直接引用github,或者等下个版本发布

@xyhuangjia
Copy link

已修复。可以直接引用github,或者等下个版本发布

最新代码示例代码 @@testpage, 点击右下角按钮 也报Unhandled Exception: LateInitializationError: Field '_position 错误 @xuelongqy

@xuelongqy
Copy link
Owner

v3.0.3已解决

@git-maven
Copy link

CupertinoHeader

当在Tabbview中, 有CarouselSlider + Listview 使用ClassicHeader会继续出现不会回弹问题
版本3.0.4+1

@xuelongqy
Copy link
Owner

CupertinoHeader

当在Tabbview中, 有CarouselSlider + Listview 使用ClassicHeader会继续出现不会回弹问题 版本3.0.4+1

Readme中提到的physics作用域,试试呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants