How to Give Radius around corner of SizedBox?

1.7k Views Asked by At
SizedBox(
            child: TextButton(
             onPressed: () {
                    print("You pressed");
                  },
                  child: Text(
                    '1                      Song 1                            3:45',
                    style: TextStyle(
                      color: Colors.green,
                      fontSize: 20,
                      fontWeight: FontWeight.w700,
                      backgroundColor: Colors.yellow,
                    ),
                  ),
                ),
              ),

I want to give radius to this sizedbox someone explain how should I ?

1

There are 1 best solutions below

0
Fatima ayaa On

The SizedBox dont have have this property, you can use Container instead

if you want to add a radius to you button , do it like this

TextButton(
      style: ButtonStyle(
          backgroundColor: MaterialStateProperty.all<Color>(Color(0xffa6bcd0)),
          shape: MaterialStateProperty.all<RoundedRectangleBorder>(
              RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(8.0),
          ))),
      onPressed: () {
        print("You pressed");
      },
      child: Text(
        '1                      Song 1                            3:45',
        style: TextStyle(
          color: Colors.green,
          fontSize: 20,
          fontWeight: FontWeight.w700,
          backgroundColor: Colors.yellow,
        ),
      ),
    )