Skip to content

Commit 230a661

Browse files
Major feature upgrade release
1 parent e2800c0 commit 230a661

5 files changed

Lines changed: 406 additions & 118 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
## 1.0.0
1+
## 1.2.0
22

3-
Initial release
3+
Major feature upgrade release
44

5-
Features:
5+
New features:
66

7-
- Alert dialog
8-
- Confirm dialog
9-
- Simple API
10-
- Lightweight package
7+
- success dialog type
8+
- error dialog type
9+
- warning dialog type
10+
- info dialog type
11+
- confirm dialog support
12+
- prompt dialog support
13+
- icon support
14+
- modern rounded UI dialog design
15+
- improved API structure

README.md

Lines changed: 86 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,67 @@
1+
![pub.dev](https://img.shields.io/pub/v/kalertflutter)
2+
![license](https://img.shields.io/badge/license-MIT-green)
3+
![flutter](https://img.shields.io/badge/platform-Flutter-blue)
4+
15
# KAlertFlutter
26

3-
A lightweight and easy-to-use alert dialog package for Flutter.
7+
A lightweight, modern alert dialog package for Flutter.
8+
9+
KAlertFlutter provides **success, error, warning, info, confirm, and prompt dialogs** using a clean and simple API. It helps reduce boilerplate code when working with dialogs in Flutter apps.
10+
11+
🔗 pub.dev package:
12+
https://pub.dev/packages/kalertflutter
413

5-
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.
14+
---
15+
16+
---
17+
18+
# ❤️ Support the Project
19+
20+
If you find **KAlertFlutter** useful, please consider supporting the project:
21+
22+
⭐ Star this repository
23+
🐛 Report issues
24+
💡 Suggest new features
25+
26+
And don’t forget to follow me on Instagram for more developer content:
27+
28+
📸 https://instagram.com/coderx09
29+
30+
Thanks for your support! 🚀
631

732
---
833

934
## ✨ Features
1035

11-
* Simple alert dialog
12-
* Confirm dialog with boolean result
13-
* Clean and minimal API
14-
* Lightweight and dependency-free
15-
* Uses native Flutter Material dialogs
36+
✅ Success dialog
37+
38+
✅ Error dialog
39+
40+
✅ Warning dialog
41+
42+
✅ Info dialog
43+
44+
✅ Confirm dialog with boolean response
45+
46+
✅ Prompt dialog with input field
47+
48+
✅ Clean enum-based API
49+
50+
✅ Rounded modern UI dialogs
51+
52+
✅ Lightweight and dependency-free
53+
54+
✅ Uses native Flutter Material dialogs
1655

1756
---
1857

1958
## 📦 Installation
2059

21-
Add the package to your project:
60+
Add the package:
2261

2362
```yaml
2463
dependencies:
25-
kalertflutter: ^1.0.0
64+
kalertflutter: ^1.2.0
2665
```
2766
2867
Then run:
@@ -45,51 +84,62 @@ import 'package:kalertflutter/kalertflutter.dart';
4584

4685
## 📘 Show Alert Dialog
4786

48-
Display a simple alert dialog:
49-
5087
```dart
5188
KAlert.show(
5289
context,
53-
"Saved successfully!",
90+
title: "Success",
91+
message: "Saved successfully!",
92+
type: KAlertType.success,
5493
);
5594
```
5695

57-
With custom title:
96+
Supported dialog types:
97+
98+
```
99+
success
100+
error
101+
warning
102+
info
103+
```
104+
105+
Example:
58106

59107
```dart
60108
KAlert.show(
61109
context,
62-
"Profile updated successfully!",
63-
title: "Success",
110+
title: "Error",
111+
message: "Something went wrong!",
112+
type: KAlertType.error,
64113
);
65114
```
66115

67116
---
68117

69-
## 📘 Show Confirm Dialog
70-
71-
Display a confirmation dialog and receive user response:
118+
## 📘 Confirm Dialog
72119

73120
```dart
74121
bool? result = await KAlert.confirm(
75122
context,
76-
"Delete this file?",
123+
title: "Delete file?",
124+
message: "This action cannot be undone",
77125
);
126+
127+
if (result == true) {
128+
print("User confirmed");
129+
}
78130
```
79131

80-
Example with result handling:
132+
---
133+
134+
## 📘 Prompt Dialog (User Input)
81135

82136
```dart
83-
bool? result = await KAlert.confirm(
137+
String? value = await KAlert.prompt(
84138
context,
85-
"Delete this file?",
139+
title: "Enter your name",
86140
);
87141
88-
if (result == true) {
89-
print("User confirmed");
90-
} else {
91-
print("User cancelled");
92-
}
142+
print(value);
93143
```
94144

95145
---
@@ -98,10 +148,15 @@ if (result == true) {
98148

99149
```dart
100150
ElevatedButton(
101-
onPressed: () {
102-
KAlert.show(context, "Hello from KAlertFlutter!");
103-
},
104-
child: const Text("Show Alert"),
151+
onPressed: () {
152+
KAlert.show(
153+
context,
154+
title: "Hello",
155+
message: "Welcome to KAlertFlutter",
156+
type: KAlertType.info,
157+
);
158+
},
159+
child: const Text("Show Alert"),
105160
);
106161
```
107162

example/lib/main.dart

Lines changed: 100 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class MyApp extends StatelessWidget {
1010

1111
@override
1212
Widget build(BuildContext context) {
13-
return MaterialApp(
14-
home: const HomePage(),
13+
return const MaterialApp(
14+
home: HomePage(),
1515
);
1616
}
1717
}
@@ -22,27 +22,105 @@ class HomePage extends StatelessWidget {
2222
@override
2323
Widget build(BuildContext context) {
2424
return Scaffold(
25-
appBar: AppBar(title: const Text("KAlert Demo")),
25+
appBar: AppBar(
26+
title: const Text("KAlert Flutter Demo"),
27+
),
2628
body: Center(
27-
child: Column(
28-
mainAxisAlignment: MainAxisAlignment.center,
29-
children: [
30-
ElevatedButton(
31-
child: const Text("Show Alert"),
32-
onPressed: () {
33-
KAlert.show(context, "Saved successfully!");
34-
},
35-
),
36-
ElevatedButton(
37-
child: const Text("Show Confirm"),
38-
onPressed: () async {
39-
bool? result =
40-
await KAlert.confirm(context, "Delete file?");
41-
42-
print(result);
43-
},
44-
),
45-
],
29+
child: Padding(
30+
padding: const EdgeInsets.all(20),
31+
child: Column(
32+
mainAxisAlignment: MainAxisAlignment.center,
33+
children: [
34+
35+
ElevatedButton(
36+
onPressed: () {
37+
KAlert.show(
38+
context,
39+
title: "Success",
40+
message: "Saved successfully!",
41+
type: KAlertType.success,
42+
);
43+
},
44+
child: const Text("Success Alert"),
45+
),
46+
47+
ElevatedButton(
48+
onPressed: () {
49+
KAlert.show(
50+
context,
51+
title: "Error",
52+
message: "Something went wrong!",
53+
type: KAlertType.error,
54+
);
55+
},
56+
child: const Text("Error Alert"),
57+
),
58+
59+
ElevatedButton(
60+
onPressed: () {
61+
KAlert.show(
62+
context,
63+
title: "Warning",
64+
message: "Are you sure about this?",
65+
type: KAlertType.warning,
66+
);
67+
},
68+
child: const Text("Warning Alert"),
69+
),
70+
71+
ElevatedButton(
72+
onPressed: () {
73+
KAlert.show(
74+
context,
75+
title: "Information",
76+
message: "Here is some information.",
77+
type: KAlertType.info,
78+
);
79+
},
80+
child: const Text("Info Alert"),
81+
),
82+
83+
ElevatedButton(
84+
onPressed: () async {
85+
bool? result = await KAlert.confirm(
86+
context,
87+
title: "Delete file?",
88+
message: "This action cannot be undone",
89+
);
90+
91+
if (result == true) {
92+
KAlert.show(
93+
context,
94+
title: "Deleted",
95+
message: "File removed successfully",
96+
type: KAlertType.success,
97+
);
98+
}
99+
},
100+
child: const Text("Confirm Dialog"),
101+
),
102+
103+
ElevatedButton(
104+
onPressed: () async {
105+
String? value = await KAlert.prompt(
106+
context,
107+
title: "Enter your name",
108+
);
109+
110+
if (value != null && value.isNotEmpty) {
111+
KAlert.show(
112+
context,
113+
title: "Hello",
114+
message: value,
115+
type: KAlertType.success,
116+
);
117+
}
118+
},
119+
child: const Text("Prompt Dialog"),
120+
),
121+
122+
],
123+
),
46124
),
47125
),
48126
);

0 commit comments

Comments
 (0)