42 lines
1.1 KiB
Dart
42 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../core/observations/observed_event.dart';
|
|
|
|
class SeverityBadge extends StatelessWidget {
|
|
const SeverityBadge({required this.level, super.key});
|
|
|
|
final MavSeverity level;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final dark = Theme.of(context).brightness == Brightness.dark;
|
|
final (icon, color) = switch (level.wireValue) {
|
|
0 || 1 || 2 || 3 => (
|
|
Icons.error_outline,
|
|
dark ? const Color(0xffff6b63) : const Color(0xffd92d20),
|
|
),
|
|
4 => (
|
|
Icons.warning_amber_outlined,
|
|
dark ? const Color(0xfff7b955) : const Color(0xffb54708),
|
|
),
|
|
5 || 6 => (
|
|
Icons.info_outline,
|
|
dark ? const Color(0xff70b8ff) : const Color(0xff175cd3),
|
|
),
|
|
7 => (
|
|
Icons.bug_report_outlined,
|
|
dark ? const Color(0xffa8b5ac) : const Color(0xff546258),
|
|
),
|
|
_ => (
|
|
Icons.help_outline,
|
|
dark ? const Color(0xffa8b5ac) : const Color(0xff546258),
|
|
),
|
|
};
|
|
|
|
return Semantics(
|
|
label: 'Severity: ${level.label}',
|
|
child: Icon(icon, color: color),
|
|
);
|
|
}
|
|
}
|