Reputation: 23
How can I remove the shadow above the AppBar for Android in Flutter? On the iOS Simulator the following Code works fine.
Code:
return Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
elevation: 0.0,
title: Text('Title'),
),
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('images/background_01.jpg'),
fit: BoxFit.cover,
),
),
child: SafeArea(
child: Column(
children: [
Container(),
Container(),
],
),
),
));
Upvotes: 2
Views: 2815
Reputation: 1493
Here the solution
Add these line where you want
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.green,
));
Here the example
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.green,
));
return Container(
color: Colors.blue,
);}
Upvotes: 2
Reputation: 2034
add this to the widget
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
));
return Scaffold(
Upvotes: 3
Reputation: 494
move your safe area as the whole widget parent. fore more about safe area see here https://api.flutter.dev/flutter/widgets/SafeArea-class.html
return SafeArea(
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
elevation: 0.0,
title: Text('Title'),
),
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('images/background_01.jpg'),
fit: BoxFit.cover,
),
),
child: Column(
children: [
Container(),
Container(),
],
),
)),
);
Upvotes: 0