flutter flat button width code example

Example 1: flutter flat button size

// JZ
SizedBox(
  width: double.infinity, // <-- match_parent
  child: RaisedButton(...)
)

Example 2: RaisedButton hright

ButtonTheme(
  minWidth: 200.0,
  height: 100.0,
  child: RaisedButton(
    onPressed: () {},
    child: Text("test"),
  ),
);

Example 3: flatbutton flutter

FlatButton(
  onPressed: () {
    /*...*/
  },
  child: Text(
    "Flat Button",
  ),
)

Example 4: raisedbutton full width flutter

FractionallySizedBox(
   widthFactor: 1, // means 100%, you can change this to 0.8 (80%)
     child: RaisedButton.icon(
     onPressed: () {
     	print(comment);
     },
     label: Text('Edit Comment', style: TextStyle(color: Colors.white)),
     icon: Icon(Icons.check, color: Colors.white),
     ),
 ),

Tags:

Dart Example