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

2.1.6版本中上拉加载后,不能下拉刷新的问题 #392

Closed
impyf104 opened this issue Nov 11, 2020 · 3 comments
Closed

2.1.6版本中上拉加载后,不能下拉刷新的问题 #392

impyf104 opened this issue Nov 11, 2020 · 3 comments

Comments

@impyf104
Copy link

impyf104 commented Nov 11, 2020

1.Flutter版本:1.22.3

2.flutter_easyrefresh版本:2.1.6

3.问题描述:
在EasyRefresh中的onLoad函数中使用await后,上拉加载会出现卡在加载中的状态,footer不消失,使得不能继续使用上拉加载和下拉刷新,多次上拉后可复现。
若使用then,onLoad可能会执行2次。

4.可复现代码
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

final String title;

@OverRide
_MyHomePageState createState() => _MyHomePageState();
}

Future onLoad() async {
await Future.delayed(Duration(milliseconds: 300));
print('await onLoad');
}

Future onLoadThen() async {
Future.delayed(Duration(milliseconds: 300)).then((value) {
print('then onLoad');
});
}

Future onRefresh() async {
await Future.delayed(Duration(milliseconds: 300));
}

class _MyHomePageState extends State {
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: EasyRefresh(
child: ListView.builder(
itemBuilder: (BuildContext context, int index) {
return Text('$index');
},
itemCount: 10,
),
onLoad: onLoad,
// onLoad: onLoadThen,
onRefresh: onRefresh,
),
);
}
}

@junixapp
Copy link

junixapp commented Nov 12, 2020

数据为空的时候,并且设置了emptyWidget,上拉必卡住。必现

@shuizhuyu1015
Copy link

me too. footer的enableInfiniteLoad设置为false,上拉加载必会卡主无法加载,同时无法下拉刷新,enableInfiniteLoad设为true到底部自动触发加载可解决

@xuelongqy
Copy link
Owner

v2.1.8已修复

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

4 participants