Home > Back-end >  Flutter ListTile left alignment
Flutter ListTile left alignment

Time:05-12

I am having a textfield and two ListTile . My problem is that ListTile icon is not left aligned. ListTile Icon must come in alignemnt of textfield.

enter image description here

Widget build(BuildContext context) {
  return Column(
    children: <Widget>[
      TextField(),
      ListTile(
        title: const Text('Alarm'),
        leading: Icon(Icons.access_alarm),
      ),
      ListTile(
        title: const Text('Watch'),
        leading: Icon(Icons.watch),
      ),
    ],
  );
}

CodePudding user response:

Widget build(BuildContext context) {
  return Column(
    children: <Widget>[
      TextField(),
      ListTile(
        title: const Text('Alarm'),
        contentPadding: EdgeInsets.all(0),
        leading: Icon(Icons.access_alarm),
      ),
      ListTile(
        title: const Text('Watch'),
        contentPadding: EdgeInsets.all(0),
        leading: Icon(Icons.watch),
      ),
    ],
  );
}

add line

contentPadding: EdgeInsets.all(0)

I hope, This might help you :))

CodePudding user response:

Try below code see image

  • Related