I trying to change the background color to Black for the app, for now its dark but not pitch black. This is my code
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData.dark().copyWith(
colorScheme: const ColorScheme.dark().copyWith(background: Colors.black),
),
title: "Test",
home: Scaffold(body: Center(child: Text("Test"))),
);
}
}
what mistake am i doing?
2
Answers
change the background color to black, you need to modify the backgroundColor property of the scaffoldBackgroundColor in your ThemeData. Here’s how you can do it:
What you are doing is setting the color scheme of app.
To change to background color of entire app you need to write code like below.