Home > database >  SizedBox() not increasing size of CircularProgressIndicator()
SizedBox() not increasing size of CircularProgressIndicator()

Time:09-05

I was having issues increasing the size of my circular progress indicator and after doing some research I landed on this Stack Overflow question: How to set size to CircularProgressIndicator?

So I wrapped my item in a SizedBox() and increased the height and width and nothing changed.

I Also tried adding an expanded to the circular progress indicator but that didnt work either:

                    return Expanded(
                      child: PageView(
                        controller: pageViewController,
                        children: [
                          PackSummaryWeightGraph(
                              categoryWeightList: categoryWeightList,
                              totalWeight: totalWeight),
                          Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              SizedBox(
                                height: 40,
                                width: 40,
                                child: CircularProgressIndicator(
                                  value: packedItemsPercent,
                                ),
                              ),
                            ],
                          ),
                          const Center(
                            child: Text('Third Page'),
                          ),
                        ],
                      ),
                    );

Edit:

IS there anyway to do this programmatically so I do not need to set the size of the width and height manually? I just want it to fill the space.

CodePudding user response:

It needs a parent with constraint, try to wrap it inside a Center or Align

Center(
          child: SizedBox(
            height: 40,
            width: 40,
            child: CircularProgressIndicator(
              value: packedItemsPercent,
            ),
          ),
        ),

CodePudding user response:

Try wrapping the CircularProgessIndicator in a FittedBox like so:

SizedBox(
    height: 40,
    width: 40,
    child: FittedBox(
      child: CircularProgressIndicator(
        value: packedItemsPercent,
      ),
    ),
  )
  • Related