Yvana
Yvana

Reputation: 23

How can I remove shadow above AppBar for Android in Flutter?

How can I remove the shadow above the AppBar for Android in Flutter? On the iOS Simulator the following Code works fine.

enter image description here

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

Answers (4)

Rahul Raj
Rahul Raj

Reputation: 1493

Here the solution

enter image description here

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

ALEXANDER LOZANO
ALEXANDER LOZANO

Reputation: 2034

add this to the widget

Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
  statusBarColor: Colors.transparent,
));
return Scaffold(

Upvotes: 3

Dineth Prabashwara
Dineth Prabashwara

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

it's status Bar try to change the status Bar

Upvotes: 2

Related Questions