CNProgressIndicator class
A native progress indicator: a bar that fills as work completes, or a spinner for work of unknown length.
Pass a value from 0 to 1 when the progress is known (determinate), or leave it null for an indeterminate indicator. Changes of value animate natively.
| macOS | iOS 26+ | iOS < 26 | other platforms | |
|---|---|---|---|---|
| bar, value | NSProgressIndicator bar |
UIProgressView |
Flutter bar | LinearProgressIndicator |
| bar, no value | moving bar | UIActivityIndicatorView |
CupertinoActivityIndicator |
LinearProgressIndicator |
| spinner, value | filling circle | UIActivityIndicatorView |
CupertinoActivityIndicator |
CircularProgressIndicator |
| spinner, no value | spinning indicator | UIActivityIndicatorView |
CupertinoActivityIndicator |
CircularProgressIndicator |
On macOS (every supported version) the indicator is AppKit's, drawn by
SwiftUI's ProgressView, which also tints it. iOS has no indeterminate
bar and no filling circle, so there those show the activity indicator.
A bar takes the width of its parent (160 points when the parent is unbounded) and the native height; a spinner is a fixed square.
VoiceOver reads semanticLabel with the progress as a percentage ("Upload, 40 percent").
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CNProgressIndicator
- Available extensions
Constructors
- CNProgressIndicator({Key? key, double? value, CNProgressStyle style = CNProgressStyle.bar, Color? tint, CNControlSize? size, String? semanticLabel, bool autoHideOnModal = true})
-
Creates a native progress indicator.
const
Properties
- autoHideOnModal → bool
-
When true (default), replaces the native view with an empty box of the
same size while a modal sheet covers it (Issue #53). Requires
CNTabBarRouteObserver()in the app'snavigatorObservers.final - hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
What VoiceOver reads for the indicator, before its progress.
final
- size → CNControlSize?
-
Size class of the indicator; null is CNControlSize.regular.
final
- style → CNProgressStyle
-
Bar or spinner.
final
- tint → Color?
-
Colour of the filled part of the bar and of the spinner. Null keeps the
system colour (the accent colour for a bar, grey for a spinner).
final
- value → double?
-
Progress from 0 to 1, or null when it is not known. Values outside
0..1 are clamped.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CNProgressIndicator> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
liquidGlass(
{CNGlassEffect effect = CNGlassEffect.regular, CNGlassEffectShape shape = CNGlassEffectShape.capsule, double? cornerRadius, Color? tint, bool interactive = false}) → Widget -
Available on Widget, provided by the LiquidGlassExtension extension
Applies a Liquid Glass effect to this widget. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited