GithubHelp home page GithubHelp logo

jvegaperez / grouped_list Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dimibe/grouped_list

0.0 0.0 0.0 943 KB

A Flutter ListView in which items can be grouped into sections.

Home Page: https://pub.dev/packages/grouped_list

License: MIT License

Dart 100.00%

grouped_list's Introduction

Grouped list package for Flutter.

Pub CI

A flutter ListView in which list items can be grouped to sections.

Features

  • List Items can be separated in groups.
  • For the groups an individual header can be set.
  • Almost all fields from ListView.builder available.

Getting Started

Add the package to your pubspec.yaml:

grouped_list: ^3.2.3

In your dart file, import the library:

import 'package:grouped_list/grouped_list.dart';

Instead of using a ListView create a GroupedListView Widget:

 GroupedListView<dynamic, String>(
   elements: _elements,
   groupBy: (element) => element['group'],
   groupSeparatorBuilder: (String groupByValue) => Text(groupByValue),
   itemBuilder: (context, dynamic element) => Text(element['name']),
   order: GroupedListOrder.ASC,
 ),

Parameters:

Name Description Required Default value
elements A list of the data you want to display in the list required -
groupBy Function which maps an element to its grouped value required -
itemBuilder / indexedItemBuilder Function which returns an Widget which defines the item. indexedItemBuilder provides the current index as well. If both are defined indexedItemBuilder is preferred yes, either of them -
groupSeparatorBuilder Function which gets the groupBy-value and returns an Widget which defines the group header separator required -
separator A Widget which defines a separator between items inside a group no no separator
orderย  Change to GroupedListOrder.DESC to reverse the group sorting no GroupedListOrder.ASC

Also the fields from ListView.builder can be used.

Other packages :

Check out my other package StickyGroupedList, which is based on the scrollable_positioned_list and comes with sticky headers!

grouped_list's People

Contributors

dimibe avatar daniel-ioannou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.