jk_bottom_navigation

A native, floating "lens" tab bar for Flutter, in the style of Telegram for iOS. You can tap a tab, or long-press and drag a glass lens across the tabs.

  • iOS: SwiftUI in a UiKitView. iOS 26 uses Liquid Glass; iOS 15–25 use .ultraThinMaterial.
  • Android: Jetpack Compose (Material 3) in an AndroidView. Android 13+ adds an AGSL refraction shader.
  • Other platforms: Flutter's NavigationBar.
iOS 26 Android
At rest
Held and dragged between two tabs
Dark mode, held

Features

  • Tap: the lens springs over to the tab with a bounce, and onTap fires.

  • Hold for 0.25 s: the lens grows (1.16× wide, 1.12× tall), lifts 5 pt over the bar's top edge, and you feel a haptic.

  • Drag:

    • The lens follows your finger and stays inside the bar.
    • It stretches with speed, and the icon under it magnifies.
    • Crossing into a new tab gives a haptic and calls onPreview. With changePageWhileDragging: true, onTap also fires straight away.
  • Release: the lens springs to the centre of the tab, and onTap fires.

  • Glass look while held:

    Effect iOS Android
    Accent colour only where an icon or label is inside the lens ✓ ✓
    Thin rim highlight with an orange / cyan prism glint ✓ ✓
    Chromatic dispersion where icons cross the rim ✓ (colour-shifted copies) ✓ (shader)
    Refraction: content bends and is squeezed near the rim — Android 13+ (AGSL RuntimeShader)
    Liquid Glass lens body iOS 26+ —
  • Numeric badges, an optional round search button, and an accent colour.

  • Accessibility:

    • Every tab exposes its label, badge and selected state to VoiceOver and TalkBack.
    • Reduce Motion (iOS) or animator scale 0 (Android) turns off stretch, magnification, lift and refraction.
  • Light and dark mode follow the system.

Installation

dependencies:
  jk_bottom_navigation: ^1.0.0

You don't need to change AppDelegate or MainActivity. The platform view registers itself, and it works with both FlutterActivity and FlutterFragmentActivity.

Requirements

Minimum
Flutter / Dart 3.50.0 / 3.14.0
iOS 15.0. Swift Package Manager and CocoaPods are both supported.
Android minSdk 24, compileSdk 37.1+ (see below)

The plugin uses Compose BOM 2026.12.00 (Compose UI 1.13), which requires the app to compile against API 37.1 or later. Flutter's default is 36, so set this in android/app/build.gradle.kts:

android {
    compileSdk {
        version = release(37) { minorApiLevel = 2 } // any 37.1+
    }
}

Usage

import 'package:jk_bottom_navigation/jk_bottom_navigation.dart';

Scaffold(
  extendBody: true,
  body: IndexedStack(index: index, children: pages),
  bottomNavigationBar: SafeArea(
    minimum: const EdgeInsets.fromLTRB(16, 0, 16, 8),
    child: NativeTabBar(
      items: const [
        NativeTabItem(title: 'Chats', iosSymbol: 'bubble.left.fill', androidIcon: 'chat', badge: 3),
        NativeTabItem(title: 'Calls', iosSymbol: 'phone.fill', androidIcon: 'call'),
        NativeTabItem(title: 'Contacts', iosSymbol: 'person.crop.circle.fill', androidIcon: 'person'),
        NativeTabItem(title: 'Settings', iosSymbol: 'gearshape.fill', androidIcon: 'settings'),
      ],
      currentIndex: index,
      onTap: (i) => setState(() => index = i),
      onPreview: (i) => debugPrint('preview $i'),
      showSearchButton: true,
      onSearchTap: openSearch,
      accentColor: Colors.blue,
    ),
  ),
);

See example/ for a complete demo, including a Settings page that toggles every option live.

API

NativeTabBar

Parameter Type Default Description
items List<NativeTabItem> required 2–5 tabs
currentIndex int required Selected tab
onTap ValueChanged<int> required A tab was committed by a tap, or by releasing after a drag
onPreview ValueChanged<int>? null The lens is being dragged over a tab
changePageWhileDragging bool false Fire onTap as soon as the lens enters a tab
showSearchButton bool false Round search button on the trailing side
onSearchTap VoidCallback? null Search button tapped
accentColor Color? platform Colour of the selected icon and lens tint
height double 64 Bar height. On iOS and Android the widget adds kNativeTabBarLiftHeadroom (10) above it for the lens lift.

NativeTabItem

Field Type Description
title String Label, also used for accessibility
iosSymbol String SF Symbol name, e.g. bubble.left.fill
androidIcon String One of chat, call, person, settings, home, chart, search, notifications, wallet, star
badge int? Numeric badge. null or 0 hides it; values above 99 show as 99+

How it works

Each bar is a platform view (jk_bottom_navigation). Each one has its own MethodChannel('jk_bottom_navigation_<viewId>'), which uses StandardMessageCodec and sends colours as ARGB ints.

Direction Method Arguments
native → Dart onTap, onPreview int
native → Dart onSearchTap —
Dart → native setIndex int
Dart → native updateItems List<Map>
Dart → native setBadge {index: int, value: int?}
Dart → native setAccent int?
Dart → native setOptions {showSearchButton: bool, changePageWhileDragging: bool}

The lens formulas (stretch, scale, icon magnification, lift, refraction, the capsule SDF used by the shader) live in LensPhysics.swift and LensPhysics.kt. Both files are unit-tested.

Known limitations

  • iOS refraction:
    • iOS has no true refraction. The plugin deliberately ships no Metal shader, because Xcode 26 and later no longer bundle the Metal Toolchain, and an app that pulls in a .metal file would fail to build.
    • System Liquid Glass also frosts whatever it covers, so on iOS the glass lens sits behind the icons to keep them sharp.
  • Android blur: the bar is not blurred. A Compose view can't sample the Flutter content beneath it, so the bar uses a 95%-opaque surfaceContainer with a shadow. Refraction needs Android 13 (API 33).
  • No scroll minimise: the bar doesn't shrink on scroll the way a native UITabBar does, because it can't observe Flutter scroll views.
  • Touches: the 10 pt headroom above the bar is transparent, but it belongs to the platform view and takes touches. The bar uses an EagerGestureRecognizer, so it claims every touch that starts inside its bounds.
  • Selection: the native side selects a tab as soon as it is tapped. If onTap doesn't update currentIndex, the bar stays on the tapped tab until the next setIndex.

Development

flutter test                                 # Dart widget/channel tests
cd example/android && ./gradlew :jk_bottom_navigation:testDebugUnitTest   # JUnit (LensPhysics)
cd example/ios && xcodebuild test -workspace Runner.xcworkspace -scheme Runner \
  -destination 'platform=iOS Simulator,name=iPhone 17 Pro' -only-testing:RunnerTests  # Swift Testing
tool/ios_screenshots.sh <simulator-udid> light /tmp/shots   # drives the lens via XCUITest and captures frames

License

MIT. See LICENSE.

Libraries

jk_bottom_navigation
A native "lens" style bottom tab bar (Telegram-iOS-like) rendered with SwiftUI on iOS and Jetpack Compose on Android through platform views.