hyper_snackbar 0.4.0 copy "hyper_snackbar: ^0.4.0" to clipboard
hyper_snackbar: ^0.4.0 copied to clipboard

A highly customizable and animated snackbar package for Flutter.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:hyper_snackbar/hyper_snackbar.dart';
import 'pages/basic_page.dart';
import 'pages/scenario_page.dart';
import 'pages/playground_page.dart';

void main() {
  runApp(const HyperExampleApp());
}

class HyperExampleApp extends StatelessWidget {
  const HyperExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // Required NavigatorKey to use HyperSnackbar
      navigatorKey: HyperSnackbar.navigatorKey,
      title: 'HyperSnackbar Example',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF6C63FF)),
        appBarTheme: const AppBarTheme(
          centerTitle: true,
          backgroundColor: Color(0xFF1E1E2E),
          foregroundColor: Colors.white,
          elevation: 0,
        ),
        scaffoldBackgroundColor: const Color(0xFFF5F5F7),
      ),
      home: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('HyperSnackbar')),
      body: ListView(
        padding: const EdgeInsets.all(24),
        children: [
          const SizedBox(height: 20),
          const Text(
            'Select a Demo',
            style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
            textAlign: TextAlign.center,
          ),
          const SizedBox(height: 40),
          _MenuCard(
            title: '🔰 Basic Usage',
            subtitle: 'Simple examples for quick start.',
            icon: Icons.start,
            color: Colors.green,
            onTap: () => Navigator.push(
                context, MaterialPageRoute(builder: (_) => const BasicPage())),
          ),
          _MenuCard(
            title: '🎬 Scenarios',
            subtitle: 'Recommended settings for real-world use cases.',
            icon: Icons.movie_filter,
            color: Colors.orange,
            onTap: () => Navigator.push(context,
                MaterialPageRoute(builder: (_) => const ScenarioPage())),
          ),
          _MenuCard(
            title: '🎛 Playground',
            subtitle: 'Interactive demo with code generation.',
            icon: Icons.tune,
            color: Colors.blue,
            onTap: () => Navigator.push(context,
                MaterialPageRoute(builder: (_) => const PlaygroundPage())),
          ),
        ],
      ),
    );
  }
}

class _MenuCard extends StatelessWidget {
  final String title;
  final String subtitle;
  final IconData icon;
  final Color color;
  final VoidCallback onTap;

  const _MenuCard({
    required this.title,
    required this.subtitle,
    required this.icon,
    required this.color,
    required this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return Card(
      elevation: 2,
      margin: const EdgeInsets.only(bottom: 16),
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
      child: InkWell(
        onTap: onTap,
        borderRadius: BorderRadius.circular(16),
        child: Padding(
          padding: const EdgeInsets.all(20),
          child: Row(
            children: [
              Container(
                width: 56,
                height: 56,
                decoration: BoxDecoration(
                  color: color.withValues(alpha: 0.1),
                  shape: BoxShape.circle,
                ),
                child: Icon(icon, color: color, size: 28),
              ),
              const SizedBox(width: 20),
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(title,
                        style: const TextStyle(
                            fontSize: 18, fontWeight: FontWeight.bold)),
                    const SizedBox(height: 4),
                    Text(subtitle,
                        style:
                            TextStyle(color: Colors.grey[600], fontSize: 13)),
                  ],
                ),
              ),
              const Icon(Icons.arrow_forward_ios, size: 16, color: Colors.grey),
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
0
points
622
downloads

Publisher

unverified uploader

Weekly Downloads

A highly customizable and animated snackbar package for Flutter.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on hyper_snackbar