DEV Community

Pablo L
Pablo L

Posted on

RaisedButton Examples

RaisedButton

  Widget _makeButton() {
    return RaisedButton(
        child: Text("PUSH ME"),
        color: Colors.red,
        onPressed: () {
          print("OK!!");
        }
    );
  }
Enter fullscreen mode Exit fullscreen mode

Alt Text

RaisedButton + Border

  Widget _makeButton() {
    return RaisedButton(
      child: Text("PUSH ME"),
      shape: Border.all(),
      color: Colors.red,
      onPressed: () {
        print("PUSHED");
      },
    );
  }
Enter fullscreen mode Exit fullscreen mode

Alt Text

RaisedButton + Border + Elevation

  Widget _makeButton() {
    return RaisedButton(
      color: Colors.red,
      elevation: 15,
      child: Text("PUSH ME"),
      shape: Border.all(),
      onPressed: () {
        print("PUSHED");
      },
    );
  }
Enter fullscreen mode Exit fullscreen mode

Alt Text

RaisedButton + Elevation + Round Shape

  Widget _makeButton() {
    return RaisedButton(
      color: Colors.red,
      elevation: 15,
      shape: StadiumBorder(),
      child: Text("PUSH ME"),
      onPressed: () {
        print("PUSHED");
      },
    );
  }
Enter fullscreen mode Exit fullscreen mode

Alt Text

RaisedButton + Border + Elevation + Round Shape and Border

  Widget _makeButton() {
    return RaisedButton(
      color: Colors.red,
      elevation: 15,
      shape: StadiumBorder(side: BorderSide(color: Colors.black, width: 1)),
      child: Text("PUSH ME"),
      onPressed: () {
        print("PUSHED");
      },
    );
  }
Enter fullscreen mode Exit fullscreen mode

Alt Text

RaisedButton + Border + Icon + Elevation + Round Shape and Border

  Widget _makeButton() {
    return RaisedButton(
      color: Colors.red,
      elevation: 15,
      child: Row(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[Icon(Icons.access_alarm), Text("TIME ALARM")]),
      shape: StadiumBorder(side: BorderSide(color: Colors.black, width: 1)),
      onPressed: () {
        print("PUSHED");
      },
    );
  }
Enter fullscreen mode Exit fullscreen mode

Alt Text

Top comments (0)