Skip to main content

uikit_liquid_glass 0.1.0 copy "uikit_liquid_glass: ^0.1.0" to clipboard
uikit_liquid_glass: ^0.1.0 copied to clipboard

Real iOS 26 Liquid Glass for Flutter: Apple's own UIGlassEffect and UITabBar as platform views, with a Dart fallback on Android, web and older iOS. RTL-ready.

A Flutter app on iOS 26 with Apple's own Liquid Glass tab bar and glass panels over bright colour tiles

License: MIT Flutter 3.50 iOS 26 or later, built with Xcode 26 Native UIGlassEffect and UITabBar on iOS 26 No package: about 200 lines of Swift you own Guide in Arabic and English, tested right-to-left

English · العربية

Real iOS 26 Liquid Glass in Flutter, from Apple's own UIKit #

Not a look-alike drawn in Dart: Apple's actual UIGlassEffect and UITabBar, hosted inside your Flutter app with one Swift file and no package. A Dart fallback keeps the same design on Android, the web and older iPhones.

Flutter draws every pixel itself, so it cannot draw Apple's new material. It can, however, host Apple's own views inside the Flutter screen. That is the whole trick: a UIVisualEffectView with UIGlassEffect for panels, and a plain UITabBar for the tab bar, which iOS 26 already draws as the floating glass bar with Apple's lens, press-lift and spring. This repository is a small, complete app that does it, and this page explains every piece.

Gallery page in English: colour tiles under a native glass header and a native glass tab bar A finger dragging along the native tab bar: Apple's lens lifts and magnifies the tab under it The playground in Arabic and dark mode: native clear glass, tabs ordered right to left
Native tab bar over Flutter content Dragging: Apple's own lens Arabic, dark, right to left

A 14-second tour: the gallery scrolls under the native glass, then the playground and the comparison

Screenshots and recording: iPhone 17 Pro Max simulator, iOS 26.5, built with Xcode 26.5 and Flutter 3.50. Full recordings: English, light · Arabic, dark.

Contents #

Install #

flutter pub add uikit_liquid_glass
import 'package:uikit_liquid_glass/uikit_liquid_glass.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await GlassSupport.probe(); // once: is Apple's glass available here?
  runApp(const MyApp());
}

// Anywhere in your UI:
GlassTabBar(
  tabs: const [
    GlassTab(label: 'Home', symbol: 'house', icon: Icons.home_rounded),
    GlassTab(label: 'Settings', symbol: 'gearshape', icon: Icons.settings_rounded),
  ],
  selected: index,
  onSelected: (i) => setState(() => index = i),
  brightness: Theme.of(context).brightness,
)

On iOS 26 that is Apple's own UITabBar; on Android, the web and older iPhones it is the Dart fallback. Prefer no dependency? Everything below explains how to copy the ~200 lines into your own app instead.

Use it with an AI agent #

PROMPT.md is a ready-made, self-contained prompt. It carries all the code, the steps, the checks and the pitfalls, so you don't need to clone this repo. Open your own Flutter project in Claude Code, Cursor, Copilot, Codex or any coding agent, and paste the prompt in. The agent adds native glass on iOS 26 and a Dart fallback elsewhere, keeping your tabs, labels and navigation as they are.

Follow the instructions in https://github.com/yahyakhalid/flutter-uikit-liquid-glass/blob/main/PROMPT.md to add Liquid Glass to this app.

If your agent can't open links, paste the whole file instead. Arabic version: PROMPT.ar.md. Agents working inside this repository read AGENTS.md.

Should you use a package instead? #

Maybe. Several good ones exist, and this guide does not claim to be the first. Pick by what you need:

You want Look at
Apple's native controls, maintained for you cupertino_native_better, native_liquid_glass, ios_liquid_glass, real_liquid_glass, prism_glass
The same glass look on every platform, drawn by a shader liquid_glass_widgets, liquid_glass_easy, liquid_glass_renderer
To understand it, and own the ~200 lines in your app, or a small package that does just this this repository (uikit_liquid_glass)

Owning the code matters when you need something a package does not expose (your own creation parameters, right-to-left, light/dark that follows your theme rather than the system), or when you would rather not add a native dependency for one tab bar.

How it works #

Diagram: at startup Dart asks the native side whether iOS 26 glass exists. If yes, GlassSurface and GlassTabBar build a UiKitView that hosts UIVisualEffectView with UIGlassEffect, or UITabBar. If no, they build DartGlass with BackdropFilter. Each native view has its own MethodChannel.

  1. One probe, one decision. At startup Dart asks the native side once: "is iOS 26 glass available?" Platform.isIOS is not enough: below iOS 26 a UITabBar draws the old opaque bar and UIGlassEffect does not exist.
  2. Two widgets hide the choice. GlassSurface and GlassTabBar build a UiKitView when the answer is yes and a Dart imitation when it is no. Screens never know which one they got.
  3. Each native view has its own channel, named liquid_glass/<kind>_<viewId>, so several can live on one screen. Dart sends update and setSelected; the tab bar sends onSelected back.

