You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
2.0 KiB
Dart
51 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
import 'package:test_sa/modules/alerts/alert_detail_page.dart';
|
|
import 'package:test_sa/modules/alerts/alert_model.dart';
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
import 'package:test_sa/views/widgets/item_views/info_date_widget.dart';
|
|
import 'package:test_sa/views/widgets/item_views/info_header_widget.dart';
|
|
import 'package:test_sa/views/widgets/item_views/info_text_widget.dart';
|
|
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
|
|
|
class AlertItemView extends StatelessWidget {
|
|
final AlertModel alert;
|
|
final bool showShadow;
|
|
|
|
const AlertItemView({Key? key, required this.alert, this.showShadow = true}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
StatusLabel(
|
|
label: alert.statusLabel,
|
|
textColor: AppColor.getRequestStatusTextColorByName(context, alert.statusLabel),
|
|
backgroundColor: AppColor.getRequestStatusColorByName(context, alert.statusLabel),
|
|
),
|
|
1.width.expanded,
|
|
InfoDateWidget(alert.createdDate ?? alert.dateTime ?? ""),
|
|
],
|
|
),
|
|
InfoHeaderWidget(alert.ruleName ?? "Alert"),
|
|
InfoTextWidget(label: "Severity", value: alert.severity),
|
|
InfoTextWidget(label: context.translation.site, value: alert.campusName),
|
|
InfoTextWidget(label: "Alert No", value: alert.alertId, showArrow: true),
|
|
],
|
|
).toShadowContainer(context, withShadow: showShadow).onPress(() {
|
|
Navigator.of(context).push(
|
|
MaterialPageRoute(
|
|
builder: (_) => AlertDetailPage(alertId: alert.id!),
|
|
),
|
|
);
|
|
});
|
|
}
|
|
}
|
|
|