I created a frosted AppBar has a SafeArea wrapping. I want a scrollview that scrolls under it, but i'm unable to code a variable padding that adds the SafeArea of the AppBar to the top padding of the SingleChildScrollView. Does anyone have any tips? My appbar is at appbar:
. The code for the body Scaffold follows bellow:
home: Scaffold(
backgroundColor: const Color(0xFFF6FFF1),
extendBody: true,
extendBodyBehindAppBar: true,
// Body
body: SingleChildScrollView(
padding:
EdgeInsets.only(top: 90, left: 10, right: 10, bottom: 8),
child: Text(
lorem(paragraphs: 4, words: 480),
),
),
appBar: FrostedAppBar(
actions: [
IconButton(
icon: Icon(
Icons.help_outline_rounded,
color: lightColorScheme.tertiary,
shadows: const [
Shadow(
color: Colors.black,
blurRadius: 2,
offset: Offset(1, 2))
],
),
onPressed: null,
iconSize: 40,
)
],
title: Text(
'Title',
style: GoogleFonts.racingSansOne(
fontSize: 40, color: lightColorScheme.primary),
textAlign: TextAlign.center,
),
leading: IconButton(
icon: Icon(
Icons.menu_rounded,
color: lightColorScheme.tertiary,
shadows: const [
Shadow(
color: Colors.black, blurRadius: 2, offset: Offset(1, 2))
],
),
iconSize: 40,
onPressed: null,
),
),
Example of why I need variable padding
Scaffold body content going under the appbar and being blurred by it
Thank you very much for your time!!!
CodePudding user response:
Wrap your Scaffold
with SafeArea
widget.
SafeArea(
child: Scaffold(
CodePudding user response:
Solved by wrapping the Text (SingleChildScrollView child) in a SafeArea.
body:
top: true,
child: SingleChildScrollView(
padding: const EdgeInsets.only(
top: 10, left: 10, right: 10, bottom: 8),
child: SafeArea(
Text(
lorem(paragraphs: 4, words: 480),
),
),
),