2022-06-28 10:32:16 -04:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
/// A simple widget that displays an alert message in the center.
|
|
|
|
|
class AlertMessage extends StatelessWidget {
|
|
|
|
|
final String message;
|
2022-07-28 21:44:28 -04:00
|
|
|
final Color? color;
|
2023-10-22 18:38:32 -04:00
|
|
|
final bool centered;
|
2022-06-28 10:32:16 -04:00
|
|
|
|
|
|
|
|
const AlertMessage({
|
|
|
|
|
Key? key,
|
|
|
|
|
required this.message,
|
2023-10-22 18:38:32 -04:00
|
|
|
this.centered = true,
|
2022-07-28 21:44:28 -04:00
|
|
|
this.color,
|
2022-06-28 10:32:16 -04:00
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Row(
|
2023-10-22 18:38:32 -04:00
|
|
|
mainAxisAlignment:
|
|
|
|
|
centered ? MainAxisAlignment.center : MainAxisAlignment.start,
|
2022-06-28 10:32:16 -04:00
|
|
|
children: [
|
|
|
|
|
Icon(
|
2023-01-18 05:34:54 -05:00
|
|
|
Icons.info_outline_rounded,
|
2022-07-28 21:44:28 -04:00
|
|
|
color: color ?? Colors.grey,
|
2022-06-28 10:32:16 -04:00
|
|
|
),
|
2023-10-22 18:38:32 -04:00
|
|
|
const SizedBox(width: 8),
|
2022-07-05 04:57:47 -04:00
|
|
|
Flexible(
|
|
|
|
|
child: Text(
|
|
|
|
|
message,
|
2022-07-28 21:44:28 -04:00
|
|
|
style: TextStyle(
|
2022-07-05 04:57:47 -04:00
|
|
|
fontWeight: FontWeight.w500,
|
2022-07-28 21:44:28 -04:00
|
|
|
color: color ?? Colors.grey,
|
2022-07-05 04:57:47 -04:00
|
|
|
),
|
2022-06-28 10:32:16 -04:00
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|