skip to Main Content

I have a ClipRRect that is rounded at the bottom and it contains text in it. The problem I am facing now is that I can not add some padding at the bottom of the ClipRRect and my text in the widget gets cut out and when I wrap the ClipRRect with padding widget or add a sized box after the text I get overflow error.

ClipRRect(
      borderRadius: const BorderRadius.only(
        bottomLeft: Radius.circular(30),
        bottomRight: Radius.circular(30),
      ),
      child: Container(
        color: Colors.grey,
        child: Text(
          description,
          style: const TextStyle(fontSize: 15),
        ),
      ),
    );

I am expecting my text not to be cut out at the bottom.

2

Answers


  1. Add padding to the text.

    Padding(
    padding: const EdgeInsets.only(bottom:8.0),child: Text(""),
    ),
    
    Login or Signup to reply.
  2. You can use padding from Container.

    child: Container(
      padding: EdgeInsets.all(20),
      color: Colors.grey,
      child: Text(
    

    Actually you can minimize the snippet like

    Container(
      padding: EdgeInsets.all(20),
      clipBehavior: Clip.antiAlias, // if needed
      decoration: BoxDecoration(
        color: Colors.grey,
        borderRadius: const BorderRadius.only(
          bottomLeft: Radius.circular(30),
          bottomRight: Radius.circular(30),
        ),
      ),
      child: Text(
        description,
        style: const TextStyle(fontSize: 15),
      ),
    ),
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search