pub struct LinearProgressIndicator {
pub progress_indicator: ProgressIndicatorData,
pub min_height: Option<f64>,
pub border_radius: Option<BorderRadiusGeometry>,
pub stop_indicator_color: Option<Color>,
pub stop_indicator_radius: Option<f64>,
pub track_gap: Option<f64>,
pub year2023: Option<bool>,
pub controller: Option<Ref<AnimationController>>,
}Expand description
A Material Design linear progress indicator, also known as a progress bar.
A widget that shows progress along a line. There are two kinds of linear 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
valuebetween 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 line is displayed with value_color, an animated value. To
specify a constant color value use: AlwaysStoppedAnimation::new(Some(color)).
The minimum height of the indicator can be specified using min_height.
The indicator can be made taller by wrapping the widget with a SizedBox.
§Animation synchronization
When multiple CircularProgressIndicators or LinearProgressIndicators are
animating on screen simultaneously (e.g., in a list of loading items), their
uncoordinated animations can appear visually cluttered. To address this, the
animation of an indicator can be driven by a custom AnimationController.
This allows multiple indicators to be synchronized to a single animation
source. The most convenient way to achieve this for a group of indicators is
by providing a controller via ProgressIndicatorTheme (see
ProgressIndicatorThemeData::controller). All CircularProgressIndicators
or LinearProgressIndicators within that theme’s subtree will then share
the same animation, resulting in a more coordinated and visually pleasing
effect.
Alternatively, a specific AnimationController can be passed directly to the
controller property of an individual indicator.
See also:
CircularProgressIndicator, which shows progress along a circular arc.RefreshIndicator, which automatically displays aCircularProgressIndicatorwhen the underlying vertical scrollable is overscrolled.- https://material.io/design/components/progress-indicators.html#linear-progress-indicators
Fields§
§progress_indicator: ProgressIndicatorDataThe base class’s fields.
Its background_color is the color of the track being filled by the linear
indicator. If it is null then the ambient
ProgressIndicatorThemeData::linear_track_color will be used. If that is null,
then the ambient theme’s ColorScheme::background will be used to draw the track.
min_height: Option<f64>The minimum height of the line used to draw the linear indicator.
If min_height is null then it will use the
ambient ProgressIndicatorThemeData::linear_min_height. If that is null
it will use 4dp.
border_radius: Option<BorderRadiusGeometry>The border radius of both the indicator and the track.
If null, then the ProgressIndicatorThemeData::border_radius will be used.
If that is also null, then defaults to radius of 2, which produces a
rounded shape with a rounded indicator. If ThemeData::use_material3 is false,
then defaults to BorderRadius::ZERO, which produces a rectangular shape
with a rectangular indicator.
stop_indicator_color: Option<Color>The color of the stop indicator.
If year2023 is true or ThemeData::use_material3 is false, then no
stop indicator will be drawn.
If null, then the ProgressIndicatorThemeData::stop_indicator_color will be used.
If that is null, then the ColorScheme::primary will be used.
stop_indicator_radius: Option<f64>The radius of the stop indicator.
If year2023 is true or ThemeData::use_material3 is false, then no
stop indicator will be drawn.
Set stop_indicator_radius to 0 to hide the stop
indicator.
If null, then the ProgressIndicatorThemeData::stop_indicator_radius will be used.
If that is null, then defaults to 2.
track_gap: Option<f64>The gap between the indicator and the 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>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.
When true, the LinearProgressIndicator 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 LinearProgressIndicator 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.
controller: Option<Ref<AnimationController>>An optional AnimationController that controls the animation of this
indeterminate progress indicator.
This controller is only used when the indicator is indeterminate (i.e.,
when value is null). If this property is non-null, value must be null.
The controller’s value is expected to be a linear progression from 0.0 to 1.0, which represents one full cycle of the indeterminate animation.
If this controller is null (and value is also null), the widget will
look for a ProgressIndicatorThemeData::controller. If that is also null,
the widget will create and manage its own internal AnimationController
to drive the default indeterminate animation.
See also:
LinearProgressIndicator::DEFAULT_ANIMATION_DURATION, default duration for one full cycle of the indeterminate animation.
Implementations§
Source§impl LinearProgressIndicator
impl LinearProgressIndicator
Sourcepub const DEFAULT_ANIMATION_DURATION: Duration
pub const DEFAULT_ANIMATION_DURATION: Duration
The default duration for one full cycle of the indeterminate animation.
This duration is used when the widget creates its own AnimationController
because no controller was provided, either directly or through a
ProgressIndicatorTheme.
Sourcepub fn new() -> LinearProgressIndicator
pub fn new() -> LinearProgressIndicator
Creates a linear 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.
Sourcepub fn key(self, key: KeyRef) -> LinearProgressIndicator
pub fn key(self, key: KeyRef) -> LinearProgressIndicator
Dart LinearProgressIndicator(key:).
Sourcepub fn background_color(
self,
background_color: Color,
) -> LinearProgressIndicator
pub fn background_color( self, background_color: Color, ) -> LinearProgressIndicator
Dart LinearProgressIndicator(backgroundColor:).
Sourcepub fn color(self, color: Color) -> LinearProgressIndicator
pub fn color(self, color: Color) -> LinearProgressIndicator
Dart LinearProgressIndicator(color:).
Sourcepub fn value_color(
self,
value_color: AnimationRef<Option<Color>>,
) -> LinearProgressIndicator
pub fn value_color( self, value_color: AnimationRef<Option<Color>>, ) -> LinearProgressIndicator
Dart LinearProgressIndicator(valueColor:).
Sourcepub fn semantics_label(
self,
semantics_label: impl Into<String>,
) -> LinearProgressIndicator
pub fn semantics_label( self, semantics_label: impl Into<String>, ) -> LinearProgressIndicator
Dart LinearProgressIndicator(semanticsLabel:).
Sourcepub fn semantics_value(
self,
semantics_value: impl Into<String>,
) -> LinearProgressIndicator
pub fn semantics_value( self, semantics_value: impl Into<String>, ) -> LinearProgressIndicator
Dart LinearProgressIndicator(semanticsValue:).
Sourcepub fn value(self, value: f64) -> LinearProgressIndicator
pub fn value(self, value: f64) -> LinearProgressIndicator
Dart LinearProgressIndicator(value:).
Sourcepub fn min_height(self, min_height: f64) -> LinearProgressIndicator
pub fn min_height(self, min_height: f64) -> LinearProgressIndicator
Dart LinearProgressIndicator(minHeight:).
Sourcepub fn border_radius(
self,
border_radius: impl Into<BorderRadiusGeometry>,
) -> LinearProgressIndicator
pub fn border_radius( self, border_radius: impl Into<BorderRadiusGeometry>, ) -> LinearProgressIndicator
Dart LinearProgressIndicator(borderRadius:).
Sourcepub fn stop_indicator_color(
self,
stop_indicator_color: Color,
) -> LinearProgressIndicator
pub fn stop_indicator_color( self, stop_indicator_color: Color, ) -> LinearProgressIndicator
Dart LinearProgressIndicator(stopIndicatorColor:).
Sourcepub fn stop_indicator_radius(
self,
stop_indicator_radius: f64,
) -> LinearProgressIndicator
pub fn stop_indicator_radius( self, stop_indicator_radius: f64, ) -> LinearProgressIndicator
Dart LinearProgressIndicator(stopIndicatorRadius:).
Sourcepub fn track_gap(self, track_gap: f64) -> LinearProgressIndicator
pub fn track_gap(self, track_gap: f64) -> LinearProgressIndicator
Dart LinearProgressIndicator(trackGap:).
Sourcepub fn year2023(self, year2023: bool) -> LinearProgressIndicator
👎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.26.0-0.1.pre.
pub fn year2023(self, year2023: bool) -> LinearProgressIndicator
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.26.0-0.1.pre.
Dart LinearProgressIndicator(year2023:).
Sourcepub fn controller(
self,
controller: Ref<AnimationController>,
) -> LinearProgressIndicator
pub fn controller( self, controller: Ref<AnimationController>, ) -> LinearProgressIndicator
Dart LinearProgressIndicator(controller:).
Trait Implementations§
Source§impl Clone for LinearProgressIndicator
impl Clone for LinearProgressIndicator
Source§impl Debug for LinearProgressIndicator
impl Debug for LinearProgressIndicator
Source§impl Default for LinearProgressIndicator
impl Default for LinearProgressIndicator
Source§impl ProgressIndicator for LinearProgressIndicator
impl ProgressIndicator for LinearProgressIndicator
Source§fn progress_indicator_data(&self) -> &ProgressIndicatorData
fn progress_indicator_data(&self) -> &ProgressIndicatorData
ProgressIndicatorData bag.Source§impl StatefulWidget for LinearProgressIndicator
impl StatefulWidget for LinearProgressIndicator
Source§type State = LinearProgressIndicatorState
type State = LinearProgressIndicatorState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
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) -> LinearProgressIndicatorState
fn create_state(&self) -> LinearProgressIndicatorState
Source§fn as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
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 LinearProgressIndicator
impl !Send for LinearProgressIndicator
impl !Sync for LinearProgressIndicator
impl !UnwindSafe for LinearProgressIndicator
impl Forget for LinearProgressIndicator
impl Freeze for LinearProgressIndicatorwhere
*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 LinearProgressIndicator
impl Unpin for LinearProgressIndicator
impl UnsafeUnpin for LinearProgressIndicatorwhere
*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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.