butterfly_dialog 0.0.5 copy "butterfly_dialog: ^0.0.5" to clipboard
butterfly_dialog: ^0.0.5 copied to clipboard

ButterflyAlertDialog allows you to quickly display alert dialogs such as success, error, warning, and delete.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Butterfly Alert Dialog',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HomePage(),
    );
  }
}

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

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Alert Dialogs'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Center(
              child: ElevatedButton(
                onPressed: () {
                  ButterflyAlertDialog.show(
                    context: context,
                    title: 'Warning',
                    subtitle: 'This is the subtitle of the alert.',
                    alertType: AlertType.warning,
                    onConfirm: () {
                      // Your confirm action here
                    },
                  );
                },
                child: const Text('Show alert dialog - WARNING'),
              ),
            ),
            Center(
              child: ElevatedButton(
                onPressed: () {
                  ButterflyAlertDialog.show(
                    context: context,
                    title: 'Delete',
                    subtitle: 'This is the subtitle of the alert.',
                    alertType: AlertType.delete,
                    onConfirm: () {
                      // Your confirm action here
                    },
                  );
                },
                child: const Text('Show alert dialog- DELETE'),
              ),
            ),
            Center(
              child: ElevatedButton(
                onPressed: () {
                  ButterflyAlertDialog.show(
                    context: context,
                    title: 'Success',
                    subtitle: 'This is the subtitle of the alert.',
                    alertType: AlertType.success,
                    onConfirm: () {
                      // Your confirm action here
                    },
                  );
                },
                child: const Text('Show alert dialog- SUCCESS'),
              ),
            ),
            Center(
              child: ElevatedButton(
                onPressed: () {
                  ButterflyAlertDialog.show(
                    context: context,
                    title: 'ERROR',
                    subtitle: 'This is the subtitle of the alert.',
                    alertType: AlertType.error,
                    onConfirm: () {
                      // Your confirm action here
                    },
                  );
                },
                child: const Text('Show alert dialog- ERROR'),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
8
likes
150
points
22
downloads

Publisher

unverified uploader

Weekly Downloads

ButterflyAlertDialog allows you to quickly display alert dialogs such as success, error, warning, and delete.

Repository (GitLab)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on butterfly_dialog