Closed wumeixinjiazu closed 1 year ago
This issue is stale because it has been open for 30 days with no activity.
我没用过boost , 我觉得可以尝试用自己从原生传过来尺寸试试效果
@override Widget build(BuildContext context) { ScreenUtil.init(context, designSize: const Size(375, 812)); return ListView( children:[ Text('sdfsdf',style:TextStyle(fontSize:16..w)) ])
报错
Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by
calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
/// 当前设备宽度 dp /// The horizontal extent of this size. double get screenWidth => _context != null ? MediaQuery.of(_context!).size.width : _screenWidth;
context 出了问题 但是 不是listView 使用 SingleScroll + Colum 不会出错 一直没搞懂原因
只有 第一次启动会出问题
搞个一个插件 可以适用于 android平台 和 iOS平台 https://pub.flutter-io.cn/packages/screen_adapter
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
楼主解决了吗
从原生跳Flutter页面第一次会黑屏几秒然后就正常看到页面 第二次之后都正常。。有什么解决方法嘛,初始化代码如下: void main() async{ ///这里的CustomFlutterBinding调用务必不可缺少,用于控制Boost状态的resume和pause MyFlutterBinding(); await ScreenUtil.ensureScreenSize(); runApp(const MyApp()); }
Widget appBuilder(Widget home) {
}
@override Widget build(BuildContext context) { return FlutterBoostApp( routeFactory, appBuilder: appBuilder, ); }