Issue
how to change the size and text colour of the button in this code. the left side image shows my implementation so far. I want it to be changed to the right side image buttons.
Widget lbsButton() => Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
//playSound(soundNumber);
},
child: Text('lbs'),
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all<Color>(Colors.deepPurple),
),
),
SizedBox(
width: 10,
),
new ElevatedButton(
onPressed: () {},
child: Text('kg'),
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all<Color>(Colors.deepPurple),
),
)
],
),
);
Solution
If you want to enter the styles of the specific button that is ElevatedButton and its text, it could be as follows:
SizedBox( // Change the button size
width: 100,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom( // ElevatedButton styles
primary: Colors.deepPurple,
padding: EdgeInsets.fromLTRB(20, 10, 20, 10), // Some padding example
shape: RoundedRectangleBorder( // Border
borderRadius: BorderRadius.circular(18.0),
side: BorderSide(color: Colors.red),
),
[...]
),
textStyle: TextStyle( // Text styles
color: Colors.white,
fontSize: 18,
overflow: TextOverflow.ellipsis,
[...]
),
onPressed: () {},
child: Text("lbs"),
),
),
Answered By - Daniel Roldán
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.