Sachin Vishwakarma
Sachin Vishwakarma

Reputation: 43

How to Give Radius around corner of SizedBox?

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 ?

Upvotes: 1

Views: 2099

Answers (1)

Fatima ayaa
Fatima ayaa

Reputation: 650

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,
        ),
      ),
    )

Upvotes: 2

Related Questions