DEV Community

Pablo Lanza Moreno
Pablo Lanza Moreno

Posted on

RaisedButton Examples

RaisedButton

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

Alt Text

RaisedButton + Border

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

Alt Text

RaisedButton + Border + Elevation

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

Alt Text

RaisedButton + Elevation + Round Shape

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

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");
      },
    );
  }

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");
      },
    );
  }

Alt Text

Discussion (0)