CHRISTOPANANJICKAL / fast_cached_network_image

A flutter package to cache network image fastly without native dependencies.
MIT License
30 stars 36 forks source link

Lista de imágenes #46

Closed Nver464 closed 8 months ago

Nver464 commented 8 months ago

I have a list of people, and I show the photo with fast_cached_network_image, but if I apply a filter to the list, the first photo in the list is shown in the first result of the list. Does not show the corresponding photo.

`class ListadoSociosError extends StatefulWidget { @override _ListadoSociosErrorState createState() => _ListadoSociosErrorState(); }

class _ListadoSociosErrorState extends State { ScrollController scroll = ScrollController(); String claveBusqueda = "";

List filtrarListado() { return sociosTotales.where((element) { String nombreCliente = nombreApellido(doc: element.docCliente).toLowerCase().trim(); String numSocio = element.numSocio.toString(); return (removeDiacritics(nombreCliente) .contains(removeDiacritics(claveBusqueda.toLowerCase().trim())) || removeDiacritics(numSocio) .contains(removeDiacritics(claveBusqueda.toLowerCase().trim()))); }).toList(); }

busquedaTeclado(String valor) { claveBusqueda = valor; setState(() {}); }

TextEditingController nombreTXT = TextEditingController();

Widget contenido() { List clientesResultadosBusqueda = filtrarListado(); return Scrollbar( controller: scroll, child: CustomScrollView( controller: scroll, physics: BouncingScrollPhysics(), slivers: [ SliverPersistentHeader( floating: true, delegate: SliverAppBarDelegateAdmin( minHeight: 60, maxHeight: 60, child: Row( children: [ Expanded( child: TextField( controller: nombreTXT, keyboardType: TextInputType.text, textCapitalization: TextCapitalization.words, maxLines: 1, textInputAction: TextInputAction.done, onEditingComplete: () => FocusScope.of(context).requestFocus(FocusNode()), onChanged: (text) { busquedaTeclado(text); }, ), ), ], ), ), ), SliverList( delegate: SliverChildBuilderDelegate( (context, index) { return Row( children: [ Expanded( child: clientesResultadosBusqueda[index].wNombreCliente()), if (clientesResultadosBusqueda[index].url != null) FastCachedImage( url: clientesResultadosBusqueda[index].url!, fadeInDuration: DurationsV.Dmili150, height: 100, errorBuilder: (context, exception, stacktrace) { return Container(); }, ), ], ); }, childCount: clientesResultadosBusqueda.length, ), ) ], ), ); }

@override Widget build(BuildContext context) { return GestureDetector( onTap: () { FocusScope.of(context).requestFocus(FocusNode()); }, child: Scaffold( body: contenido(), ), ); } }`

https://github.com/CHRISTOPANANJICKAL/fast_cached_network_image/assets/63822247/6bc29f49-8eae-427b-af72-9c0d60056aed

CHRISTOPANANJICKAL commented 8 months ago

Use keys for the images in list tile