0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Flutterでローディング表示する方法

0
Posted at

Flutterで非同期処理中のローディング表示をしたいときに便利なのがCircularProgressIndicatorです。

CircularProgressIndicatorとは、通信中などによく表示される、円形のローディングインジケーターを表示するウィジェットです。

この記事では、基本的な使い方からカスタマイズ方法まで解説します。

基本的な使い方

CircularProgressIndicator()

これだけで円形のローディングが表示されます。
中央に配置したい場合は、Centerで囲みます。

Center(
  child: CircularProgressIndicator(),
)

Screenshot 2026-04-15 12.26.43.png

色を変更する

CircularProgressIndicator(
  color: Colors.blue,
)

背景色を設定する

CircularProgressIndicator(
  color: Colors.blue,
  backgroundColor: Colors.grey[300],
)

太さを変更する

strokeWidthで円の太さを変更できます。

CircularProgressIndicator(
  strokeWidth: 6.0,
)

よくある使い方(画面全体ローディング)

画面全体を覆うローディングの例です。

Stack(
  children: [
    // メイン画面
    YourMainWidget(),

    // ローディング
    if (isLoading)
      Container(
        color: Colors.black.withOpacity(0.3),
        child: Center(
          child: CircularProgressIndicator(),
        ),
      ),
  ],
)

シンプルに使え、カスタマイズも簡単にできるため、扱いやすいウィジェットです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?