Home > Back-end >  Flutter's applications default color
Flutter's applications default color

Time:01-07

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

CodePudding user response:

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.

  •  Tags:  
  • Related