Skip to main content

CircularProgressIndicator

Struct CircularProgressIndicator 

Source
pub struct CircularProgressIndicator {
    pub progress_indicator: ProgressIndicatorData,
    pub stroke_width: Option<f64>,
    pub stroke_align: Option<f64>,
    pub stroke_cap: Option<StrokeCap>,
    pub constraints: Option<BoxConstraints>,
    pub track_gap: Option<f64>,
    pub year2023: Option<bool>,
    pub padding: Option<EdgeInsetsGeometry>,
    pub controller: Option<Ref<AnimationController>>,
    /* private fields */
}
Expand description

A Material Design circular progress indicator, which spins to indicate that the application is busy.

A widget that shows progress along a circle. There are two kinds of circular progress indicators:

  • Determinate. Determinate progress indicators have a specific value at each point in time, and the value should increase monotonically from 0.0 to 1.0, at which time the indicator is complete. To create a determinate progress indicator, use a non-null value between 0.0 and 1.0.
  • Indeterminate. Indeterminate progress indicators do not have a specific value at each point in time and instead indicate that progress is being made without indicating how much progress remains. To create an indeterminate progress indicator, use a null value.

The indicator arc is displayed with value_color, an animated value. To specify a constant color use: AlwaysStoppedAnimation::new(Some(color)).

For synchronizing the animations of several indicators, see LinearProgressIndicator’s “Animation synchronization”.

See also:

Fields§

§progress_indicator: ProgressIndicatorData

The base class’s fields.

Its background_color is the color of the circular track being filled by the circular indicator. If it is null then the ambient ProgressIndicatorThemeData::circular_track_color will be used. If that is null, then the track will not be painted.

§stroke_width: Option<f64>

The width of the line used to draw the circle.

§stroke_align: Option<f64>

The relative position of the stroke on a CircularProgressIndicator.

Values typically range from -1.0 (STROKE_ALIGN_INSIDE, inside stroke) to 1.0 (STROKE_ALIGN_OUTSIDE, outside stroke), without any bound constraints (e.g., a value of -2.0 is not typical, but allowed). A value of 0 (STROKE_ALIGN_CENTER) will center the border on the edge of the widget.

If year2023 is true, then the default value is STROKE_ALIGN_CENTER. Otherwise, the default value is STROKE_ALIGN_INSIDE.

§stroke_cap: Option<StrokeCap>

The progress indicator’s line ending.

This determines the shape of the stroke ends of the progress indicator. By default, stroke_cap is null. When value is null (indeterminate), the stroke ends are set to StrokeCap::Square. When value is not null, the stroke ends are set to StrokeCap::Butt.

Setting stroke_cap to StrokeCap::Round will result in a rounded end. Setting stroke_cap to StrokeCap::Butt with value == null will result in a slightly different indeterminate animation; the indicator completely disappears and reappears on its minimum value. Setting stroke_cap to StrokeCap::Square with value != null will result in a different display of value. The indicator will start drawing from slightly less than the start, and end slightly after the end. This will produce an alternative result, as the default behavior, for example, that a value of 0.5 starts at 90 degrees and ends at 270 degrees. With StrokeCap::Square, it could start 85 degrees and end at 275 degrees.

§constraints: Option<BoxConstraints>

Defines minimum and maximum sizes for a CircularProgressIndicator.

If null, then the ProgressIndicatorThemeData::constraints will be used. Otherwise, defaults to a minimum width and height of 36 pixels.

§track_gap: Option<f64>

The gap between the active indicator and the background track.

If year2023 is true or ThemeData::use_material3 is false, then no track gap will be drawn.

Set track_gap to 0 to hide the track gap.

If null, then the ProgressIndicatorThemeData::track_gap will be used. If that is null, then defaults to 4.

§year2023: Option<bool>
👎Deprecated:

Set this flag to false to opt into the 2024 progress indicator appearance. Defaults to true. In the future, this flag will default to false. Use ProgressIndicatorThemeData to customize individual properties. This feature was deprecated after v3.27.0-0.2.pre.

When true, the CircularProgressIndicator will use the 2023 Material Design 3 appearance.

If null, then the ProgressIndicatorThemeData::year2023 will be used. If that is null, then defaults to true.

If this is set to false, the CircularProgressIndicator will use the latest Material Design 3 appearance, which was introduced in December 2023.

If ThemeData::use_material3 is false, then this property is ignored.

§padding: Option<EdgeInsetsGeometry>

The padding around the indicator track.

If null, then the ProgressIndicatorThemeData::circular_track_padding will be used. If that is null and year2023 is false, then defaults to EdgeInsets::all(4.0) padding. Otherwise, defaults to zero padding.

§controller: Option<Ref<AnimationController>>

An optional AnimationController that controls the animation of this indeterminate progress indicator; see LinearProgressIndicator::controller.

See also:

Implementations§

Source§

impl CircularProgressIndicator

Source

pub const STROKE_ALIGN_INSIDE: f64 = -1.0

The indicator stroke is drawn fully inside of the indicator path.

This is a constant for use with stroke_align.

Source

pub const STROKE_ALIGN_CENTER: f64 = 0.0

The indicator stroke is drawn on the center of the indicator path, with half of the stroke_width on the inside, and the other half on the outside of the path.

This is a constant for use with stroke_align.

This is the default value for stroke_align.

Source

pub const STROKE_ALIGN_OUTSIDE: f64 = 1.0

