Open wwpeng520 opened 3 years ago
any solution for this same problem with me after upgrade to flutter 2
this assert is intented.If you are sure that you only use one controller to one SmartRefresher.Please attach more details to reproduce bug.If you are using redux or fish redux,you may check if it is using by mutiple SmartRefresher at the same time.
i use provider pattern and i am using one controller before i upgrade to flutter 2 every thing run as expected but now after upgrade it's throw this error
@devmfouad Can you give an example code to reproduce(no third party library)?I have no time to check how to reproduce this,hope you can understand.
this issue example code doesn't show more details,so I don't know if this crash in a special stiuation or user fault.If user fault it need you to fix your code,if you don't know how to fix,I suggest you to stackoverflow,it contains many stiuation,I think his problem is redux global refreshController cause crash.If this crash in a special stiuation, I will revert it.
I think this issue occurred when we refresh the whole widget. You can try using setstate{} to reproduce this issue.
same error when using PageView.builder and SmartRefresher after upgrade flutter 2.0
PageView.builder( itemBuilder: (context, position) { return return SmartRefresher(); }, itemCount: itemCount, )
If you are using PageView or TabBarView crash this.You may use one RefreshController to mutiple SmartRefresher I have said before.just like this.
this is a wrong doing
RefreshController _refreshController = RefreshController();
...
return PageView.builder(
itemBuilder: (context, position) {
return SmartRefresher(
controller: _refreshController[position],
child: Container(color: Colors.white,),
);
},
itemCount: 4,
);
you need to fix code to work
List<RefreshController> _refreshController = [RefreshController(),RefreshController(),RefreshController(),RefreshController()];
return PageView.builder(
itemBuilder: (context, position) {
return SmartRefresher(
controller: _refreshController[position],
child: Container(color: Colors.white,),
);
},
itemCount: 4,
);
noted with thanks, this will be better?
return PageView.builder(
itemBuilder: (context, position) {
final RefreshController _refreshController = RefreshController(initialRefresh: false);
return SmartRefresher(
controller: _refreshController ,
child: Container(color: Colors.white,),
);
},
itemCount: 4,
);
If you are using PageView or TabBarView crash this.You may use one RefreshController to mutiple SmartRefresher I have said before.just like this.
this is a wrong doing
RefreshController _refreshController = RefreshController(); ... return PageView.builder( itemBuilder: (context, position) { return SmartRefresher( controller: _refreshController[position], child: Container(color: Colors.white,), ); }, itemCount: 4, );
you need to fix code to work
List<RefreshController> _refreshController = [RefreshController(),RefreshController(),RefreshController(),RefreshController()]; return PageView.builder( itemBuilder: (context, position) { return SmartRefresher( controller: _refreshController[position], child: Container(color: Colors.white,), ); }, itemCount: 4, );
thanks this fix my problem
return PageView.builder( itemBuilder: (context, position) { final RefreshController _refreshController = RefreshController(initialRefresh: false); return SmartRefresher( controller: _refreshController[position], child: Container(color: Colors.white,), ); }, itemCount: 4, );
@peng8350 I had the same problem
I only have one page of the BottomBar that uses the SmartreFresher
包含底部多个bottomNavigationBar页面,其中一个页面使用SmartRefresher,初次进入改页面正常,从此页面跳到其他bottomNavigationBar页面,然后返回此页面报错
1.6.4-nullsafety.0版本没有此错误
此页面之前不含TabBarView组件 主要代码如下: