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

Flutter ModalBottomSheet remove white lines

I can’t seem to find a good way to remove these small white lines, changed the container color to fit with the ModalBottomSheet default background color.

enter image description here

Here is a part of code:

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

void mountainModalBottomSheet(context){
  showModalBottomSheet(context: context, builder: (BuildContext bc){
    return Container(
      color: Color(0xff757575),
      height: MediaQuery.of(context).size.height*.60,
      child:Column(
        children: [
          Container(
            width: double.infinity,
            height: 225,
            decoration: BoxDecoration(
              borderRadius: BorderRadius.only(
                  topLeft: Radius.circular(38),
                topRight: Radius.circular(38),
              ),
              image:DecorationImage(image: NetworkImage('https://hotelvilatina.hr/wp-content/uploads/2017/11/sljeme.jpg'),
                  fit: BoxFit.fill),
            ),

>Solution :

Update

You can use shape property but you need to make sure of providing clipBehavior:hardEdge

showModalBottomSheet(
    clipBehavior: Clip.antiAlias, // or hardEdge must 
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.only(
        topLeft: Radius.circular(38),
        topRight: Radius.circular(38),
      ),
    ),
    context: context,
    backgroundColor: Colors.white,
    builder: (c) {
      return Container();
    });

Wrap your Container with ClipRRect widget

showModalBottomSheet(
    context: context,
    backgroundColor: Colors.transparent, // make sure of it
    builder: (c) {
      return ClipRRect(
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(38),
            topRight: Radius.circular(38),
          ),
          child: Container(
            color: Colors.white,
          ));
    });

enter image description here

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