How do I add a responsive padding at the top of my scaffold area,
Here is the preview of my Scaffold Area. I want the background there to be transparent or will adjust depending on the users phone theme. However mine is overlapping.
Here is the sample code of my login_page.
login_page.dart
class _LoginPageState extends State<LoginPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
TextWidget(
descriptionText: "Sign In!",
selectedFontColor: ColourPalette.primaryColor,
selectedFontWeight: FontWeight.normal,
selectedFontSize: 25),
SignInButton(
Buttons.google,
text: "Sign up with Google",
onPressed: () {
AuthServices().signInWithGoogle();
},
)
],
),
);
}
}
3
Answers
Instead of wrapping the Scaffold with Safearea, wrap the widget inside the body with Safearea it gives you the same result but the UI will respond according to the theme.
If you don’t want to use SafeArea and still get the mobile theme color at the top of the screen
you can put a SizedBox in the starting of the column with a height of the top padding
like this:
If you want to give color to safe area, you can do it like this: