A lightweight and easy-to-use alert dialog package for Flutter.
KAlertFlutter provides simple helper methods to display alert dialogs and confirm dialogs using a clean API. It is designed to reduce boilerplate code when working with Flutter dialogs.
- Simple alert dialog
- Confirm dialog with boolean result
- Clean and minimal API
- Lightweight and dependency-free
- Uses native Flutter Material dialogs
Add the package to your project:
dependencies:
kalertflutter: ^1.0.0Then run:
flutter pub getImport the package:
import 'package:kalertflutter/kalertflutter.dart';Display a simple alert dialog:
KAlert.show(
context,
"Saved successfully!",
);With custom title:
KAlert.show(
context,
"Profile updated successfully!",
title: "Success",
);Display a confirmation dialog and receive user response:
bool? result = await KAlert.confirm(
context,
"Delete this file?",
);Example with result handling:
bool? result = await KAlert.confirm(
context,
"Delete this file?",
);
if (result == true) {
print("User confirmed");
} else {
print("User cancelled");
}ElevatedButton(
onPressed: () {
KAlert.show(context, "Hello from KAlertFlutter!");
},
child: const Text("Show Alert"),
);GitHub:
https://github.com/TutorialsAndroid/KAlertFlutter
Issues and feature requests are welcome.
MIT License
Free for personal and commercial use.