give space to container border flutter

Issue

enter image description here

there is this space on the left of the border, how to achieve this.
currently, my code gives a full border, but I want little space from the left.

Container(
      child: ListTile(
                      leading:  icon,
                      title: Text(title),
                      trailing: new Icon(Icons.navigate_next),

                    ),
      decoration: new BoxDecoration(

        border: new Border(bottom: new BorderSide(color: Colors.black)),
      ),
    );

Solution

Wrap your Container with a padding and add set contentPadding of ListTile to 0

Padding(
           padding: EdgeInsets.only(left: 10.0),
    
           child :  Container(
             
          child: ListTile(
             dense:true,
                    contentPadding: EdgeInsets.only(left: 0.0,),
                          leading:  Icon(Icons.remove),
                          title: Text('title'),
                          trailing: new Icon(Icons.navigate_next),
    
                        ),
          decoration: new BoxDecoration(
    
            border: new Border(bottom: new BorderSide(color: Colors.black)),
          ),
        ))

Answered By – Fatima ayaa

Answer Checked By – Dawn Plyler (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.