How to set size to CircularProgressIndicator?

后端 未结 7 1452
太阳男子
太阳男子 2020-12-08 13:01

I\'m trying to make a loading screen for my application, I\'m using CircularProgressIndicator widget, but I want to know if there\'s a way to make it bigger in

7条回答
  •  借酒劲吻你
    2020-12-08 13:30

    Please test your answers.

    By simply placing the CircularProgressIndicator in a SizedBox, or a Container:

    main() =>
        runApp(
            SizedBox(width: 30, height: 30, child: CircularProgressIndicator()));
    

    ... still results in the CircularProgressIndicator filling the available space. SizedBox does not constrain the CircularProgressIndicator (which seems like a bug in Flutter).

    Wrapping it with Center, however, will make it work:

    main() =>
        runApp(Center(child: 
            SizedBox( width: 30, height: 30, child: CircularProgressIndicator())));
    

    I complained about this confusing behavior on Github. The flutter team helpfully responded with new docs explaining that a widget’s desired size may be ignored for if it’s alignment can’t be determined.

    https://github.com/flutter/website/pull/5010/commits/3070c777a61b493b46cdde92fa7afc21de7adf25

提交回复
热议问题