繁体   English   中英

使用图像的 Flutter 圆形进度指示器

[英]Flutter Circular Progress Indicator Using Image

我想在加载过程中使用我的应用程序图标。 如何实施。 目前我正在使用循环进度指示器。

return Center(
       child: CircularProgressIndicator(
               strokeWidth: 2));

如果你想要的只是简单的进度指示器,你可以使用它

class ProgressWithIcon extends StatelessWidget {
  const ProgressWithIcon({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: 50,
      height: 50,
      child: Stack(
        alignment: Alignment.center,
        children: [
          Image.network(
            // you can replace this with Image.asset
            'https://avatars.githubusercontent.com/u/1393171?s=50&v=4',
            fit: BoxFit.cover,
            height: 30,
            width: 30,
          ),
          // you can replace
          const CircularProgressIndicator(
            valueColor: AlwaysStoppedAnimation<Color>(Colors.orange),
            strokeWidth: 0.7,
          ),
        ],
      ),
    );
  }
}

在此处输入图片说明

但如果你正在寻找复杂的东西,我会建议你去

有多种实现自定义加载器的方法。 如果您的 loader 是动画的,那么知道您的 loader 的扩展格式。 根据我使用https://lottiefiles.com/ 之类的 json 动画加载器的经验,正在使用一个名为 lottie dependencies: lottie: ^1.2.1的包dependencies: lottie: ^1.2.1如果您的加载器是纯图像,那么您可以选择使用计时器来在采取行动之前显示图像,例如等待来自互联网的一些数据。 如果您需要更多帮助,请告诉我

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM