list_group 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 64

List Group #

A flutter package for Android and iOS, that allows you to add grouped list items to the app.

Here is how it looks #

Android List group Item

iOS List group Item

Usage #

Add the dependency to your pubspec.yaml file.

  dependencies:
    flutter:
      sdk: flutter
    list_group:

Use within your application. #

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,
    )
  ],
);

ListGroup #

The list group widget expects items to be List of ListGroupItem.

Options #

items: List of ListGroupItem.

ListGroupItem #

This builds up the each item in list group.

Options #
  1. leading : expects a widget to be placed within the list item.
  2. title : expects a widget, usually a Text widget which displays the text in the list.
  3. subtitle : expects a widget, usually a Text widget which is displayed below the title.
  4. trailing : expects a widget to be placed within the list item.
  5. dense : expects either true or false defaults to true, compacts height of list tile.
  6. enabled : whether list item is enabled, defaults to true.
  7. lastItem : Important** this decides whether to add divider after the list item. defaults to false.
  8. onTap : expects a callback method to be executed on tap of list item.
  9. onLongPress : expects a callback method to be executed on long press of list item.

See example above mentioned code snippet for more details.

License #

Copyright 2018 @Sapidlabs

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

[0.0.1]

  • Initial Release.

[0.0.2]

  • Add description to package.
  • Add example.

example/main.dart

import 'package:flutter/material.dart';
import 'package:list_group/list_group.dart';
import 'package:list_group/list_group_item.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Example App',
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: Text('App With Grouped List'),
        ),
        body: SingleChildScrollView(
          child: Container(
            child: ListGroup(
              items: [
                ListGroupItem(
                  leading: Icon(
                    Icons.thumb_up,
                    color: Colors.red,
                  ),
                  title: Text('Likes'),
                  subtitle: Text(
                    '5 new',
                    style: TextStyle(fontSize: 15),
                  ),
                  trailing: Icon(Icons.chevron_right),
                ),
                ListGroupItem(
                  leading: Icon(
                    Icons.remove_red_eye,
                    color: Colors.green,
                  ),
                  title: Text('Visitors'),
                  subtitle: Text(
                    '10 recent',
                    style: TextStyle(fontSize: 15),
                  ),
                  trailing: Icon(Icons.chevron_right),
                ),
                ListGroupItem(
                  leading: Icon(
                    Icons.verified_user,
                    color: Colors.blue,
                  ),
                  title: Text('Followers'),
                  subtitle: Text(
                    'Trusted',
                    style: TextStyle(fontSize: 15),
                  ),
                  trailing: Icon(Icons.chevron_right),
                  lastItem: true,
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  list_group: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:list_group/list_group.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Oct 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/list_group_item.dart. (-0.50 points)

Analysis of lib/list_group_item.dart reported 1 hint:

line 51 col 9: The for, if, and spread elements weren't supported until version 2.2.2, but this code is required to be able to run on earlier versions.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test