Flutter ElevatedButton Examples

ElevatedButton is a Material Design’s elevated button which can be used to add dimension to otherwise mostly flat layouts. It is advised to avoid using this widget on already-elevated content such as dialogs or cards.

ElevatedButton replaces RaisedButton widget.

ElevatedButton requires 2 properties at minimum, onPressed and child.

onPressed: () {},
child: Text('ElevatedButton')

Color style such as background and overlay ones can be adjust by using ButtonStyle.

          onPressed: () {
            print('Clicked Me!');
              style: ButtonStyle(
                backgroundColor: MaterialStateProperty.all<Color>(Colors.green),
                overlayColor: MaterialStateProperty.all<Color>(Colors.lightGreen),
          child: Container(
            width: 160,
            height: 40,
            padding: EdgeInsets.all(8.0),
            child: Row(
              children: [
                SizedBox(width: 8,),
                Text('My Button')

Leave a Comment

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.