J'essaie d'ajouter erreur: p> NetworkImage code> Intérieur conteneur code> mais quand j'ajouter .svg code> image i Get d'erreur mais cela fonctionne pour les autres formats comme .png code>, .jpeg code>, etc
3 Réponses :
flutter ne prend pas en charge Vous pouvez utiliser flutter_svg 0.13.0 + 2 , une bibliothèque à Charger et afficher svg code> format pourtant (problème) < / a>. p>
svg code> fichiers p>
Pour mon cas, je consommais un point de terminaison avec SVGS:
ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: countries.length,
physics: ScrollPhysics(),
itemBuilder: (context, index){
final Widget networkSvg = SvgPicture.network(
'${countries[index].flag}',
fit: BoxFit.fill,
semanticsLabel: 'A shark?!',
placeholderBuilder: (BuildContext context) => Container(
padding: const EdgeInsets.all(30.0),
child: const CircularProgressIndicator(
backgroundColor: Colors.redAccent,
)),);
return
Column(
children: [
ListTile(
title: Text('${countries[index].name}'),
leading: CircleAvatar(
backgroundColor: Colors.white,
child: networkSvg,
),
)
],
);
});