Video Search ListView flutter Mới nhất

Thủ Thuật Hướng dẫn Search ListView flutter 2022

Bạn đang tìm kiếm từ khóa Search ListView flutter được Cập Nhật vào lúc : 2022-01-01 09:05:08 . Với phương châm chia sẻ Thủ Thuật về trong nội dung bài viết một cách Chi Tiết Mới Nhất. Nếu sau khi đọc Post vẫn ko hiểu thì hoàn toàn có thể lại Comment ở cuối bài để Mình lý giải và hướng dẫn lại nha.

FilterList is a flutter package which provide utility to search/filter on the basis of single/multiple selection from provided dynamic list.

dependencies:
filter_list: ^0.0.9

import package:filter_list/filter_list.dart’;
Create a list of Strings List countList = [
“One”,
“Two”,
“Three”,
“Four”,
“Five”,
“Six”,
“Seven”,
“Eight”,
“Nine”,
“Ten”,
“Eleven”,
“Tweleve”,
“Thirteen”,
“Fourteen”,
“Fifteen”,
“Sixteen”,
“Seventeen”,
“Eighteen”,
“Nineteen”,
“Twenty”
];
List? selectedCountList = [];
Create a function and call FilterListDialog.display() on button clicked void _openFilterDialog() async
await FilterListDialog.display(
context,
listData: countList,
selectedListData: selectedCountList,
height: 480,
headlineText: “Select Count”,
searchFieldHintText: “Search Here”,
choiceChipLabel: (item)
return item;
,
validateSelectedItem: (list, val)
return list!.contains(val);
,
onItemSearch: (list, text)
if (list!.any((element) =>
element.toLowerCase().contains(text.toLowerCase())))
return list!
.where((element) =>
element.toLowerCase().contains(text.toLowerCase()))
.toList();

else
return [];

,
onApplyButtonClick: (list)
if (list != null)
setState(()
selectedCountList = List.from(list);
);

Navigator.pop(context);
);

Call _openFilterDialog function on floatingActionButton pressed to display filter dialog @override
Widget build(BuildContext context) 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));

How to use FilterListWidget.class User
final String? name;
final String? avatar;
User(this.name, this.avatar);

class FilterPage extends StatelessWidget
FilterPage(Key? key) : super(key: key);
List userList = [
User(name: “Jon”, avatar: “”),
User(name: “Ethel “, avatar: “”),
User(name: “Elyse “, avatar: “”),
User(name: “Nail “, avatar: “”),
User(name: “Valarie “, avatar: “”),
User(name: “Lindsey “, avatar: “”),
User(name: “Emelyan “, avatar: “”),
User(name: “Carolina “, avatar: “”),
User(name: “Catherine “, avatar: “”),
User(name: “Stepanida “, avatar: “”),
];
@override
Widget build(BuildContext context)
return Scaffold(
appBar: AppBar(
title: Text(“Filter List Widget Example “),
),
body toàn thân: SafeArea(
child: FilterListWidget(
listData: userList,
hideHeaderText: true,
onApplyButtonClick: (list)
if (list != null)
print(“Selected items count: $list!.length”);

,
label: (item)
/// Used to print text on chip
return item!.name;
,
validateSelectedItem: (list, val)
/// identify if item is selected or not
return list!.contains(val);
,
onItemSearch: (list, text)
/// When text change in search text field then return list containing that text value
///
///Check if list has value which matchs to text
if (list!.any((element) =>
element.name.toLowerCase().contains(text.toLowerCase())))
/// return list which contains matches
return list!
.where((element) =>
element.name.toLowerCase().contains(text.toLowerCase()))
.toList();

else
return [];

,
),
),
);

No selected text from listFilterList widgetMake selectionSelected text from listHidden close IconHidden text fieldHidden header textHidden full headerCustomised control buttonCustomised selected textCustomised unselected textCustomised text field background colorCustomised Choice chipCustomised Choice chipFilterListWidgetFilterListWidgetParameterTypeDescriptionheightdoubleSet height of filter dialog.widthdoubleSet width of filter dialog.borderRadiusdoubleSet border radius of filter dialog.hideCloseIconboolHide close Icon.hideheaderboolHide complete header section from filter dialog.hideHeaderTextboolIf true then it will hide the header texthideSelectedTextCountboolHide selected text count.hideSearchFieldboolHide search text field.searchFieldHintTextStringSet hint text in search field.headlineTextStringSet header text of filter dialog.closeIconColorColorSet color of close Icon.headerTextColorColorSet color of header text.backgroundColorColorSet background color of filter colorsearchFieldBackgroundColorColorSet background color of Search field.unselectedTextbackGroundColorColorSet background color of unselected text field.selectedTextBackgroundColorColorSet background color of selected text field.applyButonTextBackgroundColorColorSet background color of apply button.applyButtonTextStyleTextStyleTextStyle for Apply buttonselectedChipTextStyleTextStyleTextStyle for chip when selectedunselectedChipTextStyleTextStyleTextStyle for chip when not selectedcontrolButtonTextStyleTextStyleTextStyle for All and Reset button textheaderTextStyleTextStyleTextStyle for header textsearchFieldTextStyleTextStyleTextStyle for search field texlistDataList()Populate filter dialog with text list.selectedListDataList()Marked selected text in filter dialog.choiceChipLabelString Function(T item)Display text on choice chip.validateSelectedItembool Function(List? list, T item)Identifies weather a item is selected or notonItemSearchListFunction(List? list, String text)Perform search operation and returns filtered listchoiceChipBuilderWidget Function(BuildContext context, T? item, bool? iselected)The choiceChipBuilder is a builder to design custom choice chip.onApplyButtonClickFunction(Listlist)Returns list of items when apply button is clickedValidateRemoveItemListFunction(List? list, T item)Return the list of items filtered by the user logicapplyButtonTextStringApply button text to customize or translateresetButtonTextStringReset button text to customize or translateallButtonTextStringAll button text to customize or translateselectedItemsTextStringSelected items text to customize or translatecontrolContainerDecorationBoxDecorationCustomize the bottom area of the dialog, where the buttons are placedbuttonRadiusdoubleButton border radiusbuttonSpacingdoubleSpace between bottom control buttonsinsetPaddingEdgeInsetsThe amount of padding added to [MediaQueryData.viewInsets] on the outside of the dialog.wrapAlignmentWrapAlignmentControls the choice chips alignment in main axis.wrapCrossAxisAlignmentwrapSpacingControls the choice chip within a run should be aligned relative to each other in the cross axis.wrapSpacingWrapAlignmentcontrols the space to place between choice chip in a run in the main axis.

T can be a String or any user defined Model

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 () (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

Reply
5
0
Chia sẻ

Clip Search ListView flutter ?

Bạn vừa đọc nội dung bài viết Với Một số hướng dẫn một cách rõ ràng hơn về Video Search ListView flutter tiên tiến và phát triển nhất

Chia Sẻ Link Down Search ListView flutter miễn phí

Người Hùng đang tìm một số trong những ShareLink Tải Search ListView flutter miễn phí.

Thảo Luận vướng mắc về Search ListView flutter

Nếu Bạn sau khi đọc nội dung bài viết Search ListView flutter , bạn vẫn chưa hiểu thì hoàn toàn có thể lại phản hồi ở cuối bài để Tác giả lý giải và hướng dẫn lại nha
#Search #ListView #flutter

Exit mobile version