Futter 学习Flutter基础学习篇Flutter笔记

Flutter 设置状态栏字体黑白颜色

2019-07-23  本文已影响0人  哦买噶_6da8

方法一:使用 方法 SystemChrome.setSystemUIOverlayStyle

SystemChrome.setSystemUIOverlayStyle(
 Theme.of(context).brightness == Brightness.dark 
? SystemUiOverlayStyle.light 
: SystemUiOverlayStyle.dark)

方法二:使用 AnnotatedRegion

return AnnotatedRegion<SystemUiOverlayStyle>(
  value: SystemUiOverlayStyle.dark,
  child:Text("状态栏颜色"),
); 

方法三:使用 AppBar自动适配

return Scaffold(
      appBar: AppBar(
        title: Text('标题'),
      ),
    );
上一篇 下一篇

猜你喜欢

热点阅读