I have problem adding pad for the OutlinedButton, I have been using OutlineButton and I have decided to OutlinedButton because the button is depreciated. However, the usage of the button is different where the padding parameter is undefined. I have tried wrapping OutlinedButton in ButtonTheme but it does not have any effect and now I am using Padding as shown in the code example below.
new Column(children: [
new Row(children: [
//5th row
new Expanded(
child: Padding(
child: new OutlinedButton(
child: new Text(
"Main Page",
style: TextStyle(
fontFamily: 'NotoSans',
fontSize: 20.0,
fontWeight: FontWeight.w400),
),
onPressed: () {
Navigator.of(context).push(_gotoMainPage());
},
padding: EdgeInsets.all(20),
)),
)
]),
])
],
),
Thanks in advance.
Both OutlinedButton and ElevatedButton have a styleFrom method you can use to set things like padding, color, and shape:
OutlinedButton(
child: Text('Padded Button'),
onPressed: (){
},
style: OutlinedButton.styleFrom(
padding: EdgeInsets.all(8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16)
)
),
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.