修改AppBar的颜色

 appBar: AppBar(
            title: Text("LIST", style: TextStyle(color: Colors.black12)),
            backgroundColor: Colors.red,
 )

也可以用 theme进行设置

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: "Imokdemo",
        home: Scaffold(
          appBar: AppBar(
            title: Text("LIST"),
            //backgroundColor: Colors.red,
          ),
          //body: new Text('ListView')
          body: Listv(),
          // body:new ListView(),
        ),
        theme: ThemeData(
            colorScheme: const ColorScheme(
                primary: Colors.yellow, //上方标题栏颜色
                secondary: Colors.green,
                background: Colors.white,
                error: Colors.red,
                brightness: Brightness.light,
                onBackground: Colors.black,
                onError: Colors.yellow,
                onPrimary: Colors.white, //字体颜色
                onSecondary: Colors.redAccent,
                onSurface: Colors.redAccent,
                surface: Colors.redAccent)));
  }
}

 

flutter theme:themeData() 统一设置主题颜色不起作用解决方法

https://blog.csdn.net/weixin_44864357/article/details/122791366

 

posted @ 2023-03-19 23:09  小小强学习网  阅读(68)  评论(0)    收藏  举报