Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

empty widget to filter data

filterlist is a flutter plugin which is designed to provide ease in filter data from 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"
  ];
  list<string> selectedcountlist = [];

create a _openfilterlist function which will open filterlist pop-up on button clicked

  void _openfilterlist() async {
    var list = await showdialog(
      context: context,
      builder: (buildcontext context) {
        return dialog(
          elevation: 0.0,
          backgroundcolor: colors.transparent,
          child: container(
            decoration: boxdecoration(
                borderradius: borderradius.all(radius.circular(40))),
            height: mediaquery.of(context).size.height * .8,
            width: mediaquery.of(context).size.width,
            child: filterlist(
              alltextlist: countlist,
              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 github all releases

screenshots

screenshot screenshot
screenshot_1 filter data
screenshot_3 screenshot_4

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.