-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
[Bug report] Looking up a deactivated widget's ancestor is unsafe. #52
Comments
把你写的loaddata 代码发出来 |
71_1690799163.mp4 |
|
有没有能运行的最小的demo |
对的,应该就是每一次构建这个组件的时候,当数据还未加载完毕时,然后点住上滑就发生报错 |
重现不了,你再怎么拉,内部 有 isloading 属性,不会重复去请求的。请提供一个能够重现现象的 demo |
他这个就可以呀,我版本是 3.10.6 。进入时按住屏幕慢慢滑动就会复现了 |
大佬怎么样,复现出来了吗? |
没有 |
7_1691394508.mp4flutter版本3.10.6,你给的demo中complex->nestedScrollView这个demo中,tab2这个页面你在加载的时候就去上下滑动页面,就可以看到报错了。 |
QQ20230807-165259-HD.mp4 |
2023-08-08.16.14.09.mov复现+1 |
看起来更像是 NestedScrollView 的问题,之前老的flutter 版本会有这个问题吗? |
3.3.9的版本没有这个问题,您可以试一下升到3.10.5,应该会有这个报错的 |
官方重现代码 import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: RefreshList(),
));
}
class RefreshList extends StatefulWidget {
@override
State<RefreshList> createState() => _RefreshListState();
}
class _RefreshListState extends State<RefreshList> {
bool _isLoading = true;
@override
void initState() {
// TODO: implement initState
super.initState();
Future<void>.delayed(Duration(seconds: 2)).whenComplete(() {
setState(() {
_isLoading = false;
});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('RefreshList'),
),
// AppBar
body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return [
const SliverToBoxAdapter(
child: SizedBox(
height: 90.0,
),
),
];
},
body: _isLoading
? CustomScrollView(
physics: AlwaysScrollableScrollPhysics(),
slivers: <Widget>[
SliverFillRemaining(
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
margin: const EdgeInsets.only(right: 0.0),
height: 30.0,
width: 30.0,
child: getIndicator(context),
),
Text('loading...')
],
)),
),
],
)
: ListView.builder(itemBuilder: (b, index) {
return Container(
child: Text('$index'),
);
})),
);
}
Widget getIndicator(BuildContext context) {
final ThemeData theme = Theme.of(context);
return theme.platform == TargetPlatform.iOS
? const CupertinoActivityIndicator(
animating: true,
radius: 16.0,
)
: CircularProgressIndicator(
strokeWidth: 2.0,
valueColor: AlwaysStoppedAnimation<Color>(theme.primaryColor),
);
}
}
|
官方issue追踪: flutter/flutter#132190 |
好的,感谢指出问题所在 |
大佬我用了你的demo去降级排查了一下,发现3.3.9以及2.10.5都会出现这个问题,所以具体哪个版本出问题我也不知道了 |
还是官方的锅吧。建议你们把 physics 改成 安卓的那个就没事。。我一直都用的安卓的 |
官方说下一个stable修复了。到时候大家再看看这个问题吧。有问题我再跟官方report |
嗯嗯好的 |
Version
4.1.2
Platforms
dart, Android, iOS
Device Model
iPhone X iOS16
flutter info
How to reproduce?
1、When you first go to the page which you use the widget, sometime it will show the error.
2、When you refresh your list, before the data getting, you hold the screen and then you will receive the error.
Logs
Example code (optional)
No response
Contact
[email protected]
The text was updated successfully, but these errors were encountered: