snacky 0.0.2 copy "snacky: ^0.0.2" to clipboard
snacky: ^0.0.2 copied to clipboard

Easily display customizable snackbars in Flutter with minimal configuration. Ideal for quick notifications and alerts in your app.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:snacky/snacky.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return SnackyConfiguratorWidget(
      app: MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
          useMaterial3: true,
        ),
        home: const HomeScreen(),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Snacky Example'),
      ),
      body: ListView(
        padding: const EdgeInsets.all(16),
        children: [
          FilledButton(
            onPressed: () {
              const snacky = Snacky(
                title: 'Top',
              );
              SnackyController.instance.showMessage(snacky);
            },
            child: const Text('show snacky at the top of the screen'),
          ),
          FilledButton(
            onPressed: () {
              const snacky = Snacky(
                title: 'Bottom',
                location: SnackyLocation.bottom,
              );
              SnackyController.instance.showMessage(snacky);
            },
            child: const Text('show snacky at the bottom of the screen'),
          ),
          FilledButton(
            onPressed: () {
              const snacky = Snacky(
                title: 'Top (cancelable)',
                canBeClosed: true,
              );
              SnackyController.instance.showMessage(snacky);
            },
            child: const Text('show snacky that can be canceled'),
          ),
          FilledButton(
            onPressed: () {
              final snacky = Snacky(
                title: 'Top (tap to cancel)',
                onTap: () => SnackyController.instance.cancelAll(),
              );
              SnackyController.instance.showMessage(snacky);
            },
            child: const Text('show snacky that can be canceled by tap'),
          ),
          FilledButton(
            onPressed: () {
              const snacky = Snacky.openUntillClosed(
                title: 'Top (open untill closed/cancelled)',
                canBeClosed: true,
              );
              SnackyController.instance.showMessage(snacky);
            },
            child: const Text('show snacky that will stay open untill closed'),
          ),
          FilledButton(
            onPressed: () => SnackyController.instance.cancelAll(),
            child: const Text('cancel all snackies'),
          ),
          FilledButton(
            onPressed: () => SnackyController.instance.cancelActiveSnacky(),
            child: const Text('cancel active snacky'),
          ),
        ],
      ),
    );
  }
}
4
likes
0
pub points
55%
popularity

Publisher

verified publisherimpaktfull.com

Easily display customizable snackbars in Flutter with minimal configuration. Ideal for quick notifications and alerts in your app.

Repository (GitHub)
View/report issues

Topics

#snackbar #flutter-snackbar #custom-flutter-snackbar #flutter-flushbar #custom-flutter-toast

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on snacky