txs: pull to refresh
This commit is contained in:
parent
8ff6fd1c20
commit
f118ad7d07
3 changed files with 37 additions and 17 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -2691,6 +2691,15 @@ dependencies = [
|
|||
"winit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "egui_pull_to_refresh"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c649d50513fc760df6d6ad74b739189f2768e81df3ec734f1f280bcf68e33c75"
|
||||
dependencies = [
|
||||
"egui",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.11.0"
|
||||
|
@ -3769,6 +3778,7 @@ dependencies = [
|
|||
"eframe",
|
||||
"egui",
|
||||
"egui_extras",
|
||||
"egui_pull_to_refresh",
|
||||
"env_logger 0.10.2",
|
||||
"eye",
|
||||
"fs-mistrust",
|
||||
|
|
|
@ -36,6 +36,7 @@ grin_wallet_controller = "5.3.0"
|
|||
egui = { version = "0.27.2", default-features = false }
|
||||
egui_extras = { version = "0.27.2", features = ["image", "svg"] }
|
||||
rust-i18n = "2.3.1"
|
||||
egui_pull_to_refresh = "0.4.0"
|
||||
|
||||
## other
|
||||
thiserror = "1.0.58"
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
use egui::{Align, Id, Layout, Margin, RichText, Rounding, ScrollArea};
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui_pull_to_refresh::PullToRefresh;
|
||||
use grin_core::core::amount_to_hr_string;
|
||||
use grin_util::ToHex;
|
||||
use grin_wallet_libwallet::{Slate, SlateState, TxLogEntryType};
|
||||
|
@ -178,6 +179,8 @@ impl WalletTransactions {
|
|||
|
||||
// Show list of transactions.
|
||||
ui.add_space(4.0);
|
||||
|
||||
let refresh_resp = PullToRefresh::new(wallet.syncing()).scroll_area_ui(ui, |ui| {
|
||||
ScrollArea::vertical()
|
||||
.scroll_bar_visibility(ScrollBarVisibility::AlwaysVisible)
|
||||
.id_source(Id::from("txs_content").with(wallet.get_config().id))
|
||||
|
@ -194,7 +197,13 @@ impl WalletTransactions {
|
|||
self.tx_item_ui(ui, tx, rounding, extra_padding, true, &data, wallet, cb);
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
// Sync wallet on refresh.
|
||||
if refresh_resp.should_refresh() {
|
||||
wallet.sync();
|
||||
}
|
||||
}
|
||||
|
||||
/// Draw [`Modal`] content for this ui container.
|
||||
|
|
Loading…
Reference in a new issue