Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can my parent Container hide the corners of the child Container

The parent container has border radius, which I would like to apply also to its children. Instead, I get this

image

As you can see, the corners of the child container are above the border. How can I hide the corners of the child?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Container(
            width: screenWidth / 3,
            height: screenHeight * 0.8,
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(55),
                border: Border.all(
                  color: Colors.black26,
                ),
              ),
            child: Column(
              children: [
                Container(
                  width: screenWidth / 3,
                  height: 139,
                  color: Colors.amberAccent,
                )
              ],
            ),
          ),

>Solution :

you have to use ClipRRect widget.

Container(
           width: screenWidth / 3,
           height:screenHeight * 0.8,
           decoration: BoxDecoration(
               borderRadius: BorderRadius.circular(55),
               border: Border.all(
                 color: Colors.black26,
               ),
             ),
           child: ClipRRect(
             borderRadius: BorderRadius.circular(55),     
             child: Column(
               children: [
                 Container(
                   width: screenWidth / 3,
                   height: 139,
                   color: Colors.amberAccent,
                 )
               ],
             ),
           ),
         )
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading