我需要在闪屏上应用一个闪亮的效果。其目的是再现Glassdoor应用程序的闪屏效果。有关于如何编码的想法吗?
发布于 2019-10-07 20:55:04
我推荐使用shimmer。他们的例子非常简单,应该会让你走得很远。
发布于 2019-10-08 09:42:16
@Hannes感谢您的回复!我试过闪光效果。
下面是我的代码:
Widget build(BuildContext context) {
return new Scaffold(
backgroundColor: Color.fromRGBO(185, 40, 47, 1),
body: new Center(
child:SizedBox(
width: MediaQuery.of(context).size.width * 0.7,
//height: 100.0,
child: Shimmer.fromColors(
baseColor: Colors.transparent,
highlightColor: Colors.white,//.withOpacity(0.2),
child: Image.asset('assets/NishkamSWATLogoOfficialSplash.jpg',
width: MediaQuery.of(context).size.width * 0.7,)
),
),
),
);
}
但是这张图片没有显示1
发布于 2020-06-17 20:38:03
还有另一个较新的 Flutter软件包[ shimmer_animation ],它可能正是您正在寻找的。此较新的shimmer_animation包不会使用@Hannes-Kuttner推荐的其他[ shimmer ]包那样的基色覆盖您要显示的图像。
https://stackoverflow.com/questions/58276860
复制