Requirements #

  • Xcode 26 (the iOS 26 SDK). UIGlassEffect is an iOS 26 symbol, and a UITabBar only looks like glass when the app is built with this SDK.
  • iOS 26 or later to see native glass. Your deployment target can stay lower: this demo targets iOS 15 and falls back to Dart below 26.
  • Flutter 3.50 with Impeller (the default on iOS). Earlier 3.x versions should work, but this is the version tested here.

Step by step #

1. Ask once whether native glass exists #

// ios/uikit_liquid_glass/Sources/uikit_liquid_glass/LiquidGlass.swift
let channel = FlutterMethodChannel(name: "liquid_glass/support", binaryMessenger: messenger)
channel.setMethodCallHandler { call, result in
  guard call.method == "isSupported" else { return result(FlutterMethodNotImplemented) }
  if #available(iOS 26.0, *) { result(true) } else { result(false) }
}
// lib/src/glass_support.dart
static Future<void> probe() async {
  if (kIsWeb || defaultTargetPlatform != TargetPlatform.iOS) return;
  try {
    _native = await _channel.invokeMethod<bool>('isSupported') ?? false;
  } on MissingPluginException {
    _native = false;
  }
}

Call await GlassSupport.probe() in main() before runApp, so the first frame already knows.

2. A native glass view #

A platform view needs a factory (Flutter asks it for a view) and the view itself:

final class GlassSurfaceView: NSObject, FlutterPlatformView {
  private let container: UIView
  private let effectView = UIVisualEffectView(effect: nil)

  func view() -> UIView { container }

  private func apply(_ a: [String: Any]) {
    if #available(iOS 26.0, *) {
      let glass = UIGlassEffect(style: (a["style"] as? String) == "clear" ? .clear : .regular)
      if let tint = a["tint"] as? Int { glass.tintColor = UIColor(argb: tint) }
      glass.isInteractive = (a["interactive"] as? Bool) ?? false
      effectView.effect = glass
      // A glass view ignores layer.cornerRadius on iOS 26: its shape comes from cornerConfiguration.
      effectView.cornerConfiguration = .capsule()
    }
  }
}

UIGlassEffect has few switches: a style (.regular or .clear), a tintColor, and isInteractive (Apple's press-lift and stretch). The full file is ios/uikit_liquid_glass/Sources/uikit_liquid_glass/LiquidGlass.swift.

3. Register it #

Flutter 3.50's iOS template uses an implicit engine, so register next to the generated plugins:

// ios/Runner/AppDelegate.swift
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
  GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
  LiquidGlass.register(with: engineBridge.pluginRegistry)
}

and inside register:

guard let registrar = registry.registrar(forPlugin: "LiquidGlass") else { return }
registrar.register(GlassSurfaceFactory(messenger: registrar.messenger()), withId: "liquid_glass/surface")

4. Show it from Dart #

UiKitView(
  viewType: 'liquid_glass/surface',
  creationParams: {'style': 'regular', 'capsule': true, 'brightness': 'light'},
  creationParamsCodec: const StandardMessageCodec(),
  onPlatformViewCreated: (id) => _channel = MethodChannel('liquid_glass/surface_$id'),
)

GlassSurface puts this UiKitView at the bottom of a Stack and your Flutter child on top. Text and buttons stay ordinary Flutter widgets; the glass behind them is Apple's.

Yes, the native glass bends Flutter's pixels. The glass blurs and refracts the Flutter content under it, live, while you scroll.

5. The tab bar is just a UITabBar #

There is no glass code in the tab bar at all. Built with the iOS 26 SDK, a standalone UITabBar draws the floating glass bar by itself, lens and all:

let items = raw.enumerated().map { index, item in
  UITabBarItem(title: item["label"] as? String,
               image: UIImage(systemName: item["symbol"] as? String ?? "circle"),
               tag: index)
}
tabBar.setItems(items, animated: false)

func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
  channel.invokeMethod("onSelected", arguments: item.tag)
}

Selecting a tab from Dart sets tabBar.selectedItem, which does not call the delegate, so a change never echoes back to Dart.

On the Dart side, give the bar a slot taller than the bar:

SizedBox(
  height: 96, // the bar itself is about 62
  child: UiKitView(
    viewType: 'liquid_glass/tab_bar',
    gestureRecognizers: {Factory(() => EagerGestureRecognizer())},
    // ...
  ),
)

UIKit draws the glass rim and the lifted lens a few points outside the bar. Flutter only shows what is inside the platform view, so a tight slot cuts the rim off.

