awesome_glass_ui 0.0.1
awesome_glass_ui: ^0.0.1 copied to clipboard
A beautiful and customizable Flutter package for creating glassmorphism (frosted glass) UI effects with ease.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:awesome_glass_ui/awesome_glass_ui.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Awesome Glass UI Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const GlassDemoPage(),
);
}
}
class GlassDemoPage extends StatelessWidget {
const GlassDemoPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF667eea),
Color(0xFF764ba2),
Color(0xFFf093fb),
],
),
),
child: SafeArea(
child: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Awesome Glass UI',
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
const SizedBox(height: 40),
// Default Glass Container
GlassContainer(
width: double.infinity,
child: Column(
children: [
const Text(
'Default Glass Container',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
const SizedBox(height: 10),
const Text(
'This is a default glass container with standard settings.',
style: TextStyle(color: Colors.white70),
textAlign: TextAlign.center,
),
],
),
),
const SizedBox(height: 20),
// Custom Blur Glass Container
GlassContainer(
width: double.infinity,
blur: 20.0,
opacity: 0.2,
borderRadius: 25.0,
child: Column(
children: [
const Text(
'High Blur Glass',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
const SizedBox(height: 10),
const Text(
'This container has increased blur and opacity.',
style: TextStyle(color: Colors.white70),
textAlign: TextAlign.center,
),
],
),
),
const SizedBox(height: 20),
// Minimal Glass Container
GlassContainer(
width: double.infinity,
blur: 5.0,
opacity: 0.05,
borderRadius: 10.0,
borderWidth: 1.0,
child: Column(
children: [
const Text(
'Minimal Glass',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
const SizedBox(height: 10),
const Text(
'A subtle glass effect with minimal blur.',
style: TextStyle(color: Colors.white70),
textAlign: TextAlign.center,
),
],
),
),
const SizedBox(height: 20),
// Glass Container with Gradient
GlassContainer(
width: double.infinity,
blur: 15.0,
borderRadius: 20.0,
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.2),
Colors.white.withOpacity(0.1),
],
),
child: Column(
children: [
const Text(
'Gradient Glass',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
const SizedBox(height: 10),
const Text(
'This container uses a gradient background.',
style: TextStyle(color: Colors.white70),
textAlign: TextAlign.center,
),
],
),
),
const SizedBox(height: 40),
// Button Row
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GlassContainer(
borderRadius: 30.0,
padding: const EdgeInsets.symmetric(
horizontal: 30,
vertical: 15,
),
child: const Text(
'Button 1',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
),
),
),
GlassContainer(
borderRadius: 30.0,
padding: const EdgeInsets.symmetric(
horizontal: 30,
vertical: 15,
),
child: const Text(
'Button 2',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
),
),
),
],
),
],
),
),
),
),
),
);
}
}