Flutter's applications default color

Issue

I’m making a Welcome Screen which has two TextButtons each wrapped in a Container.
one for Creating an account and another for logging in
(both of them have some shadow below them )
enter image description here

I managed to make both containers in flutter but I found out that the background color of the application is not pure white (#FFFFFF) which mean if I set the color of the login container to Colors.white it won’t look like the background color of the app like above picture.

So I need a way to set the color of the login container to the same color as the application.
let’s avoid hard coding I don’t want to determine the background color with an external tool and set it to the button.
I was thinking of taking same color as parent or something like that but I don’t know if that exists.

main.dart

WelcomeScreen.dart

Solution

The scaffold background color is Grey[50]. You can set background color on scaffold like

Scaffold(
   backgroundColor: Colors.white,

Or for app

  return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: Theme.of(context).copyWith(
        scaffoldBackgroundColor: Colors.white,
      ),

More about Theme.

Answered By – Yeasin Sheikh

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published