filter_list 0.0.3 filter_list: ^0.0.3 copied to clipboard
filterList is a flutter plugin created to filter data from list.
empty_Widget #
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",
"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 #
Screenshot | Screenshot |
---|---|
Parameters and Value #
height
- Set height of filter dialog.
width
- Set width of filter dialog.
borderRadius
- Set border radius of filter dialog.
allTextList
- Populate filter dialog with text list.
selectedTextList
- Marked selected text in filter dialog.
headlineText
- Set header text of filter dialog.
searchFieldHintText
- Set hint text in search field.
hideSelectedTextCount
- Hide selected text count.
hideSearchField
- Hide search text field.
hidecloseIcon
- Hide close Icon.
hideheader
- Hide complete header section from filter dialog.
closeIconColor
- set color of close Icon.
headerTextColor
- Set color of header text.
applyButonTextColor
- Set text color of apply button.
applyButonTextBackgroundColor
- Set background color of apply button.
allResetButonColor
- Set text color of all and reset button.
selectedTextColor
- Set color of selected text in filter dialog.
selectedTextBackgroundColor
- Set background color of selected text field.
unselectedTextbackGroundColor
- Set background color of unselected text field.
unselectedTextColor
- Set text color of unselected text in filter dialog
searchFieldBackgroundColor
- Set background color of Search field.
backgroundColor
- Set background color of filter color.
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.
Created & Maintained By #
Sonu Sharma (Twitter) (Youtube) (Insta)
If you found this project helpful or you learned something from the source code and want to thank me, consider buying me a cup of ☕