5 releases (3 breaking)

0.4.0 Apr 2, 2024
0.3.0 Feb 7, 2024
0.2.0 Jan 21, 2024
0.1.1 Oct 20, 2023
0.1.0 Oct 20, 2023

#453 in Graphics APIs

Download history 1/week @ 2024-01-19 2/week @ 2024-02-02 6/week @ 2024-02-16 17/week @ 2024-02-23 7/week @ 2024-03-01 5/week @ 2024-03-08 4/week @ 2024-03-15 120/week @ 2024-03-29 17/week @ 2024-04-05

143 downloads per month
Used in hello_egui

MIT license

30KB
284 lines

egui_pull_to_refresh

egui_ver Latest version Documentation unsafe forbidden License

... adds pull to refresh functionality to egui. It works by wrapping a widget in a PullToRefresh widget, which will display a refresh indicator when the user pulls down the widget.

Demo Videos:

https://github.com/lucasmerlin/hello_egui/assets/8009393/b8a7ca7f-4e4b-4ae9-bfad-1e98a88bf5ba

https://github.com/lucasmerlin/hello_egui/assets/8009393/c76e778e-6362-43cd-bef4-2d6e51eaf8d1

Usage

use egui::{Ui};
use egui_pull_to_refresh::PullToRefresh;
// This is the minimal example. Wrap some ui in a [`PullToRefresh`] widget
// and refresh when should_refresh() returns true.
fn my_ui(ui: &mut Ui, count: u64, loading: bool) -> bool {
    let response = PullToRefresh::new(loading).ui(ui, |ui| {
        ui.add_space(ui.available_size().y / 4.0);
        ui.vertical_centered(|ui| {
            ui.set_height(ui.available_size().y);
            ui.label("Pull to refresh demo");

            ui.label(format!("Count: {}", count));
        });
    });

    response.should_refresh()
}

Have a look at the other examples for more.

Dependencies

~4–11MB
~78K SLoC