flutter 修改安卓物理键背景颜色等,SystemUiOverlayStyle

内容分享2天前发布
0 1 0


  SystemUiOverlayStyle systemUiOverlayStyle =
  const SystemUiOverlayStyle(
    statusBarColor: Colors.transparent,//状态栏
    systemNavigationBarColor:Color(0xffffffff),//虚拟按键背景色
    systemNavigationBarDividerColor: Colors.transparent,
    systemNavigationBarIconBrightness: Brightness.dark,//虚拟按键图标色
    statusBarIconBrightness: Brightness.light,
    statusBarBrightness: Brightness.light,
  );
  SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);

放在 main(){}最后面

在页面 里也可以修改


  @override
  Widget build(BuildContext context) {
  SystemUiOverlayStyle systemUiOverlayStyle =
  const SystemUiOverlayStyle(
    statusBarColor: Colors.transparent,//状态栏
    systemNavigationBarColor:Color(0xffffffff),//虚拟按键背景色
    systemNavigationBarDividerColor: Colors.transparent,
    systemNavigationBarIconBrightness: Brightness.dark,//虚拟按键图标色
    statusBarIconBrightness: Brightness.light,
    statusBarBrightness: Brightness.light,
  );

    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: systemUiOverlayStyle, //SystemUiOverlayStyle.dark,
      child: ..., //getBody
    );
  }

© 版权声明

相关文章

1 条评论

  • 头像
    春和纪野 投稿者

    怎么透明呢

    无记录
    回复