[英]How to implement search in PaginatedDataTable Flutter Web
嗨,我有一個 PaginatedDataTable,現在我想讓它可以搜索,所以當我輸入一些關鍵字時,它會根據用戶輸入的關鍵字顯示數據......我一直在搜索一些關於它的文章,但我沒有還沒有找到...有人知道有關它的一些教程或文章或示例嗎?
dataList: _searchController.text == ""
? widget.dataList
: searchList,
actions: [
AnimatedSearchBar(
width: 300,
textController: _searchController,
onSuffixTap: () {
setState(() {
_searchController.text = "";
});
}),)]
它們是 PaginatedDataTable 屬性
@override
void initState() {
super.initState();
if (searchableItemList.length != 0 && widget.dataList.length != 0) {
_searchController.addListener(() {
setState(() {
searchList = dataList
.where((element) => element
.name
.toLowerCase()
.contains(controller.text.toLowerCase()))
.toList();;
});
});
}}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.