Skip to content

Commit c1acfed

Browse files
committed
feat: Buat function reusable showDialogConfirmation dan showDialogMessage didalam widget_helper.dart
1 parent a64202a commit c1acfed

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

lib/core/util/widget_helper.dart

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,4 +232,46 @@ class WidgetHelper {
232232
}
233233
return false;
234234
}
235+
236+
Future<bool?> showDialogConfirmation(
237+
BuildContext context,
238+
String title,
239+
String content,
240+
List<Widget> actions,
241+
) {
242+
return showDialog<bool?>(
243+
context: context,
244+
builder: (context) {
245+
return AlertDialog(
246+
title: Text(title),
247+
content: Text(content),
248+
actions: actions,
249+
);
250+
},
251+
);
252+
}
253+
254+
Future<void> showDialogMessage(
255+
BuildContext context,
256+
String? title,
257+
String message,
258+
) {
259+
return showDialog(
260+
context: context,
261+
builder: (context) {
262+
return AlertDialog(
263+
title: Text(title ?? 'info'.tr()),
264+
content: Text(message),
265+
actions: [
266+
TextButton(
267+
onPressed: () {
268+
context.pop();
269+
},
270+
child: Text('dismiss'.tr()),
271+
),
272+
],
273+
);
274+
},
275+
);
276+
}
235277
}

0 commit comments

Comments
 (0)