Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flutter's applications default color

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading