Flutter's applications default color - flutter

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 )
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

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.

Related

how to change the color of the cursor in flutter search delegate?

I have implemented flutter search delegate feature in flutter app.Now I want to change the color of the cursor as it is white color and background of the search bar is also white. I need to highlight of cursor color to black.
I tried the appbarTheme inside the searchDelegate class but it doesnt work.
Add this in MaterialApp (it will change cursor color for all screens)
theme: ThemeData(
textSelectionTheme: const TextSelectionThemeData(
cursorColor: Colors.black,
),
),

How to change status bar / navigation bar color/brightness with respective to theme?

Using Getx for theming, but facing some issue with changing status bar icon brightness based on light / dark theme.
I found two ways.
First.
WidgetsBinding.instance!.addPostFrameCallback((_) {
SystemChrome.setSystemUIOverlayStyle(overlayStyle);
});
This need to be called during initState().
Second.
AnnotatedRegion<SystemUiOverlayStyle>()
This widget also does work properly.
Is there any other method which can be implemented for this purpose?
P.S. Using Flutter 2.8.0
You can use ThemeData to change brightness of the whole app based on dark/bright.
All your themes customisation can be done using this. Below is an example for brightness and primary color.
ThemeData(
brightness: Brightness.dark, // or Brightness.light (for dark or light)
// .........
primarySwatch: Colors.orange, // for changing primary color
),

MaterialApp ThemeData iconTheme

I have some ListTile widgets around my app, and all of them have an icon.
From here I see that I need to override my ListTile with
ListTileTheme(
iconColor: Colors.blue,
child: ..
)
since the ListTile.iconColor is gray by default and doesn't fallback to ThemeData.iconTheme.iconColor.
I wonder if there is a way to specify the list tile theme in ThemeData, so I don't have to create a new widget just for that.
For now, there isn't, but this feature may arrive in the next flutter release: https://github.com/flutter/flutter/issues/31247

How do I change text selection handle color for iOS in Flutter?

I'm using the following theme code:
ThemeData.dark().copyWith(
accentColor: Colors.green,
textSelectionColor: Colors.green.withOpacity(0.5),
textSelectionHandleColor: Colors.green,
);
And that works for android, but for iOS it is not changing the color of the text selection handle color to green (it is still the default blue). How can I change that color for iOS?
I was able to change the color using Themes. You need to set cupertinoOverrideTheme like this
CupertinoThemeData(
primaryColor: Colors.green,
)
it seems that this is a known issue.
It would appear that TextField on iOS ignores the MaterialTheme values for this.
Another piece of information which suggests that this is not possible in iOS is looking at the CupertinoThemeData documentation, which clearly does not consider a textSelectionHandleColor.

PrimarySwatch, accentColor and canvasColor

Can someone briefly explain to me where are all the three themes(Primary Swatch, accent Color and canvas Color) used in flutter?
I find extensive use of these themes but am very confused which widgets use which theme?
primarySwatch: is a main color of app for example it change the color of appbar
accentColor: or secondary color is The foreground color for widgets for example floatingActionButton
canvasColor: and this can change the color of scaffold widget
You first need to learn Material Design to understand them. Check this.
primarySwatch is a MaterialColor, not a color. See this.
accentColor is a secondary color. It might be used for active tab, focused input texts, checked boxes etc.
canvasColor is the default color of MaterialType.canvas Material. Here.