简体   繁体   English

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

[英]Flutter Circular Progress Indicator Using Image

I Want to use my App icon during the loading.我想在加载过程中使用我的应用程序图标。 How it can be implemented.如何实施。 Currently I am using Circular Progress Indicator.目前我正在使用循环进度指示器。

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

If all you want is simple progress indicator you can use this如果你想要的只是简单的进度指示器,你可以使用它

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,
          ),
        ],
      ),
    );
  }
}

在此处输入图片说明

But if you are looking for something complex I will suggest you to go with但如果你正在寻找复杂的东西,我会建议你去

There various ways of implementing custom loaders.有多种实现自定义加载器的方法。 If your loader is animated then know the extension format of your loader.如果您的 loader 是动画的,那么知道您的 loader 的扩展格式。 In my experience using a json animated loader like one with https://lottiefiles.com/ is using a package called lottie dependencies: lottie: ^1.2.1 If your loader is a plain image then you have an option to use a timer to display the image before an action is taken for instance await for some data from the internet.根据我使用https://lottiefiles.com/ 之类的 json 动画加载器的经验,正在使用一个名为 lottie dependencies: lottie: ^1.2.1的包dependencies: lottie: ^1.2.1如果您的加载器是纯图像,那么您可以选择使用计时器来在采取行动之前显示图像,例如等待来自互联网的一些数据。 Let me know if you need more assistance如果您需要更多帮助,请告诉我

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

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