API ReferenceNavigation & Scrolling
PopScope
Per-route pop guards with nested-navigator first refusal.
PopScope guards its subtree against pops; NavigatorPopHandlerController
gives nested navigators first refusal with an optional result handler.
use incular::prelude::*;
fn main() {
let controller = NavigatorPopHandlerController::new();
controller.set_enabled(true);
controller.set_can_pop(false);
let guarded = controller.can_pop();
let app = Application::new(move |_cx| {
Container::builder()
.padding(EdgeInsets::all(24.0))
.alignment(Alignment::CENTER)
.child(
PopScope::new(Text::new("Guarded"))
.can_pop(guarded)
.on_pop_invoked(|_did_pop| println!("pop attempted")),
)
.build()
.into()
})
.expect("valid application");
incular::run(app).expect("run application");
}Related: Back Dispatch,
Navigator.