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


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

© 版权声明
THE END
如果内容对您有所帮助,就支持一下吧!
点赞0 分享
简从一的头像 - 鹿快
评论 共1条

请登录后发表评论