Flutter ListGroup package
By Abhishek on September 2, 2019
ListGroup package flutter
We are happy to announce, we have started contributing to the flutter community. Recently we released ListGroup.
A flutter package that enables flutter developer to use Grouped list in flutter, which looks something like:
Basics of ListGroup Package flutter
Group list can be easily generated with use of two primary Widgets that list_group package provides i.e
Add dependency to pubspec.yaml
This is the very first step for using package.
pubspec.yaml is the place where we specify dependencies required for the application. Simply, add
list_group to the flutter dependencies.
dependencies: flutter: sdk: flutter list_group:
Run the following command to fetch the package.
flutter pub get
Example Implementation of ListGroup in flutter
import 'package:list_group/list_group.dart'; import 'package:list_group/list_group_item.dart'; ListGroup( items: [ ListGroupItem( leading: Icon( FontAwesomeIcons.solidHeart, color: Colors.red, ), title: Text('Likes'), subtitle: Text('5 new', style: TextStyle(fontSize: 15),), trailing: Icon(Icons.chevron_right), ), ListGroupItem( leading: Icon( FontAwesomeIcons.eye, color: Colors.green, ), title: Text('Visitors'), subtitle: Text('10 recent', style: TextStyle(fontSize: 15),), trailing: Icon(Icons.chevron_right), ), ListGroupItem( leading: Icon( FontAwesomeIcons.userFriends, color: Colors.blue, ), title: Text('Followers'), subtitle: Text('Trusted', style: TextStyle(fontSize: 15),), trailing: Icon(Icons.chevron_right), lastItem: true, ) ], );
The list group widget expects
items to be List of
ListGroupItem. This is similar to
This makes up the list items within this list group.
leading: expects a widget to be placed within the list item.
title: expects a widget, usually a Text widget which displays the text in the list.
subtitle: expects a widget, usually a Text widget which is displayed below the title.
trailing: expects a widget to be placed within the list item.
dense: expects either true or false defaults to true, compacts height of list tile.
enabled: whether list item is enabled, defaults to true.
lastItem: Important this decides whether to add divider after the list item. defaults to false.
onTap: expects a callback method to be executed on tap of list item.
onLongPress: expects a callback method to be executed on long press of list item.
Show Some Love <3
Do give it a star to support the project. We are working on announcing some new packages and widgets. Stay Tuned for More on Flutter !!