簡體   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