cosmic::iced::widget

Function progress_bar

source
pub fn progress_bar<'a, Theme>(
    range: RangeInclusive<f32>,
    value: f32,
) -> ProgressBar<'a, Theme>
where Theme: Catalog + 'a,
Expand description

Creates a new ProgressBar.

Progress bars visualize the progression of an extended computer operation, such as a download, file transfer, or installation.

It expects:

  • an inclusive range of possible values, and
  • the current value of the ProgressBar.

ยงExample

use iced::widget::progress_bar;

struct State {
   progress: f32,
}

enum Message {
    // ...
}

fn view(state: &State) -> Element<'_, Message> {
    progress_bar(0.0..=100.0, state.progress).into()
}