medora-provider/lib/widgets/alert_screen.dart
DhanshCOSQ 66c3b2fb9c Patient registration complete with authentication flow fixed (#3)
Patient registration complete with authentication flow fixed

Co-authored-by: Benoy Bose <benoybose@gmail.com>
Co-authored-by: Jipson George <152465898+Jipson-cosq@users.noreply.github.com>
Reviewed-on: cosqnet/telemednet#3
Reviewed-by: Benoy Bose <benoybose@cosq.net>
Co-authored-by: DhanshCOSQ <dhanshas@cosq.net>
Co-committed-by: DhanshCOSQ <dhanshas@cosq.net>
2024-10-31 14:20:35 +00:00

94 lines
2.8 KiB
Dart

import 'package:flutter/material.dart';
enum AlertType { success, error, info }
class AlertArguments {
final String title;
final String message;
final String actionTitle;
final AlertType type;
final VoidCallback onActionPressed;
AlertArguments({
this.title = '',
required this.message,
required this.actionTitle,
required this.type,
required this.onActionPressed,
});
}
class AlertScreen extends StatelessWidget {
final AlertArguments arguments;
const AlertScreen({super.key, required this.arguments});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
arguments.type == AlertType.success
? Icons.thumb_up_outlined
: arguments.type == AlertType.error
? Icons.thumb_down_outlined
: Icons.info_outline,
size: 150,
color: arguments.type == AlertType.error
? Colors.red
: arguments.type == AlertType.success
? Colors.lightBlue
: Theme.of(context).colorScheme.primary,
),
const SizedBox(height: 32),
if (arguments.title.isNotEmpty) ...[
Text(
arguments.title,
style: const TextStyle(
fontSize: 40,
fontWeight: FontWeight.bold,
color: Colors.black,
),
textAlign: TextAlign.center,
),
],
Text(
arguments.message,
style: const TextStyle(
fontSize: 16,
color: Colors.grey,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
TextButton(
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16),
),
onPressed: arguments.onActionPressed,
child: Text(
arguments.actionTitle,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
color: arguments.type == AlertType.error
? Colors.red
: Colors.lightBlue,
),
),
),
],
),
),
),
);
}
}