API ReferenceDesign Systems
Material Navigation
Bottom bars, navigation bars, tabs, and tab controllers.
use incular::prelude::*;
use incular::material_prelude::{Tab, TabBar, TabController};
fn main() {
let controller = TabController::new(2);
let app = Application::new(move |_cx| {
Container::builder()
.padding(EdgeInsets::all(24.0))
.alignment(Alignment::CENTER)
.child(
TabBar::new(vec![Tab::text("Home"), Tab::text("Work")])
.controller(controller.clone())
.on_tap(|i| println!("tab {i}")),
)
.build()
.into()
})
.expect("valid application");
incular::run(app).expect("run application");
}NavigationBar (label_behavior, on_destination_selected), TabBarView,
and BottomNavigationBar share the same controller-driven shape.
| Type | Purpose |
|---|---|
BottomNavigationBar | Fixed/shifting bottom bar with items |
NavigationBar | Material 3 destination bar |
Tab / TabBar / TabBarView | Tab strip with controller-driven views |
TabController | length, index, set_index, animate_to |
TabBarIndicatorSize: Tab (default) / Label. TabAlignment: Fill
(default) / Start / StartOffset / Center.
K_BOTTOM_NAVIGATION_BAR_HEIGHT = 56.
Related: Navigator.