Removing the drop shadow from a Scaffold AppBar in Flutter?

FlutterDartShadowAppbarFlutter Widget

Flutter Problem Overview


Is there a way to remove the drop shadow under the app bar (AppBar class) when using a Scaffold widget in Flutter?

Flutter Solutions


Solution 1 - Flutter

Looking at the AppBar constructor, there's an elevation property that can be used to set the height of the app bar and hence the amount of shadow cast. Setting this to zero removes the drop shadow:

  @override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('My App Title'),
elevation: 0,
),
body: const Center(
child: Text('Hello World'),
),
);
}

enter image description here

Solution 2 - Flutter

I have tried something it might help you

AppBar(
backgroundColor: Colors.transparent,
bottomOpacity: 0.0,
elevation: 0.0,
),

Check this out

Solution 3 - Flutter

If you want to remove the shadow of all app bars without repeating code, just add a AppBarTheme property with elevation: 0 to your app theme (ThemeData), inside your MaterialApp widget:

// This code should be located inside your "MyApp" class, or equivalent (in main.dart by default)
return MaterialApp(
  // App Theme:
  theme: ThemeData(
    // ••• ADD THIS: App Bar Theme: •••
    appBarTheme: AppBarTheme(
      elevation: 0, // This removes the shadow from all App Bars.
    )
  ),
);

Solution 4 - Flutter

To remove appbar drop down shadow set a AppBar constructor elevation: 0.0

The arguments primary, toolbarOpacity, bottomOpacity and automaticallyImplyLeading must not be null. Additionally, if elevation is specified, it must be non-negative.

If backgroundColor, elevation, shadowColor, brightness, iconTheme, actionsIconTheme, textTheme or centerTitle are null, then their AppBarTheme values will be used. If the corresponding AppBarTheme property is null, then the default specified in the property's documentation will be used.

appBar: AppBar(
   title: Text('App Title'),
   elevation: 0.0,
   bottomOpacity: 0.0,
),

enter image description here

To more : AppBar constructor

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMatt S.View Question on Stackoverflow
Solution 1 - FlutterMatt S.View Answer on Stackoverflow
Solution 2 - FlutterYash AdulkarView Answer on Stackoverflow
Solution 3 - FlutterThiagoAMView Answer on Stackoverflow
Solution 4 - FlutterParesh MangukiyaView Answer on Stackoverflow