Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter- Is there a way to set all AppBars elevation

Tags:

flutter

dart

I'd like to set all pages AppBar's elevation to 0. Do I have to set individually? Or is there any way to set it to all pages?

like image 694
Daibaku Avatar asked Aug 30 '18 04:08

Daibaku


2 Answers

Here is an easy way of doing it.

MaterialApp(
  theme: ThemeData(
    appBarTheme: AppBarTheme(elevation: 0)
  ),
) 
like image 143
CopsOnRoad Avatar answered Nov 20 '22 07:11

CopsOnRoad


Create your own AppBar Widget and use it in all your screens

  import 'package:flutter/material.dart';

  class MyAppBar extends AppBar {
    MyAppBar(
        {Key key,
       Widget title,
        Color backgroundColor,
        List<Widget> actions,
        PreferredSizeWidget bottom})
        : super(
            backgroundColor: backgroundColor,
            title: title,
            actions: actions,
            bottom: bottom,
            elevation:
                0.0,
          );
  }
like image 27
diegoveloper Avatar answered Nov 20 '22 06:11

diegoveloper