flutter 开发中遇到的各种小问题
Published on May 30, 2024, with 31 view(s) and 0 comment(s)
Ai 摘要:本文总结了Flutter开发中容易被忽视但重要的小问题,重点介绍了图片切换时出现闪烁的解决方法。通过在Image组件中设置`gaplessPlayback: true`属性,可以实现图片的无缝加载切换,避免视觉闪烁。该技巧简单实用,能有效提升应用界面的流畅性。
  1. 图片切换闪烁

Image(
                gaplessPlayback: true,//设置这个属性可使无缝加载
                image: widget.currentIndex == widget.index
                    ? widget.tabIconPngFill
                    : widget.tabIconPng,
                height: 18.sp,
              )