我还没有在stackoverflow中看到哪个描述了我的问题的答案。
以下是的一些变通方法
- 将
shimmer: ^latestversion
添加到pubspec.yml
文件中 - 在您的dart文件中导入包
import 'package:shimmer/shimmer.dart';
SvgPicture.network( width: 130.w,
'https://fromnetwork.svg',
placeholderBuilder: (BuildContext context) =>
Container(
child: Shimmer.fromColors(
baseColor:Colors.grey[300]!,
highlightColor:Colors.grey[100]!,
child:
shimmerCard())),
),
Widget shimmerCard() {
return Container(
color: Colors.white,
);
}
这将给卡上的微光加载,直到svg图像从网络下载