showBottomSheet static method
Show a BottomSheet anywhere in the app
Implementation
static void showBottomSheet(String title, String message) {
final context =
AlertServiceConfig().navigatorKey.currentState?.overlay?.context;
if (context != null) {
showModalBottomSheet(
context: context,
builder: (context) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
title,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
Text(message),
const SizedBox(height: 16),
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text("OK"),
),
],
),
);
},
);
} else {
debugPrint(
"AlertService: No navigatorKey or context available for BottomSheet");
}
}