pulse_glow_button 1.0.1
pulse_glow_button: ^1.0.1 copied to clipboard
An eye-catching call-to-action button featuring animated radiant glow, expanding sonar ripples, and press physics.
import 'package:flutter/material.dart';
import 'package:pulse_glow_button/pulse_glow_button.dart';
void main() {
runApp(const PulseGlowExampleApp());
}
class PulseGlowExampleApp extends StatelessWidget {
const PulseGlowExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Pulse Glow Button Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: const Color(0xFF0B0F19),
colorScheme: const ColorScheme.dark(
primary: Color(0xFF6366F1),
),
),
home: const ButtonShowcaseScreen(),
);
}
}
class ButtonShowcaseScreen extends StatefulWidget {
const ButtonShowcaseScreen({super.key});
@override
State<ButtonShowcaseScreen> createState() => _ButtonShowcaseScreenState();
}
class _ButtonShowcaseScreenState extends State<ButtonShowcaseScreen> {
bool _isLoading = false;
void _triggerLoading() {
setState(() => _isLoading = true);
Future.delayed(const Duration(seconds: 2), () {
if (mounted) setState(() => _isLoading = false);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Pulse Glow Button'),
centerTitle: true,
backgroundColor: Colors.transparent,
),
body: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 32),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// 1. Violet Radiant CTA
PulseGlowButton(
text: 'Claim 5,000 Coins',
icon: const Icon(Icons.stars, color: Colors.amber, size: 20),
style: const PulseGlowStyle(
glowColor: Color(0xFF8B5CF6),
backgroundColor: Color(0xFF7C3AED),
),
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Coins claimed!')),
);
},
),
const SizedBox(height: 48),
// 2. Sunset Crimson Gradient
PulseGlowButton(
text: 'Go Live Now',
icon: const Icon(Icons.sensors, color: Colors.white, size: 20),
style: PulseGlowStyle(
glowColor: const Color(0xFFEF4444),
gradient: const LinearGradient(
colors: [Color(0xFFF43F5E), Color(0xFFEA580C)],
),
borderRadius: BorderRadius.circular(30),
padding: const EdgeInsets.symmetric(
horizontal: 32,
vertical: 16,
),
),
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Broadcasting started...')),
);
},
),
const SizedBox(height: 48),
// 3. Emerald Green with Loading Toggle
PulseGlowButton(
text: 'Authorize Transfer',
icon: const Icon(Icons.verified_user_outlined, size: 20),
isLoading: _isLoading,
style: const PulseGlowStyle(
glowColor: Color(0xFF10B981),
backgroundColor: Color(0xFF059669),
),
onTap: _triggerLoading,
),
const SizedBox(height: 48),
// 4. Circular Glowing Pulse Action Button
PulseGlowButton(
style: PulseGlowStyle(
glowColor: const Color(0xFF06B6D4),
backgroundColor: const Color(0xFF0891B2),
borderRadius: BorderRadius.circular(50),
padding: const EdgeInsets.all(22),
rippleMaxScale: 1.6,
),
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Voice microphone active')),
);
},
child: const Icon(Icons.mic, color: Colors.white, size: 28),
),
],
),
),
),
);
}
}