The indicator stroke is drawn on the outside of the indicator path.

This is a constant for use with stroke_align.

Source

pub const DEFAULT_ANIMATION_DURATION: Duration

The default duration for one full cycle of the indeterminate animation.

During this period, the indicator completes several full rotations.

This duration is used when the widget creates its own AnimationController because no controller was provided, either directly or through a ProgressIndicatorTheme.

Source

pub fn new() -> CircularProgressIndicator

Creates a circular progress indicator.

The value argument can either be null for an indeterminate progress indicator, or a non-null value between 0.0 and 1.0 for a determinate progress indicator.

Source

pub fn adaptive() -> CircularProgressIndicator

Creates an adaptive progress indicator that is a CupertinoActivityIndicator on TargetPlatform::IOS & TargetPlatform::MacOS and a CircularProgressIndicator in material theme/non-Apple platforms.

The value_color, stroke_width, stroke_align, stroke_cap, semantics_label, semantics_value, track_gap, year2023 will be ignored on iOS & macOS.

Dart’s CircularProgressIndicator.adaptive has no color parameter: its color is null, so a color set on it is ignored (effective_color).

Source

pub fn key(self, key: KeyRef) -> CircularProgressIndicator

Dart CircularProgressIndicator(key:).

Source

pub fn background_color( self, background_color: Color, ) -> CircularProgressIndicator

Dart CircularProgressIndicator(backgroundColor:).

Source

pub fn color(self, color: Color) -> CircularProgressIndicator

Dart CircularProgressIndicator(color:).

Source

pub fn value_color( self, value_color: AnimationRef<Option<Color>>, ) -> CircularProgressIndicator

Dart CircularProgressIndicator(valueColor:).

Source

pub fn semantics_label( self, semantics_label: impl Into<String>, ) -> CircularProgressIndicator

Dart CircularProgressIndicator(semanticsLabel:).

Source

pub fn semantics_value( self, semantics_value: impl Into<String>, ) -> CircularProgressIndicator

Dart CircularProgressIndicator(semanticsValue:).

Source

pub fn value(self, value: f64) -> CircularProgressIndicator

Dart CircularProgressIndicator(value:).

Source

pub fn stroke_width(self, stroke_width: f64) -> CircularProgressIndicator

Dart CircularProgressIndicator(strokeWidth:).

Source

pub fn stroke_align(self, stroke_align: f64) -> CircularProgressIndicator

Dart CircularProgressIndicator(strokeAlign:).

Source

pub fn stroke_cap(self, stroke_cap: StrokeCap) -> CircularProgressIndicator

Dart CircularProgressIndicator(strokeCap:).

Source

pub fn constraints( self, constraints: BoxConstraints, ) -> CircularProgressIndicator

Dart CircularProgressIndicator(constraints:).

Source

pub fn track_gap(self, track_gap: f64) -> CircularProgressIndicator

Dart CircularProgressIndicator(trackGap:).

Source

pub fn year2023(self, year2023: bool) -> CircularProgressIndicator

👎Deprecated:

Set this flag to false to opt into the 2024 progress indicator appearance. Defaults to true. In the future, this flag will default to false. Use ProgressIndicatorThemeData to customize individual properties. This feature was deprecated after v3.27.0-0.1.pre.

Dart CircularProgressIndicator(year2023:).

Source

pub fn padding( self, padding: impl Into<EdgeInsetsGeometry>, ) -> CircularProgressIndicator

Dart CircularProgressIndicator(padding:).

Source

pub fn controller( self, controller: Ref<AnimationController>, ) -> CircularProgressIndicator

Dart CircularProgressIndicator(controller:).

Source

pub fn effective_color(&self) -> Option<Color>

Dart’s color field: what the color setter was given, and null for an indicator made with CircularProgressIndicator::adaptive, whose constructor has no color.

Trait Implementations§

Source§

impl Clone for CircularProgressIndicator

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CircularProgressIndicator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CircularProgressIndicator

Source§

fn default() -> CircularProgressIndicator

Returns the “default value” for a type. Read more
Source§

impl ProgressIndicator for CircularProgressIndicator

Source§

impl StatefulWidget for CircularProgressIndicator

Source§

type State = CircularProgressIndicatorState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn create_state(&self) -> CircularProgressIndicatorState

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_check_constructor(&self)

Source§

fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Source§

fn type_name(&self) -> &'static str

See Widget::type_name. A stateful form another widget kind becomes (an animated or status transition widget) names the widget it wraps.

Auto Trait Implementations§

§

impl !RefUnwindSafe for CircularProgressIndicator

§

impl !Send for CircularProgressIndicator

§

impl !Sync for CircularProgressIndicator

§

impl !UnwindSafe for CircularProgressIndicator

§

impl Forget for CircularProgressIndicator

§

impl Freeze for CircularProgressIndicator
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, NonZero<u32>: Freeze, &'static AnimationVTable<Option<Color>>: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<fn() -> AnimationController>: Freeze,

§

impl Move for CircularProgressIndicator

§

impl Unpin for CircularProgressIndicator
where Rc<dyn Key>: Unpin, NonZero<u32>: Unpin, &'static AnimationVTable<Option<Color>>: Unpin, Rc<Keep>: Unpin, *const u8 is !null: Unpin,

§

impl UnsafeUnpin for CircularProgressIndicator
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, &'static AnimationVTable<Option<Color>>: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, PhantomData<fn() -> AnimationController>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>