Multiple dialog types
Create normal, success, error, warning, info, question, progress, input, custom image, URL image, and custom view dialogs.
KAlertFlutter is a modern, customizable, Material-style alert dialog library for Flutter. Build success, error, warning, info, question, progress, input, custom image, URL image, and custom view dialogs with clean APIs.
dependencies:
kalertflutter: ^2.0.0
KAlertFlutter includes modern presets, dark mode support, input validation, custom widgets, progress dialogs, image dialogs, button styling, callbacks, and backward compatibility with the old API.
Create normal, success, error, warning, info, question, progress, input, custom image, URL image, and custom view dialogs.
KAlertFlutter automatically respects your Flutter app theme and adapts to light or dark mode.
Control title, content, icons, colors, radius, elevation, dim amount, button styling, and text weights.
Build input dialogs with initial value, max length, keyboard type, validation, and confirm callbacks.
Place any Flutter widget inside a dialog using KAlertDialog.customView().
Show custom images, URL images, circle images, big images, placeholders, and error widgets.
Show loading and processing states with non-dismissible progress dialogs.
Use onShow, onDismiss, onConfirm, onCancel, and input confirm callbacks.
Old KAlert.show(), KAlert.confirm(), and KAlert.prompt() APIs still work with the new UI.
A major feature upgrade that brings KAlertFlutter closer to the native Android KAlertDialog library.
Add your screenshots inside art/new/ with these file names.












