Reputation: 412
we can edit default color of scaffold
in all pages in app like this :
MaterialApp(
theme: ThemeData(
scaffoldBackgroundColor: Colors.red
),
);
In this example, I changed the color of the scaffold with Property scaffoldBackgroundColor:
. How can I do this for the app bar as well?
Upvotes: 0
Views: 210
Reputation: 1749
You can use appBarTheme property of ThemeData which is an AppBarTheme type
use it like this :
MaterialApp(
theme: ThemeData(
scaffoldBackgroundColor: Colors.red,
appBarTheme: [const] AppBarTheme(
backgroundColor: Colors.blue,
// ...
),
),
);
Upvotes: 1
Reputation: 474
add this dude:
return MaterialApp(
theme: ThemeData(
scaffoldBackgroundColor: Colors.red,
appBarTheme: const AppBarTheme(
backgroundColor: Colors.black,
iconTheme: IconThemeData(color: Colors.white),
titleSpacing: 0,
centerTitle: false,
titleTextStyle: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "NunitoBL",
),
),
),
home: Home(),
);
Upvotes: 1