Flutter - change size of a CircularProgressIndicator in a dialog window

1,965

Had the same problem a while ago. You can achieve the result you want by using this:

  AlertDialog(
      content: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          SizedBox(
            width: 150,
            height: 150,
            child: CircularProgressIndicator(),
          ),
        ],
      ),
    );
Share:
1,965
user9918
Author by

user9918

Updated on December 16, 2022

Comments

  • user9918
    user9918 over 1 year

    I would like to have a dialog window with a CircularProgressIndicator. I would like to specify a size for the dialog window, so I use a SizedBox. But if I change the values for high and width, only the high changes. The CircularProgressIndicator is an oval instead of a circle. How can I change the size?

    This is my code

    import 'package:flutter/material.dart';
    
    class Dialogs{
    waiting(BuildContext context){
      return showDialog(
        context: context,
        barrierDismissible: false,
        builder: (BuildContext context){
          return AlertDialog(
            content: SizedBox(
              width: 150.0,
              height: 150.0,
              child: CircularProgressIndicator(
            valueColor: AlwaysStoppedAnimation(Colors.blue),
            strokeWidth: 7.0)
            ),
            );
        }
      );
    }
    }