我试图从API获取某些图片的链接,并使其成为listTile的开头,但是问题是其中某些图片是SVG,这会导致错误。
我尝试使用flutter_svg:^ 0.14.0,但我的应用已暂停并停止工作。
ListView.builder(
itemCount: myconis.length,
padding: EdgeInsets.all(10),
shrinkWrap: true,
physics: ScrollPhysics(parent: null),
itemBuilder: (BuildContext context, int index) {
Map currency = myconis[index];
return ListTile(
leading: SvgPicture.network(
currency['logo_url'],
placeholderBuilder: (context) =>
CircularProgressIndicator(),
width: 10,
height: 10,
),
title: Text(
currency['name'],
style: TextStyle(
color: Colors.green,
fontSize: 15,
fontFamily: 'myfont'),
),
subtitle: Text(
currency['symbol'],
style: TextStyle(
color: Colors.grey,
fontSize: 13,
fontWeight: FontWeight.w400),
),
trailing: Text(
'\$ ' + currency['price'].toString().substring(0, 8),
style: TextStyle(color: Colors.white, fontSize: 15),
),
);