-
Notifications
You must be signed in to change notification settings - Fork 727
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
随着数据量越多,越来越卡顿。并且到达一定程度页面卡死 #229
Comments
今天已经能够100%复现了,就是返回从下一级页面返回到有pulltorefresh的页面的时候,再次下拉就会卡死,请问这个该怎么解决? |
@medz 确实是用法问题,shrinkWrap这属性它会把Viewport展开到跟里面所有内容一样的大小,也就是说里面每个item没有缓存,你可以在item里dispose打个log,它是不会调用的当shrinkwrap=true,这么多item显示在一个界面肯定炸呀。你这里没必要使用shrinkWrap+NeverScroll,ListView.builder直接作为SmartRefresher's child |
关闭了,这个问题我在开启shrinkWrap了就可以完美重现了,我很肯定就是shrinkWrap导致卡顿。如果有出现卡顿或者数据量到达某个程度无法滑动(回退到初始位置)的问题,解决方法就是把ListView或GridView或CustomScrollView作为SmartRefresher的child。切记不要开启shrinkWrap且与SmartRefresher的child分离。 |
如果关闭了shrinkWrap,高度就没有办法自动计算了,怎么解决动态添加数据,是否有好的方案实现 |
我现在用法基本就是按照标准用法,将 CustomScrollView 作为 SmartRefresher 的 child!之前版本修改过然后不再卡顿。现在是即使这种标准用法也会卡顿! |
接上一个,这个在 Android 环境下和 iOS 测试环境下不卡顿,使用 Xcode 正式打包出来的 ipa 安装后,下拉太长会卡顿!轻轻下拉很近刚好能触发刷新的时候不卡顿。下拉很长距离才会卡顿。我测了另一个下拉刷新组件和 flutter 自带的下拉组件都不会出现这个问题! |
@CodeGather 你误解了吧,没说一定不能使用shrinkWrap,如果你想SmartRefresher嵌套在某个ListView的内部,你可以开启shrinkwrap(在SmartRefresher属性有shrinkWrap),事实上SmartRefresher也就是一个CustomScrollView来的。不过,说实在我很少见有下拉刷新套在ListView里面的需求。 |
Hi, @medz. I'm wondering that how do you implement this tab and bottom bar ? Do you use any dependencies or plugins? I know this is definitely not the right place to ask this kind of question, but I can't figure out how to contact you, my apologies here. |
Multiple Scaffold widgets can be nested. Scaffold can be nested. |
@TENX-S Multiple Scaffold widgets can be nested. Scaffold can be nested. |
Thank you for the reply. I seem to understand a bit. And if it doesn't bother you too much, would you mind sending me a demo to learn some stuff like that. Best regards! |
@TENX-S Code: import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int index = 1;
PageController pageController;
@override
void initState() {
super.initState();
pageController = PageController(
initialPage: index,
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageView(
controller: pageController,
children: [
HomePage(),
Explore(),
Search(),
],
physics: const NeverScrollableScrollPhysics(),
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: index,
onTap: (int index) {
this.setState(() {
this.index = index;
pageController.jumpToPage(index);
});
},
items: [
BottomNavigationBarItem(
label: 'Home',
icon: Icon(Icons.home)
),
BottomNavigationBarItem(
label: 'Explore',
icon: Icon(Icons.explore)
),
BottomNavigationBarItem(
label: 'Search',
icon: Icon(Icons.explore)
),
],
),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin {
TabController controller;
@override
void initState() {
super.initState();
controller = TabController(initialIndex: 0, length: 3, vsync: this);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: TabBar(tabs: [
Tab(text: 'Tab 1'),
Tab(text: 'Tab 2'),
Tab(text: 'Tab 2'),
],
controller: controller,
isScrollable: true
),
),
body: TabBarView(
controller: controller,
children: [
Text('Tab 1'),
Text('Tab 2'),
Text('Tab 3'),
],
),
);
}
}
class Explore extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Explore'),
),
);
}
}
class Search extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Text('Search');
}
} |
Thanks a lot! |
偶尔存在下拉卡顿,然后页面卡死
The text was updated successfully, but these errors were encountered: