I have been looking for several days to integrate a data search in a listview builder. So far, I have succeeded in a listview but I would like to integrate the indexing system in listview builder to use indexes.
I would like not to display all the documents, but only the ones I would have searched from a search bar. Thank you for your help.
return ListView.builder(
itemCount: snapshot.data!.docs.length,
itemBuilder: (context, index) {
var doc = snapshot.data!.docs[index];
var data = doc.data() as Map<String, dynamic>;
return Column(
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.0237,
),
FadeIn(
child: GestureDetector(
onTap: () {
Get.toNamed("Route", arguments: RecupDataDocuments(docID: doc.id.toString()));
},
child: Container(
height: MediaQuery.of(context).size.height * 0.102,
width: double.maxFinite,
padding: EdgeInsets.symmetric(
horizontal: MediaQuery.of(context).size.width * 0.096
),
decoration: BoxDecoration(
color: Theme.of(context).shadowColor,
borderRadius: BorderRadius.circular(MediaQuery.of(context).devicePixelRatio / 0.16),
boxShadow: [
BoxShadow(
offset: Offset(
0,
MediaQuery.of(context).size.height * 0.006
),
color: Colors.black.withOpacity(0.15),
blurRadius: 4,
blurStyle: BlurStyle.normal
),
]
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
data["nom_categorie"],
style: TextStyle(
fontSize: MediaQuery.of(context).size.height * 0.0237,
color: Theme.of(context).primaryColor
),
),
Icon(
FontAwesomeIcons.chevronRight,
color: Theme.of(context).primaryColor,
size: MediaQuery.of(context).size.height * 0.026
)
],
),
),
),
)
],
);
},
);