liquid_glass_ui_design 1.0.5
liquid_glass_ui_design: ^1.0.5 copied to clipboard
A Flutter package for iOS 26-style liquid glass UI components.
import 'package:flutter/material.dart';
import 'package:liquid_glass_ui_design/liquid_glass_ui.dart';
import 'dart:ui';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Apple Liquid Glass Effect',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: const MusicPlayerGlass(),
debugShowCheckedModeBanner: false,
);
}
}
class MusicPlayerGlass extends StatelessWidget {
const MusicPlayerGlass({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
Container(
decoration: const BoxDecoration(
gradient: RadialGradient(
center: Alignment(-0.3, -0.5),
radius: 1.5,
colors: [
Color(0xFF4A90E2),
Color(0xFF357ABD),
Color(0xFF1E3A8A),
Color(0xFF0F172A),
],
stops: [0.0, 0.3, 0.7, 1.0],
),
),
),
Positioned(
top: 100,
left: 50,
child: Container(
width: 200,
height: 200,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
Colors.yellow.withOpacity(0.3),
Colors.orange.withOpacity(0.1),
Colors.transparent,
],
),
),
),
),
Positioned(
top: 300,
right: 30,
child: Container(
width: 150,
height: 150,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
Colors.purple.withOpacity(0.2),
Colors.pink.withOpacity(0.1),
Colors.transparent,
],
),
),
),
),
Positioned.fill(
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.05),
Colors.transparent,
Colors.black.withOpacity(0.1),
],
),
),
),
),
// Main content
SafeArea(
child: Column(
children: [
const Spacer(),
LiquidGlassEffect(
borderRadius: 28,
blurStrength: 40,
surfaceOpacity: 0.12,
reflectionIntensity: 0.5,
margin: const EdgeInsets.symmetric(horizontal: 20),
padding: const EdgeInsets.all(24),
child: Row(
children: [
Container(
width: 65,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFFFF6B6B), Color(0xFFFF8E53)],
),
),
child: const Center(
child: Icon(
Icons.music_note,
color: Colors.white,
size: 30,
),
),
),
),
),
const SizedBox(width: 20),
// Song info
const Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'All Of Me',
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.w600,
letterSpacing: 0.5,
),
),
SizedBox(height: 6),
Text(
'Nao',
style: TextStyle(
color: Colors.white70,
fontSize: 17,
fontWeight: FontWeight.w400,
),
),
],
),
),
Row(
children: [
Container(
width: 48,
height: 48,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black.withOpacity(0.1),
),
child: const Icon(
Icons.play_arrow,
color: Colors.white,
size: 28,
),
),
const SizedBox(width: 16),
Container(
width: 42,
height: 42,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black.withOpacity(0.08),
),
child: const Icon(
Icons.skip_next,
color: Colors.white,
size: 24,
),
),
],
),
],
),
),
const SizedBox(height: 24),
LiquidGlassEffect(
borderRadius: 32,
blurStrength: 35,
surfaceOpacity: 0.1,
reflectionIntensity: 0.45,
margin: const EdgeInsets.symmetric(horizontal: 20),
padding: const EdgeInsets.symmetric(
vertical: 20,
horizontal: 28,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_buildNavItem(Icons.home, 'Home', true),
_buildNavItem(Icons.apps, 'New', false),
_buildNavItem(Icons.radio, 'Radio', false),
_buildNavItem(Icons.library_music, 'Library', false),
_buildNavItem(Icons.search, '', false),
],
),
),
const SizedBox(height: 34),
],
),
),
],
),
);
}
Widget _buildNavItem(IconData icon, String label, bool isActive) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color:
isActive
? Colors.blueAccent.withOpacity(0.2)
: Colors.transparent,
),
child: Icon(
icon,
color: isActive ? Colors.blueAccent : Colors.white.withOpacity(0.8),
size: 26,
),
),
if (label.isNotEmpty) ...[
const SizedBox(height: 6),
Text(
label,
style: TextStyle(
color:
isActive ? Colors.blueAccent : Colors.white.withOpacity(0.7),
fontSize: 13,
fontWeight: isActive ? FontWeight.w600 : FontWeight.w400,
letterSpacing: 0.2,
),
),
],
],
);
}
}