Skip to content

LoadingIndicator

Highly configurable loading animation widget supporting ring, bar, pulse, and dots indicator modes.

Overview

LoadingIndicator provides dynamic visual feedback for ongoing background operations and asynchronous tasks.

Supported styles and modes: - Multiple animation modes: RING, BAR, PULSE, DOTS. - Fine-grained control over arc count, speed, phase, thickness, and size. - Automatic animation tick integration when active.

Configuring and Displaying Loading Indicator

LoadingIndicator indicator = new LoadingIndicator();
indicator.mode(LoadingIndicator.Mode.SPINNER).start();
  • ProgressBar: Linear progress bar widget displaying determinate or indeterminate completion state.
  • Spinner: Rotating progress spinner animation widget for indicating ongoing background operations.

API

LoadingIndicator()

Constructs a LoadingIndicator initialized with SPINNER mode and default styling.

LoadingIndicator::accentColor()

Returns the primary accent color.

Returns MutableColor: The mutable color instance..

LoadingIndicator::activeDots()

Returns the active highlighted dot count.

Returns int: Count of dots..

LoadingIndicator::activeDots(int)

Sets the active highlighted dot count.

Parameter Type Description
activeDots int Number of highlighted active dots.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::angle()

Returns the arc sweep angle in radians.

Returns float: Rotation phase angle in radians..

LoadingIndicator::angle(float)

Sets the arc sweep angle in radians.

Parameter Type Description
radians float Rotation phase angle in radians.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::arcs()

Returns the arc count for multi-arc styles.

Returns int: Count of segments or arcs..

LoadingIndicator::arcs(int)

Sets the arc count for multi-arc styles.

Parameter Type Description
arcs int Number of segments or arcs.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::dots()

Returns the total dot count for dotted styles.

Returns int: Count of dots..

LoadingIndicator::dots(int)

Sets the total dot count for dotted styles.

Parameter Type Description
dots int Total number of dots.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::indicatorSize(float)

Sets both preferred width and height simultaneously in UI pixels.

Parameter Type Description
size float Square dimension or indicator size.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::mode()

Returns the active display mode (SPINNER, BAR, PULSE, DOTS, etc.).

Returns Mode: The loading indicator display mode..

LoadingIndicator::mode(Mode)

Sets the loading indicator display mode.

Parameter Type Description
mode Mode Loading indicator display mode.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::phase()

Returns the current animation phase normalized between 0.0 and 1.0.

Returns float: Rotation phase angle in radians..

LoadingIndicator::phase(float)

Manually sets the animation phase value.

Parameter Type Description
phase float Rotation phase angle in radians.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::preferredHeight()

Returns the preferred indicator height.

Returns float: The floating-point value..

LoadingIndicator::preferredHeight(float)

Sets the preferred indicator height in UI pixels.

Parameter Type Description
preferredHeight float Preferred height dimension.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::preferredSize(float, float)

Sets independent preferred width and height.

Parameter Type Description
width float Width dimension in pixels.
height float Height dimension in pixels.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::preferredWidth()

Returns the preferred indicator width.

Returns float: The floating-point value..

LoadingIndicator::preferredWidth(float)

Sets the preferred indicator width in UI pixels.

Parameter Type Description
preferredWidth float Preferred width dimension.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::radius()

Returns the explicit indicator radius in UI pixels, or 0 if auto-computed.

Returns float: The floating-point value..

LoadingIndicator::radius(float)

Sets an explicit indicator radius in UI pixels.

Parameter Type Description
radius float Circle or arc radius in pixels.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::running()

Returns true if the animation is currently running.

Returns boolean: True if the animation is currently running..

LoadingIndicator::running(boolean)

Starts or stops the animation.

Parameter Type Description
running boolean Whether the animation is active and running.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::secondaryColor()

Returns the secondary highlight color.

Returns MutableColor: The mutable color instance..

LoadingIndicator::segments()

Returns the segment count for segmented styles.

Returns int: Count of segments or arcs..

LoadingIndicator::segments(int)

Sets the segment count for segmented styles.

Parameter Type Description
segments int Number of segments or arcs.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::speed()

Returns the animation speed multiplier.

Returns float: Animation speed multiplier..

LoadingIndicator::speed(float)

Sets the animation speed multiplier.

Parameter Type Description
speed float Animation speed multiplier.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::spinnerStyle()

Returns the active spinner style preset.

Returns Style: The Spinner.Style value..

LoadingIndicator::spinnerStyle(Style)

Sets the spinner style preset.

Parameter Type Description
spinnerStyle Style Visual animation style.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::start()

Starts the indicator animation.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::stop()

Stops the indicator animation.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::thickness()

Returns the stroke thickness in UI pixels.

Returns float: The floating-point value..

LoadingIndicator::thickness(float)

Sets the stroke thickness in UI pixels.

Parameter Type Description
thickness float Stroke thickness in pixels.

Returns LoadingIndicator: This widget instance for chaining..

LoadingIndicator::trackColor()

Returns the background track color.

Returns MutableColor: The mutable color instance..

LoadingIndicator::useDefaultPreferredSize()

Resets dimensions to the default preferred size for the current mode.

Returns LoadingIndicator: This widget instance for chaining..