Incular logoIncular
API ReferenceApplication

WidgetsApp

Root shell with routes, locale, title, and banner policy.

WidgetsApp is the root shell owning locale/directionality/media/title/banner policy around the current route. WidgetsAppController is the navigator-shaped route table with platform-route sync and restoration.

use incular::prelude::*;

fn main() {
    let shell = WidgetsApp::new(Text::new("Home"))
        .title("Demo")
        .route("/settings", || Text::new("Settings").into());
    let app = Application::new(move |_cx| shell.clone().into_widget())
        .expect("valid application");
    incular::run(app).expect("run application");
}

The full builder surface (route_widget, initial_route, on_generate_route, on_unknown_route, on_generate_title, title_controller, color, environment, supported_locales, localization_catalog, builder, checked_mode_banner, restoration_scope_id, plus controller() and bootstrap_spec()) shares the same consuming-builder shape shown above.

Controller:

use incular::prelude::*;

fn main() {
    let controller = WidgetsAppController::new();
    controller.set_home(|| Text::new("Home").into());
    controller.register_route("/settings", || Text::new("Settings").into());
    controller.set_initial_route("/home");
    controller
        .push_route("/settings")
        .expect("push route");
    println!("can pop: {}", controller.can_pop());
    println!("current: {}", controller.current_route().location());
}

replace_route, route_stack, dispatch_back, and on_navigation_notification share the same handle shape; with_provider seeds a MemoryRouteInformationProvider.

Bootstrap adapters use ApplicationBootstrapOptions (title, size, policy, resizable, visible, decorations, transparency, background, maximized), ApplicationBootstrapSpec (options + environment + root + restoration id), and the ApplicationBootstrapHost trait (create_application). WidgetsAppData { current_route, can_pop, revision } is the ambient state above the current route. NavigationToolbar { leading, middle, trailing } is the app-bar slot row (center_middle default true). CheckedModeBanner renders a DEBUG banner only under debug_assertions (BannerLocation: TopStart default / TopEnd / BottomStart / BottomEnd).

Related: Router, Navigator, Application.