glassmorphic_ui_kit 1.0.2
glassmorphic_ui_kit: ^1.0.2 copied to clipboard
A Flutter package for implementing modern glassmorphic UI trends with smooth blur effects, frosted glass appearance, and gradient overlays.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:glassmorphic_ui_kit/glassmorphic_ui_kit.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Glassmorphic UI Kit Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
void _showGlassDialog(BuildContext context) {
showDialog(
context: context,
builder: (context) => GlassDialog(
title: const Text('Glass Dialog', style: TextStyle(color: Colors.white)),
content: const Text(
'This is a glassmorphic dialog!',
style: TextStyle(color: Colors.white),
),
actions: [
GlassButton(
onPressed: () => Navigator.pop(context),
child: const Text('Close', style: TextStyle(color: Colors.white)),
),
],
),
);
}
void _showGlassBottomSheet(BuildContext context) {
GlassBottomSheet.show(
context: context,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
'Glass Bottom Sheet',
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 16),
GlassButton(
onPressed: () => Navigator.pop(context),
child: const Text('Close', style: TextStyle(color: Colors.white)),
),
],
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Colors.blue, Colors.purple],
),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GlassCard(
width: 300,
height: 200,
blur: 20,
borderRadius: BorderRadius.circular(15),
gradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.2),
Colors.white.withOpacity(0.1),
],
),
child: const Center(
child: Text(
"Glassmorphic Card",
style: TextStyle(color: Colors.white),
),
),
),
const SizedBox(height: 20),
GlassButton(
onPressed: () => _showGlassDialog(context),
child: const Text(
"Show Glass Dialog",
style: TextStyle(color: Colors.white),
),
),
const SizedBox(height: 20),
GlassButton(
onPressed: () => _showGlassBottomSheet(context),
child: const Text(
"Show Bottom Sheet",
style: TextStyle(color: Colors.white),
),
),
],
),
),
),
);
}
}