liquid_notch

pub package license: MIT

liquid_notch demo

Show a liquid snackbar with one function call. It stretches from the camera area, separates into a notification pill, then reconnects and absorbs back into the source.

import 'package:liquid_notch/liquid_notch.dart';

showLiquidSnackbar(
  context,
  'New Follower!',
  const CircleAvatar(child: Text('S')),
  const Icon(Icons.person_add),
  'Sasuke followed you',
);

That is the complete integration. Use a context inside a MaterialApp or another navigator. No host, Stack, positioning, controller, setup widget, or camera calculations are needed. Prefix and suffix are ordinary widgets; pass null to omit either. Subtitle can also be null.

Optional named arguments:

showLiquidSnackbar(
  context, title, prefix, suffix, subtitle,
  duration: const Duration(seconds: 2), // Fully expanded display time.
  accentColor: Colors.blue,
  backgroundColor: Colors.white,
  onTap: () { /* Open the relevant screen. */ },
);

The returned Future<void> completes when the snackbar is removed. You can ignore it or await it. Tapping the pill dismisses it. The package owns entrance, display timing, return animation, overlay removal, and timer cleanup. Calls made while a snackbar is visible absorb it before showing the newest request. Intermediate pending requests are replaced and their futures complete. No notifications overlap.

The root overlay receives the snackbar, so it appears above the screen and does not consume taps outside the pill. It can remain visible across navigation until its display timer finishes. Disposing the overlay also releases active and pending requests. Captured themes, reduced motion, nullable content, and large text are supported.

Placement comes from the root view's dimensions and safe area, including when the supplied context is below a SafeArea. Portrait notch and island defaults are selected internally. Devices without a top-center cutout and landscape layouts use a small visual source below the top inset. Flutter's safe area does not describe the precise physical camera outline; these defaults still need physical-device validation.

LiquidNotch remains available as a low-level widget for advanced custom layouts. Normal usage should use showLiquidSnackbar.

Installation

flutter pub add liquid_notch

No runtime dependencies beyond Flutter.

Run the preview

cd example
flutter pub get
flutter run

The example includes iOS, Android, and web runners and depends only on this package through path: ../. Tap the three buttons to trigger live notifications. For a browser preview, use flutter run -d chrome.

Development

flutter pub get
flutter analyze
flutter test
cd example
flutter test
flutter build ios --simulator

The root contains the reusable library and tests. example/ is the runnable preview.

License

MIT — see LICENSE.

Libraries

liquid_notch