如何在flatter中的SVG网络图像占位符卡片上显示微光效果



我还没有在stackoverflow中看到哪个描述了我的问题的答案。

以下是的一些变通方法

  1. shimmer: ^latestversion添加到pubspec.yml文件中
  2. 在您的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图像从网络下载

最新更新