A ListView that allows you to group list items and support headers like iOS UITableView section.

Overview

GroupListView package for Flutter.

pub package

A ListView that allows you to group list items and support headers like iOS UITableView section.

Features

  • List Items can be grouped.
  • Support headers for each group.
  • All fields from ListView.builder constructor available.

Getting Started

Add the package to your pubspec.yaml:

group_list_view: ^1.1.1

In your dart file, import the library:

import 'package:group_list_view/group_list_view.dart';

Instead of using a ListView create a GroupListView Widget:

 Map<String, List> _elements = {
   'Team A': ['Klay Lewis', 'Ehsan Woodard', 'River Bains'],
   'Team B': ['Toyah Downs', 'Tyla Kane'],
 };
 
 GroupListView(
   sectionsCount: _elements.keys.toList().length,
   countOfItemInSection: (int section) {
     return _elements.values.toList()[section].length;
   },
   itemBuilder: (BuildContext context, IndexPath index) {
     return Text(
       _elements.values.toList()[index.section][index.index],
       style: TextStyle(color: Colors.white, fontSize: 18),
     );
   },
   groupHeaderBuilder: (BuildContext context, int section) {
     return Padding(
       padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
       child: Text(
         _elements.keys.toList()[section],
         style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
       ),
     );
   },
   separatorBuilder: (context, index) => SizedBox(height: 10),
   sectionSeparatorBuilder: (context, section) => SizedBox(height: 10),
 );

Parameters:

  • sectionsCount: The number of sections in the ListView. (required)
  • countOfItemInSection. Function which returns the number of items(rows) in a specified section. (required)
  • itemBuilder: Function which returns an Widget which defines the item at the specified IndexPath. itemBuilder provides the current section and index. (required)
  Widget _itemBuilder(BuildContext context, IndexPath index) {
     return Text('${_elements[index.section][index.index]}');
  }
  • groupHeaderBuilder: Function which returns an Widget which defines the section header for each group. (required)

  • separatorBuilder: Function which returns an Widget which defines the divider/separator at the specified IndexPath.

    The itemBuilder and separatorBuilder callbacks should actually create widget instances when called.

Contributions

Contributions of any kind are more than welcome! Feel free to fork and improve flutter_group_list_view in any way you want, make a pull request, or open an issue.

