Flutter

How to set size to CircularProgressIndicator

27 September 2026 · 6 min read

How to set size to CircularProgressIndicator

The CircularProgressIndicator is a fundamental widget in Flutter, providing visual feedback to users that an operation is in progress. Whether loading data, submitting a form, or performing background tasks, a well-placed progress indicator enhances the user experience by preventing perceived application freezes. However, developers often face a common challenge: accurately and consistently setting the size of a CircularProgressIndicator to fit their specific UI designs. Unlike some widgets that offer direct size properties, the CircularProgressIndicator’s dimensions are typically determined by its parent constraints or require specific wrapper widgets. Understanding these nuances is crucial for creating polished and responsive Flutter applications that seamlessly integrate loading states into their visual flow. This guide will explore the most effective and widely used methods to control the dimensions of your progress indicators.

Understanding CircularProgressIndicator’s Intrinsic Sizing Behavior

A common misconception among new Flutter developers is that the CircularProgressIndicator might have a direct width or height property, similar to an Image or a Container. In reality, the CircularProgressIndicator is a “self-sizing” widget in many contexts, meaning its default dimensions are often derived from its intrinsic size or inherited parent constraints. By default, when placed without explicit size constraints from its parent, it typically renders at a standard size, which might be too large or too small for a given layout. This default behavior is consistent whether it’s an indeterminate (spinning) or determinate (filling) indicator.

The key to understanding how to set size to CircularProgressIndicator lies in Flutter’s layout system, which is based on constraints. A parent widget passes constraints down to its children, and a child widget then determines its size within those constraints. The CircularProgressIndicator attempts to be as large as possible within the constraints it receives, while also respecting its own intrinsic aspect ratio. If it’s placed in an unconstrained environment, such as directly inside a Scaffold’s body without further wrappers, it will try to fill all available space, which is rarely the desired outcome for a loading spinner.

For example, placing it directly inside a Center widget without any further sizing controls would result in it taking up the largest possible square area allowed by the Center widget, which itself tries to be as big as its parent. This behavior necessitates the use of specific layout widgets to impose the desired dimensions on the CircularProgressIndicator, ensuring it appears exactly as intended in your application’s user interface. Mastering this aspect of Flutter’s layout is fundamental for precise UI control.

Method 1: Using SizedBox for Explicit Dimensions

To effectively set the size of a CircularProgressIndicator in Flutter, developers primarily use two robust methods: wrapping it within a SizedBox widget to define explicit width and height, or employing the Transform.scale widget to uniformly scale its default dimensions. These approaches provide precise control over the indicator’s visual footprint, ensuring it integrates seamlessly into various UI layouts without resorting to complex custom painting.

The SizedBox widget is arguably the most straightforward and common way to control the dimensions of a CircularProgressIndicator. It allows you to specify a fixed width and height for its child. When you wrap a CircularProgressIndicator inside a SizedBox, the indicator will occupy precisely the dimensions you define, irrespective of its intrinsic size or parent constraints (as long as the parent allows the SizedBox to take those dimensions). This method is ideal when you need the indicator to occupy an exact pixel size in your layout.

Here’s how you can use SizedBox to set the size of your CircularProgressIndicator:

  1. Identify Desired Dimensions: Determine the exact width and height you want your progress indicator to be. For a circular indicator, these values should typically be equal to maintain its circular aspect ratio.
  2. Wrap with SizedBox: Place your CircularProgressIndicator widget as the child of a SizedBox widget.
  3. Apply Width and Height: Set the width and height properties of the SizedBox to your desired pixel values.
  4. Consider Stroke Width: Remember that while SizedBox controls the overall bounding box, the strokeWidth property of CircularProgressIndicator (defaulting to 4.0) affects the thickness of the line. Adjusting this can further refine its appearance within the given size.

For more details on how SizedBox helps manage layout, you can refer to the official Flutter documentation for SizedBox. This simple yet powerful widget is a cornerstone for many layout adjustments in Flutter development.

Method 2: Scaling with Transform.scale

While `SizedBox` provides explicit pixel dimensions, `Transform.scale` offers a different approach: scaling the `CircularProgressIndicator` proportionally based on a given factor. This method is particularly useful when you want to make the indicator larger or smaller relative to its default rendered size, maintaining its internal proportions, including the stroke width relative to the overall circle. It applies a uniform scaling transformation to its child widget, which means the entire visual representation of the indicator, including its line thickness, will scale up or down.

The Transform.scale widget takes a scale property, which is a double value. A value of 1.0 means no scaling, 0.5 means half the size, and 2.0 means double the size. This is especially handy if you want to scale the indicator without precisely knowing its default pixel dimensions or if you want to animate its size change smoothly. It’s also beneficial in responsive designs where scaling might be more desirable than fixed pixel sizes.

When using Transform.scale, it’s important to understand that it doesn’t change the underlying layout space taken by the widget; it only visually scales it. This means the original layout box of the CircularProgressIndicator might still be present, and other widgets might perceive its unscaled size. To mitigate this, you often combine Transform.scale with other layout widgets like Center or Padding to correctly position the scaled indicator within your UI. For deeper insights into transformations, consult the Flutter Transform class documentation.

Advanced Sizing: Constraints and Layout Question & Answer :


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 height and width, it’s too small.

So, could someone help me with this?

You can wrap your CircularProgressIndicator inside a Center and then SizedBox to define the size:

@override Widget build(BuildContext context) { return Container( child: Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ SizedBox( child: Center( child: CircularProgressIndicator() ), height: 200.0, width: 200.0, ), SizedBox( child: Center( child: CircularProgressIndicator() ), height: 50.0, width: 50.0, ), SizedBox( child: Center( child: CircularProgressIndicator() ), height: 10.0, width: 10.0, ) ], ), ), );