flutter_boost icon indicating copy to clipboard operation
flutter_boost copied to clipboard

沉浸式状态栏

Open Ronadlo7 opened this issue 3 years ago • 7 comments

原生跳转到flutter ,flutter中设置的沉浸状态就无效了

Ronadlo7 avatar Jul 20 '21 08:07 Ronadlo7

使用了哪个版本,能给一个可复现的demo吗

ColdPaleLight avatar Jul 20 '21 08:07 ColdPaleLight

就是最新的呀

Ronadlo7 avatar Jul 21 '21 01:07 Ronadlo7

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());

22

Ronadlo7 avatar Jul 21 '21 01:07 Ronadlo7

其实可以通过修改FlutterBoostActivity的主题设置 true

但是这种情况第一次跳转到flutter页面时可以的,但是返回重新进入flutter就不行了,主要原因是 if (Platform.isAndroid) { SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle( statusBarColor: Colors.transparent, ); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); } 这段之后只会执行一次,第二次就不执行导致无效,有没有方法解决

Ronadlo7 avatar Jul 21 '21 02:07 Ronadlo7

其实可以通过修改FlutterBoostActivity的主题设置 true

但是这种情况第一次跳转到flutter页面时可以的,但是返回重新进入flutter就不行了,主要原因是 if (Platform.isAndroid) { SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle( statusBarColor: Colors.transparent, ); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); } 这段之后只会执行一次,第二次就不执行导致无效,有没有方法解决

这段代码放哪儿的,为什么没有执行?你能在boost的example里面增加一个可复现的案例吗?

0xZOne avatar Jul 21 '21 06:07 0xZOne

@Ronadlo7 请问这个问题怎么解决的?谢谢

gaoqianZ avatar Nov 26 '21 07:11 gaoqianZ

请问这个问题怎么解决的?谢谢

请问这个问题怎么解决的?谢谢

XIMOTIAN avatar Mar 27 '23 08:03 XIMOTIAN