Add KAlertFlutter to your Flutter project and start creating beautiful dialogs.
dependencies:
kalertflutter: ^2.0.0
import 'package:kalertflutter/kalertflutter.dart';
After adding the dependency, run this command:
flutter pub get
Copy-paste ready examples for common KAlertFlutter use cases.
Use this after saving data, completing a task, or confirming a successful action.
KAlertDialog.success(
context: context,
title: 'Success',
content: 'Your changes were saved successfully.',
confirmText: 'Done',
);
Use this for API failures, network issues, validation errors, or unexpected problems.
KAlertDialog.error(
context: context,
title: 'Oops...',
content: 'Something went wrong. Please try again.',
confirmText: 'Try Again',
);
Ask users before destructive actions and handle confirm or cancel results.
final result = await KAlertDialog.warning(
context: context,
title: 'Delete this file?',
content: 'This action cannot be undone.',
confirmText: 'Delete',
cancelText: 'Cancel',
);
if (result?.confirmed == true) {
KAlertDialog.success(
context: context,
title: 'Deleted',
content: 'The file has been deleted successfully.',
);
}
Use this when you need a yes/no response.
final result = await KAlertDialog.question(
context: context,
title: 'Continue?',
content: 'Do you want to continue with this action?',
confirmText: 'Yes',
cancelText: 'No',
);
if (result?.confirmed == true) {
debugPrint('User selected yes');
}
Show loading or processing states with non-dismissible progress dialogs.
KAlertDialog.progress(
context: context,
title: 'Processing',
content: 'Please wait while we prepare your request.',
barrierDismissible: false,
);
await Future.delayed(const Duration(seconds: 3));
if (context.mounted) {
Navigator.of(context).pop();
KAlertDialog.success(
context: context,
title: 'Completed',
content: 'Your request has been completed successfully.',
);
}
Validate input before allowing the user to continue.
final result = await KAlertDialog.input(
context: context,
title: 'Create Project',
content: 'Enter a project name with at least 3 characters.',
hintText: 'Project name',
initialValue: 'KAlertFlutter',
maxLength: 30,
validator: (input) {
if (input.trim().length < 3) {
return 'Project name must be at least 3 characters';
}
return null;
},
);
if (result?.confirmed == true) {
debugPrint('Input value: ${result?.value}');
}
Place any Flutter widget inside the dialog.
final controller = TextEditingController();
KAlertDialog.customView(
context: context,
title: 'Custom View',
content: 'This dialog uses your own custom Flutter widget.',
showCancelButton: true,
confirmText: 'Save',
cancelText: 'Cancel',
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextField(
controller: controller,
decoration: const InputDecoration(
labelText: 'Project name',
border: OutlineInputBorder(),
),
),
],
),
onConfirm: () {
debugPrint('Saved: ${controller.text}');
},
);
Show big or circle URL images with fallback support.
KAlertDialog.urlImage(
context: context,
title: 'Big URL Image',
content: 'This image is loaded from a URL.',
imageUrl: 'https://example.com/image.png',
imageType: KAlertImageType.big,
confirmText: 'Close',
);
Customize dialog radius, elevation, dim amount, colors, and text weights.
KAlertDialog.show(
context: context,
title: 'Custom Appearance',
content: 'This dialog has custom radius, elevation and dim amount.',
type: KAlertType.normal,
style: KAlertStyle.modern,
cornerRadius: 30,
elevation: 20,
dimAmount: 0.60,
titleFontWeight: FontWeight.w900,
contentFontWeight: FontWeight.w500,
confirmText: 'Looks Good',
);
Use callbacks for dialog lifecycle and button events.
KAlertDialog.show(
context: context,
title: 'Callbacks',
content: 'This dialog shows callback APIs.',
type: KAlertType.normal,
showCancelButton: true,
confirmText: 'Confirm',
cancelText: 'Cancel',
onShow: () {
debugPrint('Dialog shown');
},
onDismiss: () {
debugPrint('Dialog dismissed');
},
onConfirm: () {
debugPrint('Confirmed');
},
onCancel: () {
debugPrint('Cancelled');
},
);
Old APIs are still supported and now use the new modern UI internally.
KAlert.show(
context,
title: 'Success',
message: 'Saved successfully!',
type: KAlertType.success,
);
bool? result = await KAlert.confirm(
context,
title: 'Delete file?',
message: 'This action cannot be undone',
);
String? value = await KAlert.prompt(
context,
title: 'Enter your name',
);
Use the original native Android Java library, KAlertDialog. It provides the same modern dialog experience for Android Java apps with success, error, warning, progress, input, URL image, custom image, and custom view dialogs.
| Library | Platform | Package |
|---|---|---|
| KAlertFlutter | Flutter / Dart | pub.dev |
| KAlertDialog | Native Android Java | Maven Central |
| Use case | Modern dialogs | Open source |
implementation 'io.github.tutorialsandroid:kalertdialog:21.0.0'
implementation 'io.github.tutorialsandroid:progressx:7.0.5'
The most-used KAlertFlutter types and methods.
KAlertType.normal
KAlertType.success
KAlertType.error
KAlertType.warning
KAlertType.info
KAlertType.question
KAlertType.progress
KAlertType.input
KAlertType.customImage
KAlertType.urlImage
KAlertType.customView
KAlertStyle.classic
KAlertStyle.modern
KAlertStyle.minimal
KAlertStyle.rounded
KAlertImageType.big
KAlertImageType.circle
KAlertDialog.show()
KAlertDialog.success()
KAlertDialog.error()
KAlertDialog.warning()
KAlertDialog.info()
KAlertDialog.question()
KAlertDialog.progress()
KAlertDialog.input()
KAlertDialog.customView()
KAlertDialog.customImage()
KAlertDialog.urlImage()
cornerRadius: 30
elevation: 20
dimAmount: 0.60
maxWidth: 360
backgroundColor: Colors.white
titleColor: Colors.black
contentColor: Colors.grey
iconColor: Colors.green
confirmText: 'OK'
cancelText: 'Cancel'
showConfirmButton: true
showCancelButton: true
confirmButtonColor: Colors.green
cancelButtonColor: Colors.grey
confirmButtonAllCaps: false
cancelButtonAllCaps: false
hintText: 'Project name'
initialValue: 'KAlertFlutter'
maxLength: 30
keyboardType: TextInputType.text
validator: (input) { return null; }
onInputConfirm: (input) { }
KAlert.show()
KAlert.confirm()
KAlert.prompt()
Quick answers for setup and common usage.
KAlertFlutter is a modern Material-style alert dialog package for Flutter. It supports success, error, warning, info, question, progress, input, custom image, URL image, and custom view dialogs.
Add kalertflutter to your pubspec.yaml file and run flutter pub get.
Yes. KAlertFlutter automatically respects your Flutter app theme and adapts to light or dark mode.
Yes. Use KAlertDialog.customView() and pass any Flutter widget as the child.
Yes. KAlertDialog.input() supports validator callbacks, max length, initial value, keyboard type, and input confirm callbacks.
Yes. The native Android Java version is KAlertDialog, available on GitHub and Maven Central.
Install the latest version, explore the example app, and support the project on GitHub and pub.dev.