flutter爬坑记录

2019-09-26  本文已影响0人  6d539edef498

1、场景:第一个页面跳转第二个页面,第二个页面跳转第三个页面,在第三个页面中点击back键返回上一个页面,报错_children.contains(child)': is not true

解决方案:经查阅资料如https://github.com/flutter/flutter/issues/21675,分析这种问题一般是页面布局绘制问题,我的问题是因为用到了customPainter自定义绘制类引起的,用图片代替就OK了。

2.NestedScrollView报错https://github.com/flutter/flutter/issues/28351

修改NestedScrollView源码中方法:    

boolget hasScrolledBody {

for (_NestedScrollPosition positionin _innerPositions) {

if (position.minScrollExtent==null)return true;// patch here

    if (position.pixels > position.minScrollExtent)

return true;

}

return false;

}

3、BLOC中的路由跳转问题https://blog.csdn.net/lb_383691051/article/details/96447478

Navigator.push(context,

MaterialPageRoute(builder: (context) {

return BlocProvider(

builder: (context) => SimpleBloc(),

            child: ARoute(),

        );

}));

跳转时套一层BlocProvider即可

上一篇下一篇

猜你喜欢

热点阅读