flutter_boost
flutter_boost copied to clipboard
沉浸式状态栏
原生跳转到flutter ,flutter中设置的沉浸状态就无效了
使用了哪个版本,能给一个可复现的demo吗
就是最新的呀
1.使用版本: flutter_boost: git: url: 'https://github.com/alibaba/flutter_boost.git' ref: 'v3.0-preview.8'
2.android 中通过: FlutterBoostRouteOptions options = new FlutterBoostRouteOptions.Builder() .pageName("secondPage") .arguments(new HashMap<>()) .requestCode(1111) .build(); FlutterBoost.instance().open(options);
3.flutter 中main.dart中:
//在runApp之前确保BoostFlutterBinding初始化
CustomFlutterBinding(); WidgetsFlutterBinding.ensureInitialized();
//限制横屏 SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, //只能纵向 DeviceOrientation.portraitDown, //只能纵向 ]); // 沉浸式开始 if (Platform.isAndroid) { SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle( statusBarColor: Colors.transparent, ); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); } runApp(MyApp());
其实可以通过修改FlutterBoostActivity的主题设置
但是这种情况第一次跳转到flutter页面时可以的,但是返回重新进入flutter就不行了,主要原因是 if (Platform.isAndroid) { SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle( statusBarColor: Colors.transparent, ); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); } 这段之后只会执行一次,第二次就不执行导致无效,有没有方法解决
其实可以通过修改FlutterBoostActivity的主题设置 true
但是这种情况第一次跳转到flutter页面时可以的,但是返回重新进入flutter就不行了,主要原因是 if (Platform.isAndroid) { SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle( statusBarColor: Colors.transparent, ); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); } 这段之后只会执行一次,第二次就不执行导致无效,有没有方法解决
这段代码放哪儿的,为什么没有执行?你能在boost的example里面增加一个可复现的案例吗?
@Ronadlo7 请问这个问题怎么解决的?谢谢
请问这个问题怎么解决的?谢谢
请问这个问题怎么解决的?谢谢