Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter group listviews with separator

Tags:

flutter

I am looking for some guidance to create listviews with separators. For instance, I would like to take messages from a DB grouped by date and separate the messages by date with some graphic or line, etc... and then have the messages under the separator. Trying this in flutter and any guidance or push in the right direction would be appreciated.

like image 405
Robert Avatar asked Nov 11 '17 00:11

Robert


People also ask

How do you add a separator to a ListView in Flutter?

In Flutter, you can use ListView. separated to easily create a list view whose items are separated by separators (or dividers). A separator only appears between two list items and never stands before the first or sits after the last item.

How do you add a separator line in Flutter?

If you have a list of widgets, you may need to add a separator between the widgets. In Flutter, there are two widgets suitable for that purpose: Divider and VerticalDivider . Divider is used to create a horizontal line divider, while VerticalDivider is used to create a vertical line divider.


1 Answers

simply put the ListItem into a Container and add decoration:

  @override
  Widget build(BuildContext context) {
    return new Container(
        child: new ListTile(
          title: new Text('I have border')
        ),
        decoration:
            new BoxDecoration(
                border: new Border(
                    bottom: new BorderSide()
                )
            )
        );
  }
like image 196
BoygeniusDexter Avatar answered Sep 29 '22 16:09

BoygeniusDexter