liquid_glass_effect 1.0.1
liquid_glass_effect: ^1.0.1 copied to clipboard
A flutter package to create a liquid glass effect ui.
Liquid Glass Effect - Flutter Package Documentation #
Table of Contents #
Overview #
Liquid Glass Effect is a Flutter package that implements iOS-inspired frosted glass effects with customizable themes and widgets. It provides a complete set of UI components with built-in liquid glass visual effects that work across all platforms.
Installation #
Add this to your package's pubspec.yaml
file:
dependencies:
liquid_glass_effect: ^1.0.1
Then run:
flutter pub get
Theme Setup #
Basic Setup #
import 'package:liquid_glass_ui/liquid_glass_ui.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Liquid Glass Demo',
theme: createLiquidGlassTheme(),
home: const MyHomePage(),
);
}
}
Custom Theme Configuration #
theme: createLiquidGlassTheme(
config: const LiquidGlassConfig(
blurAmount: 25.0,
highlightIntensity: 0.3,
noiseOpacity: 0.05,
primaryColor: Color(0xFF007AFF),
secondaryColor: Color(0xFF34C759),
),
),
Components #
LiquidGlassBackground #
The foundation component that creates the frosted glass effect.
Properties:
child
(Widget): Content to displaybackgroundImage
(ImageProvider): Optional background imageblurAmount
(double): Intensity of blur effectnoiseOpacity
(double): Opacity of noise texturehighlightIntensity
(double): Strength of liquid highlightshighlightColor
(Color): Color of highlightsnoiseColor
(Color): Color of noise texture
Example:
LiquidGlassBackground(
backgroundImage: AssetImage('assets/background.jpg'),
child: Center(child: Text('Hello World')),
)
LiquidGlassCard #
A card with frosted glass effect.
Properties:
child
(Widget): Card contentborderRadius
(double): Corner radiusbaseColor
(Color): Base tint colorblurAmount
(double): Blur intensitypadding
(EdgeInsets): Inner paddingonTap
(VoidCallback): Tap handlerborderColor
(Color): Border colorborderWidth
(double): Border thicknessanimationDuration
(Duration): Hover/press animation durationscaleFactor
(double): Hover scale amount
Example:
LiquidGlassCard(
borderRadius: 16,
onTap: () => print('Card tapped'),
child: ListTile(title: Text('Example Card')),
)
Liquid Glass Buttons #
Custom Flutter buttons with a frosted glass-style overlay and theme-based styling.
LiquidGlassElevatedButton #
A themed wrapper around ElevatedButton
with glass-effect overlays on hover and press.
Constructor Parameters #
Parameter | Type | Description |
---|---|---|
onPressed |
VoidCallback? |
Callback invoked when the button is pressed |
child |
Widget |
Content of the button, usually a Text widget |
style |
ButtonStyle? |
Optional button style override |
autofocus |
bool |
Whether to auto-focus the button (default: false ) |
clipBehavior |
Clip |
Clipping behavior (default: Clip.none ) |
Example #
LiquidGlassElevatedButton(
onPressed: () => print('Submit pressed'),
child: Text('Submit'),
)
LiquidGlassOutlinedButton #
A themed wrapper around OutlinedButton
with glass-effect overlays on hover and press.
Constructor Parameters #
Parameter | Type | Description |
---|---|---|
onPressed |
VoidCallback? |
Callback invoked when the button is pressed |
child |
Widget |
Content of the button, usually a Text widget |
style |
ButtonStyle? |
Optional button style override |
autofocus |
bool |
Whether to auto-focus the button (default: false ) |
clipBehavior |
Clip |
Clipping behavior (default: Clip.none ) |
Example #
LiquidGlassOutlinedButton(
onPressed: () => print('Submit pressed'),
child: Text('Submit'),
)
Customization #
Theme Extension #
final theme = Theme.of(context).extension<LiquidGlassThemeExtension>();
final blurAmount = theme?.blurAmount;
Custom Config #
const customConfig = LiquidGlassConfig(
blurAmount: 30.0,
highlightIntensity: 0.4,
primaryColor: Colors.purple,
);
Examples #
Weather App UI #
LiquidGlassScaffold(
backgroundImage: NetworkImage('https://example.com/sky.jpg'),
appBar: AppBar(title: Text('Weather')),
body: Column(
children: [
LiquidGlassCard(
child: WeatherInfo(),
),
LiquidGlassElevatedButton(
onPressed: fetchWeather,
child: Text('Refresh'),
),
],
),
)
Settings Page #
LiquidGlassScaffold(
appBar: AppBar(title: Text('Settings')),
body: ListView(
children: [
LiquidGlassCard(
child: SwitchListTile(
title: Text('Dark Mode'),
value: darkMode,
onChanged: (v) => setState(() => darkMode = v),
),
),
LiquidGlassOutlinedButton(
onPressed: logout,
child: Text('Sign Out'),
),
],
),
)
Contributing #
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
License #
This package is released under the MIT License. See LICENSE
for details.