flutter_quickalert 1.0.1 copy "flutter_quickalert: ^1.0.1" to clipboard
flutter_quickalert: ^1.0.1 copied to clipboard

A lightweight and customizable alert dialog package for Flutter. Easily display success, error, warning, and info dialogs with various styles and themes

Flutter Quick Alert #

A lightweight and customizable alert dialog package for Flutter. Easily display success, error, warning, and info dialogs with various styles and themes.

Features #

  • Supports different alert types: Success, Error, Warning, Info
  • Customizable UI with QuickAlertTheme
  • Multiple dialog styles: Normal, Confirm, Loading
  • Options for close and cancel buttons
  • Configurable dismiss behavior
  • Built-in support for multiple languages
  • Easy-to-use extensions for BuildContext

Installation #

Add the package to your pubspec.yaml:

dependencies:
  flutter_quickalert: latest_version

Then, run:

flutter pub get

Usage #

Basic Alert Dialog #

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

void showAlert(BuildContext context) {
  QuickAlert.show(
    context: context,
    message: 'Operation Successful!',
    type: QuickAlertTypes.success,
  );
}

Custom Dialog with Options #

QuickAlert.show(
  context: context,
  message: 'Are you sure you want to proceed?',
  type: QuickAlertTypes.warning,
  dialogType: QuickAlertDialogTypes.confirm,
  showCancelButton: true,
  barrierDismissible: false,
);

Theming with QuickAlertTheme #

Customize the alert appearance by applying QuickAlertTheme to your app's theme:

ThemeData(
  // your custom theme data
    extensions: <ThemeExtension<dynamic>>{
      QuickAlertTheme(
        // background,
        // onBackground,
        success: const Color(0xFF569F49),
        onSuccess: Colors.white,
        error: const Color(0xFFAA4444),
        onError: Colors.white,
        warning: const Color(0xFFE69A00),
        onWarning: Colors.white,
        info: const Color(0xFF258EA6),
        onInfo: Colors.white,
        radius: 8,
        headerHeight: 100,
      ),
    },
);

Using Extensions for Quick Alerts #

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

void showAlerts(BuildContext context) {
  context.showAlert(
    message: 'This is an info alert!',
    type: QuickAlertTypes.info,
  );

  context.showLoadingAlert(
    message: 'Loading...',
    type: QuickAlertTypes.loading,
    onCanceled: (context) {
      print('Loading canceled');
    },
  );

  context.showConfirmAlert(
    message: 'Do you confirm this action?',
    type: QuickAlertTypes.confirm,
  );
}

Available Dialog Types #

enum QuickAlertTypes {
  success,
  error,
  warning,
  info,
}
enum QuickAlertDialogTypes {
  normal,
  confirm,
  loading,
}

Screenshots #

Contributions #

Contributions are welcome! Feel free to open issues and submit pull requests.

License #

This package is available under the MIT License.

0
likes
160
points
68
downloads

Publisher

verified publisherthesmartcloud.tech

Weekly Downloads

A lightweight and customizable alert dialog package for Flutter. Easily display success, error, warning, and info dialogs with various styles and themes

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_localizations

More

Packages that depend on flutter_quickalert