0

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.

Ten Digit Grid
  • 1,315
  • 4
  • 22
  • 43
  • You seem to be a little confused about the basic layout concepts in flutter, take a read here: https://docs.flutter.dev/development/ui/layout/constraints – WSBT Sep 04 '22 at 20:47

2 Answers2

1

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,
            ),
          ),
        ),
Ozan Taskiran
  • 2,922
  • 1
  • 13
  • 23
1

Try wrapping the CircularProgessIndicator in a FittedBox like so:

SizedBox(
    height: 40,
    width: 40,
    child: FittedBox(
      child: CircularProgressIndicator(
        value: packedItemsPercent,
      ),
    ),
  )
Josteve
  • 11,459
  • 1
  • 23
  • 35
  • actually going to edit this issue the sized box did work without the fitted box, but I dont know how to make it will the area instead of setting the hight and width manually – Ten Digit Grid Sep 04 '22 at 17:34