only-bible-app v3.7.2+24
git clone https://git.pyrossh.dev/only-bible-app
The only bible app you will ever need. No ads. No in-app purchases. No distractions.
lib/dialogs.dart
import "package:flutter/material.dart";
void showAlert(BuildContext context, String title, String message) {
showDialog(
context: context,
barrierColor: Colors.black54,
builder: (_) {
return AlertDialog(
title: Text(title),
content: Text(message),
actionsAlignment: MainAxisAlignment.center,
actionsOverflowButtonSpacing: 8.0,
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text("OK"),
),
],
);
},
);
}
void showError(BuildContext context, String message) {
showAlert(context, "Error", message);
}
Future<bool> showConfirm(
BuildContext context,
String title,
String message,
) async {
const buttonStyle = ButtonStyle(
padding: WidgetStatePropertyAll(
EdgeInsets.symmetric(horizontal: 20, vertical: 10),
),
textStyle: WidgetStatePropertyAll(TextStyle(fontSize: 13)),
);
final result = await showDialog<bool>(
context: context,
barrierColor: Colors.black54,
builder: (dialogContext) {
return AlertDialog(
title: Text(title),
content: Text(message),
actionsAlignment: MainAxisAlignment.center,
actionsOverflowButtonSpacing: 8.0,
actions: [
TextButton(
style: buttonStyle,
onPressed: () => Navigator.of(dialogContext).pop(false),
child: const Text("Cancel"),
),
FilledButton(
style: buttonStyle,
onPressed: () => Navigator.of(dialogContext).pop(true),
child: const Text("Continue"),
),
],
);
},
);
return result ?? false;
}