I am using this kind of style in an app I'm trying to create for learning. Now the problem I have is that I only can make this using a RaisedButton but obviously sometimes I would need it to just be a container or sizebox, with no click effect. for example I use this code:

Widget titleSettings(String title){
    return Container(
      margin: EdgeInsets.fromLTRB(80.0, 0.0, 80.0, 20.0),
      width: MediaQuery.of(context).size.width,
      child: new RaisedButton(
          padding: EdgeInsets.all(10.0),
          elevation: 0.0,
          color: Colors.white.withOpacity(.8),
          highlightElevation: 0.0,
          onPressed: () {
            print("titleSettingPressed");
          },
          splashColor: Colors.white.withOpacity(.8),
          highlightColor: Colors.white.withOpacity(.8),
          shape: BeveledRectangleBorder(
              side: BorderSide(color: Colors.black, width: 2.5),
              borderRadius: new BorderRadius.circular(15.0)),
          child: AutoSizeText("$title", style: TextStyle(fontSize: 30.0),),
      )
    );
  }

but in this case I don't need to manage any click, It should only contain a text like it is in the child. enter image description here

1 Answers

0
Yamin On

I've extracted below sample from the raised button definition inside flutter packages. check if its the same thing you're trying to reach:

 child: Material(
  elevation: 0.0,
  type: MaterialType.button,
  color: Colors.white.withOpacity(.8),
  shape: BeveledRectangleBorder(
      side: BorderSide(color: Colors.black, width: 2.5),
      borderRadius: new BorderRadius.circular(15.0)),
  child: IconTheme.merge(
    data: IconThemeData(
      color: Colors.white.withOpacity(.8),
    ),
    child: Container(
      padding: EdgeInsets.all(10.0),
      child: Center(
        widthFactor: 1.0,
        heightFactor: 1.0,
        child: Text(
          "Timers",
          style: TextStyle(fontSize: 30.0),
        ),
      ),
    ),
  ),
),