Site icon Flutter Packages | Pub dev Packages – Flutter Mobile App World

FilterList is a flutter plugin which is developed to filter data from a list

empty_Widget

FilterList is a flutter plugin that is designed to provide ease in filter data from a list of strings.

Getting Started

1. Add library to your pubspec.yaml

dependencies:
  filter_list: ^0.0.1

2. Import library in dart file

import 'import 'package:filter_list/filter_list.dart';';

3. How to use FilterList

Create a list of Strings

  List<String> countList = [
    "One",
    "Two",
    "Three",
    "Four",
    "Five",
    "Six",
    "Seven",
    "Eight",
    "Nine",
    "Ten",
    "Eleven",
    "Tweleve",
    "Thirteen",
    "Fourteen",
    "Fifteen",
    "Sixteen",
    "Seventeen",
    "Eighteen",
    "Nineteen",
    "Twenty"
  ];
  List<String> selectedCountList = [];

Create a function and call FilterList.showFilterList() dialog on button clicked

  void _openFilterList() async {
    var list = await FilterList.showFilterList(
      context,
      allTextList: countList,
      height: 450,
      borderRadius: 20,
      headlineText: "Select Count",
      searchFieldHintText: "Search Here",
      selectedTextList: selectedCountList,
    );
    
    if (list != null) {
      setState(() {
        selectedCountList = List.from(list);
      });
    }
  }

Call _openFilterList function on floatingActionButton pressed

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: _openFilterList,
          tooltip: 'Increment',
          child: Icon(Icons.add),
        ),
        /// check for empty or null value selctedCountList
        body: selectedCountList == null || selectedCountList.length == 0
            ? Center(
                child: Text('No text selected'),
              )
            : ListView.separated(
                itemBuilder: (context, index) {
                  return ListTile(
                    title: Text(selectedCountList[index]),
                  );
                },
                separatorBuilder: (context, index) => Divider(),
                itemCount: selectedCountList.length));
  }

Download App 

Screenshots

ScreenshotScreenshot

Parameters and Value

height
width
borderRadius

allTextList

selectedTextList

headlineText
searchFieldHintText

hideSelectedTextCount

hideSearchField
hidecloseIcon
hideheader
closeIconColor
headerTextColor

applyButonTextColor

applyButonTextBackgroundColor

allResetButonColor
selectedTextColor
selectedTextBackgroundColor
unselectedTextbackGroundColor

unselectedTextColor

searchFieldBackgroundColor

backgroundColor

Pull Requests

I welcome and encourage all pull requests. It usually will take me within 24-48 hours to respond to any issue or request.

Download FilterList flutter plugin source code on GitHub

https://github.com/TheAlphamerc/flutter_plugin_filter_list
Exit mobile version