6. The Dart fallback #

Android, the web and iOS before 26 get DartGlass. It is not Apple's glass (no lens, no refraction), but it is close enough to keep one design.

  • One BackdropFilter blur per glass surface, never one per item, inside a ClipRRect and a RepaintBoundary.
  • A semi-opaque fill with a faint top-to-bottom gradient.
  • A painted rim: a light gradient stroke and a hairline dark stroke.
  • A tight shadow with a negative spread, so it stays tight when the shape is small.

7. Arabic and other right-to-left languages #

Pass Flutter's text direction to the native bar and force it there:

tabBar.semanticContentAttribute = rtl ? .forceRightToLeft : .forceLeftToRight

The tab order and the drag direction of the lens then follow the language. Check that labels are not clipped under the lens, and try large Dynamic Type sizes.

Gotchas #

  • Light/dark follows the system, not your theme. A light-only Flutter app on a phone in Dark Mode gets dark, smoky glass with white labels. This demo sends its own brightness to every native view, which sets overrideUserInterfaceStyle. A light-only app can also set UIUserInterfaceStyle = Light in Info.plist.
  • Use regular glass for anything with text on it. Clear glass lets the page's text read through your labels.
  • Re-tapping the selected tab is not reported by UITabBar. If you need "scroll to top", add a tap recogniser that does not cancel touches.
  • Minimise-on-scroll is not available to a standalone UITabBar. It belongs to UITabBarController watching a UIScrollView, and it cannot see Flutter's scrolling. Animate your own compact state, or skip it.
  • Hide the native bar when it should not be there: on splash, sign-in and full-screen routes, and while the keyboard is up. Keep the page's bottom padding equal to the slot height plus the safe area.
  • Widget tests cannot render platform views. Keep the Dart bar under widget tests, and check the native path on a simulator.
  • Measure performance on a device. A platform view makes Flutter compose extra layers, and the simulator tells you nothing about the real cost.
  • Watch the Mac's disk. Xcode 26 runtimes and DerivedData are large.

Run the demo #

git clone https://github.com/yahyakhalid/flutter-uikit-liquid-glass.git
cd flutter-uikit-liquid-glass/example
flutter run    # an iOS 26 simulator shows native glass; Android shows the Dart fallback

The demo reads its start state from --dart-define, so screenshots are repeatable:

Define Values
LANG en (default), ar
THEME light (default), dark
TAB 0 Gallery, 1 Playground, 2 Compare
TINT -1 none, 0 to 3
STYLE regular, clear
FORCE_DART true shows the fallback on iOS 26
AUTOPLAY true scrolls and switches tabs by itself, for screen recordings

Testing #

flutter analyze
flutter test

The widget tests cover the Dart side: the fallback, tab switching, Arabic (right to left), that the last item clears the bar, and that the native view is chosen on iOS 26. The Swift file builds as is with Xcode 26.5, and the native views were checked on the iOS 26.5 simulator; on an iOS 18.6 simulator the app launches with the Dart bar (screenshot). The native path is covered by an integration test, run on an iOS 26 simulator or device:

flutter test integration_test -d <device id>

Project layout #

lib/src/glass_support.dart   the one-time probe
lib/src/glass_surface.dart   GlassSurface: UIGlassEffect, or the Dart glass
lib/src/glass_tab_bar.dart   GlassTabBar: UITabBar, or a Dart bar
lib/src/dart_glass.dart      the Dart fallback
ios/uikit_liquid_glass/Sources/uikit_liquid_glass/LiquidGlass.swift   every native piece, in one file
example/                       the demo app (pages, colours, strings)
example/integration_test/      the native path, run on an iOS 26 simulator or device
PROMPT.md, PROMPT.ar.md        the ready-made prompt for AI agents (built by tool/build_prompt.py)
AGENTS.md                      notes for agents working on this repository

To use it without the package, copy lib/src/ and ios/uikit_liquid_glass/Sources/uikit_liquid_glass/LiquidGlass.swift, paste the Swift file into your Runner target (or the end of AppDelegate.swift), and add the LiquidGlass.register line to your AppDelegate.

License #

MIT. Use it, change it, ship it.

0
likes
160
points
--
downloads
screenshot

Documentation

Documentation
API reference

Publisher

verified publisherakkadx.com

Real iOS 26 Liquid Glass for Flutter: Apple's own UIGlassEffect and UITabBar as platform views, with a Dart fallback on Android, web and older iOS. RTL-ready.

Repository (GitHub)
View/report issues
Contributing

Topics

#liquid-glass #ios #uikit #rtl #widget

License

MIT (license)

Dependencies

flutter

More

Packages that depend on uikit_liquid_glass

Packages that implement uikit_liquid_glass