liquid_glass_flutter 0.0.1+1
liquid_glass_flutter: ^0.0.1+1 copied to clipboard
A Flutter package for applying a dynamic liquid glass distortion effect to any widget using custom GLSL shaders. Inspired by glass stretch, and refraction effects, this package lets you overlay realis [...]
๐ง liquid_glass_flutter #
liquid_glass_flutter is a Flutter package that brings beautiful, animated liquid glass distortion effects to any widget using a custom GLSL fragment shader. Perfect for glassmorphism, water ripple overlays, and creative UI filters. iOS 26 #liquidglass #ios26
๐ฎ Preview #
[Preview Animation]
๐ผ๏ธ Screenshots #
| Screenshot 1 | Screenshot 2 |
|---|---|
| [Screenshot 1] | [Screenshot 2] |
โจ Features #
- ๐ Realistic animated liquid distortion
- ๐งฉ Works with any widget using child composition
- ๐ฏ Precise shader masking based on widget position and size
- ๐ Customizable blur and border radius
- ๐ฅ Smooth real-time animation using Flutter's Ticker
๐งฑ Installation #
Add this to your pubspec.yaml:
dependencies:
liquid_glass_flutter: ^0.1.0
Then run:
flutter pub get
๐งช Example #
import 'package:flutter/material.dart';
import 'package:liquid_glass_flutter/liquid_glass_flutter.dart';
class DemoPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blueGrey[900],
body: Center(
child: LiquidGlass(
borderRadius: 24,
blur: 8,
child: Container(
width: 300,
height: 200,
color: Colors.white.withOpacity(0.1),
alignment: Alignment.center,
child: Text(
'Liquid Glass',
style: TextStyle(fontSize: 24, color: Colors.white),
),
),
),
),
);
}
}
๐ง How It Works #
The LiquidGlass widget:
- Loads a GLSL shader (
liquid_glass.frag) from assets - Tracks the widgetโs position and size on screen
- Passes uniforms like
uResolution,uTime,uCenter,uBlur, anduBorderRadiusto the shader - Applies the result using
ImageFilter.shader()viaBackdropFilter
๐ Asset Setup #
Ensure your pubspec.yaml includes the shader asset:
flutter:
assets:
- assets/shaders/liquid_glass.frag
If you're using this from a package, prefix with the package name when loading:
FragmentProgram.fromAsset(
'packages/liquid_glass_flutter/assets/shaders/liquid_glass.frag'
);
๐ API #
LiquidGlass({
required Widget child,
double borderRadius = 16,
double blur = 0.0,
})
| Property | Type | Description |
|---|---|---|
child |
Widget | The widget to apply the glass effect to |
borderRadius |
double | Corner radius for the clipping mask |
blur |
double | Placeholder for custom blur (not yet wired) |
๐ฏ To Do #
- โ Enable interactive ripples with gesture input
- โ Expose shader uniforms like noise strength, stretch, etc.
- โ Add support for different shapes (circles, paths)
- โ Bundle prebuilt shader variations
๐งฉ License #
MIT License ยฉ 2025
Developed with ๐ for creative UI builders.
๐ Contributions Welcome #
Have an idea or improvement? Feel free to open an issue or PR!