NIB / DOCUMENTATION
Liquid bottom navigation — NibComponents
Move a water-like selection indicator between real destinations, with badge counts and keyboard activation.
Open interactive viewSelect the liquid indicator
The water effect belongs to NibMotion’s NibNavIndicatorType.liquid. There is no separate NibWater or NibBottomNav constructor in the selected Components package. This composition keeps the bar background opaque so the moving indicator is easy to inspect.
Set indicator.type to liquid. NibNavBar loads packages/nib_motion/lib/shaders/nav_water.frag and drives its phase, tail and position from the library’s motion values. If loading fails, the painter retains a gradient lens. A successful selection callback does not prove the fragment shader executed.
The liquid phase runs after selection and stops at rest. The Motion control below is a host choice: it uses NibMotionConfig.reducedMotion to make changes immediate. The library’s standard navigation configuration animates by default, unlike most Components widgets.
Separate indicator, icons and background
NibNavIndicatorStyle accepts type, color, dimensions, borderRadius and a spring. Its other types are pill, dot, line, highlight and none. Width and height apply to the indicator shapes documented by those properties; they are not a general layout constraint for every effect.
NibNavItemAnimation controls the press and active icon poses independently. Its default press scale is 0.85 and active scale is 1.1. Use NibNavItemAnimation.none to remove those icon poses; the indicator still follows its own transition and reduced-motion policy.
The bar itself is styled with NibNavBarStyle. Glass is an independent background option, so a glass surface and a liquid indicator can be combined in application code. The two guides keep them separate so each visual mechanism is understandable.
Change the destination as well as the indicator
NibNavBar is controlled: currentIndex is the selected destination, and onIndexChanged reports activation. The host updates both currentIndex and an IndexedStack. An IndexedStack keeps each child mounted, so the Inbox draft remains when you visit Settings and return.
The “Next destination from host” button exercises external state changes through the same selection function. This example owns its TextEditingController and FocusNode, disposes both, and releases the draft field’s focus before changing destinations. Tuning radius, badge count or glass style leaves the draft intact.
Selection stays inside the example. Browser history is not changed, repeated activation can report the same index, and there is no automatic back-stack policy. An application can instead use NibScaffold and NibScreenStack for the library’s screen-transition and keepAlive options.
Configure labels, icons and badges
Every NibNavItem requires icon. activeIcon falls back to icon; label is optional. tooltip supplies the accessible target label in this implementation. Keep the item count and currentIndex valid when changing the list.
NibNavBadge.count null means a dot, zero means hidden, and positive counts cap the displayed text at 99+. The example lets you change a numeric count and uses explicit Ember foreground/background colors. Badge copyWith uses null as “keep the old value,” so construct a new badge to switch an existing numeric badge to a dot.
The painter bounds labels to one line with ellipsis. It does not automatically read the ambient TextScaler; this host applies that scale to labelStyle.fontSize and enlarges the bar height. Test very long translations with the number of tabs you actually ship.
Know when selection occurs
Each native target is focusable and exposes selected/button semantics. Tab reaches destinations; Enter and Space activate the focused destination. The package does not provide arrow-key roving between these tabs, and this example does not claim that convention.
Pointer selection is reported on tap-down. Cancellation releases the pressed pose but does not roll back a destination already selected on pointer-down. A horizontal drag is not a supported tab-scrubbing API. The guide tests that cancellation leaves a coherent selected screen rather than inventing a drag gesture.
Reduced motion settles the spring and liquid phase. Physical touch, screen-reader announcements and GPU rendering still require device checks; widget semantics and deterministic input tests establish a narrower contract.
Diagnose the common integration mistakes
If the indicator moves but content does not change, wire onIndexChanged to your own screen state. If a draft disappears, check whether the selected body replaces the entire screen instead of retaining it. Do not create a new controller inside build.
A bar needs a finite width. Put it inside a bounded Stack, Scaffold slot or constrained container; do not place it directly in an unconstrained horizontal Row. Leave enough bottom content padding so the last row remains reachable.
For flat-looking glass, put structured content behind it and check renderer support. For a liquid indicator that looks different on another backend, distinguish the shader path from the painted lens fallback. The guide does not infer backend identity from the selected effect name.
Limits and platform evidence
Composition using nib_motion 0.3.4 and nib_components 0.2.2 local candidates. It is not an additional public Components widget.
Physical Android/iOS touch, native safe areas, screen readers and GPU paths are not certified by the bounded Flutter preview.
Pointer-down commits selection; cancelling a pointer does not restore the previous destination. Drag-to-select is not implemented.