Comments
  • How to remove default horizontal padding?

    How to remove default horizontal padding?

    How to remove default horizontal padding?

    I config the padding as:

    child: GroupListView(
              // padding: EdgeInsets.zero,
              padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
    

    but it doesn't work.

    image help wanted 
    opened by TangSirOnGit 2
  • Add onTap functionality to the list item

    Add onTap functionality to the list item

    How I can add onTap functionality to the list item? I am trying to add like this: onTap: () => Navigator.pushNamed(context, postRoutes[index]) but getting error: The argument type 'IndexPath' can't be assigned to the parameter type 'int'. Guide will be appreciated.

    question 
    opened by shameemreza 2
  • Support sectionSeparatorBuilder

    Support sectionSeparatorBuilder

    Hi, Currently separatorBuilder is used for separating items, It's nice if we have also sectionSeparatorBuilder to separate between sections.

    Currently:

    H1
    Item1
    ----
    Item2
    ----
    H2
    Item1
    ----
    Item2
    ----
    

    I wish:

    H1
    Item1
    ----
    Item2
    ====
    H2
    Item1
    ----
    Item2
    ===
    
    opened by omidraha 2
  • Hope enough to use with CustomScrollView

    Hope enough to use with CustomScrollView

    This library is very friendly to iOS developers, unfortunately Sliver List is not supported. Hope to add a SilverGroupedListView to support Sliver List.

    opened by 6ag 0
  • Adding Scrollbar generates Error

    Adding Scrollbar generates Error

    When wrapping the GroupListView inside a Scrollbar, I get an error

    Flexible( child: Scrollbar( isAlwaysShown: true, child: GroupListView( controller: ScrollController(),

    ════════ Exception caught by animation library ═════════════════════════════════ The Scrollbar's ScrollController has no ScrollPosition attached. ════════════════════════════════════════════════════════════════════════════════

    opened by YannickDesjardinsHapbee 0
  • How to get Map<String, List<String>> _elements from rawQuery db

    How to get Map> _elements from rawQuery db

    Hi my Sqlite returning rawQuery witch is Future<List<Map<String, dynamic>>> ... hot to conver result to map of type in example. Map<String, List> _elements = { 'Team A': ['Klay Lewis', 'Ehsan Woodard', 'River Bains'], 'Team B': ['Toyah Downs', 'Tyla Kane'], 'Team C': ['Marcus Romero', 'Farrah Parkes', 'Fay Lawson', 'Asif Mckay'], 'Team D': [ 'Casey Zuniga', 'Ayisha Burn', 'Josie Hayden', 'Kenan Walls', 'Mario Powers' ], 'Team Q': ['Toyah Downs', 'Tyla Kane', 'Toyah Downs'], };

    question 
    opened by KlubAndroid 1
Releases(v1.1.1)
A iOS like table view including section, row, section header and divider

flutter_section_table_view A iOS like table view including section, row, section header and divider Support both Android and iOS Support drop-down ref

刘彦博 73 Nov 4, 2022
Flutter Bidirectional ListView - ListView with items that can be scrolled in both directions with a fixed item count and scroll boundaries.

Flutter Bidirectional ListView ListView with items that can be scrolled and lazy loaded in up and down direction with a fixed item count and scroll bo

Christoph Rothermel 7 May 30, 2022
A group of overlapping round avatars are called face piles, a face pile is a series of overlapping avatar images that come and go as users join and leave a given group.

Flutter Face Pile A group of overlapping round avatars are called face piles. A face pile is a series of overlapping avatar images that come and go as

Amine Chamkh 3 Sep 22, 2022
Flutter package that provide selectable items in list like Column

vertical_picker vertical_picker is flutter package that you can use it as item selector. users with this package be able to select item that is in ver

Sajad Rahimi 6 Nov 19, 2022
Flutter package to create list of radio button, by providing a list of objects it can be a String list or list of Map.

Custom Radio Group List Flutter package to create list of radio button, by providing a list of objects it can be a String list or list of Map. Feature

Ashok Kumar Verma 0 Nov 30, 2021
A Flutter ListView in which items can be grouped into sections.

Grouped list package for Flutter. Now with beta support for null safety! A flutter ListView in which list items can be grouped to sections. Features S

Dimitrios Begnis 277 Dec 26, 2022
An extension of the Flutter ListView widget for incrementally loading items upon scrolling

incrementally_loading_listview An extension of the Flutter ListView widget for incrementally loading items upon scrolling. This could be used to load

Michael Bui 174 Sep 27, 2022
A section list view for flutter

Section view Features Show with select view Alphabet support Refresh support Scr

null 6 Nov 6, 2022
Flutter package to simplify pagination of list of items from the internet.

PaginationView Installing In your pubspec.yaml dependencies: pagination_view: ^2.0.0-nullsafety.0 import 'package:pagination_view/pagination_view.da

Venkatesh Prasad 151 Dec 29, 2022
Flutter package to simplify pagination of list of items from the internet.

PaginationView Installing In your pubspec.yaml dependencies: pagination_view: ^2.0.0-nullsafety.0 import 'package:pagination_view/pagination_view.da

Venkatesh Prasad 151 Dec 29, 2022
Receipt app to list items on a receipt with AI receipt-interpreter. Made with Flutter by Futhark AS

Receipt Recognizer Summary Extracts data from an image of a receipt, storing it in a structured format. The application is created using Flutter and t

Futhark 2 Dec 15, 2022
Ali Türkay AVCI 1 Jan 20, 2022
Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls into your app with only a few lines of code.

Call Kit (ZegoUIKitPrebuiltCall) Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls

ZEGOCLOUD 9 Dec 26, 2022
Greentick assignment - State management tool provider and UI components like ListView etc

greentick_assignment This project is a part of assignment, which demonstrate the

Vinod Patil 0 Feb 11, 2022
Lazybit UI I'll keep on updating this section

Lazybit UI I'll keep on updating this section. Getting Started This project is created Just to design UI in flutter from many sources like dribbble, u

Lazybit 1 Jun 6, 2020
A Recipe App created by following the first section of the book, Flutter Apprentice 2nd Edition.

recipes A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Kian Yang Lee 1 Dec 17, 2021
Flutter Scrollable Widgets like ListView,GridView or powerful CustomScrollView can't nest inner scrollview

Introduction Flutter Scrollable Widgets like ListView,GridView or powerful CustomScrollView can't nest inner scrollview. If Nested, inner scrollview w

jaysonss 5 Aug 28, 2022
A small library support load infinite for ListView - GridView on Flutter.

Paging A Flutter package that supports pagination(load infinite) for ListView, GridView Demo DataSource PageKeyedDataSource To create a PagingListView

Đặng Ngọc Đức 32 Dec 4, 2022