Removing the drop shadow from a Scaffold AppBar in Flutter?

Matt S. picture Matt S. · Feb 27, 2018 · Viewed 50.1k times · Source

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

Answer

Matt S. picture Matt S. · Feb 27, 2018

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