在Flutter中将底部栏更改为任何颜色

e5njpo68  于 2023-05-19  发布在  Flutter
关注(0)|答案(1)|浏览(297)

如何在Flutter

中将底部栏更改为任何颜色
我试过用

AnnotatedRegion<SystemUiOverlayStyle>(
  value: SystemUiOverlayStyle(
    systemNavigationBarDividerColor: Colors.red,
    systemNavigationBarColor: Colors.yellow
  ),
  child: child,
);

但是没有用。

q5iwbnjs

q5iwbnjs1#

使用安全区上面的脚手架和 Package 安全区与容器,然后尝试使用该容器的颜色。

class TestScreen extends StatelessWidget {
  const TestScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      child: SafeArea(
        child: Scaffold(
          appBar: AppBar(),
          body: const Center(
            child: Text('Test Screen'),
          ),
        ),
      ),
    );
  }
}

相关问题