45 lines
1.1 KiB
Dart
45 lines
1.1 KiB
Dart
part of '../../app/app.dart';
|
|
|
|
class EwsScreen extends StatelessWidget {
|
|
const EwsScreen({
|
|
super.key,
|
|
required this.warnings,
|
|
required this.token,
|
|
required this.baseUrl,
|
|
});
|
|
|
|
final List<dynamic> warnings;
|
|
final String token;
|
|
final String baseUrl;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final total = warnings.fold<int>(
|
|
0,
|
|
(sum, item) => sum + (asMap(item)['total'] as num? ?? 0).toInt(),
|
|
);
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Early Warning Sistem')),
|
|
body: ListView(
|
|
padding: const EdgeInsets.fromLTRB(16, 12, 16, 24),
|
|
children: [
|
|
SectionTitle(
|
|
title: 'Early Warning Sistem',
|
|
actionLabel: '$total kasus',
|
|
),
|
|
if (warnings.isEmpty)
|
|
const EmptyPanel(text: 'Tidak ada data Early Warning.')
|
|
else
|
|
...warnings.map(
|
|
(group) => EarlyWarningGroupCard(
|
|
group: asMap(group),
|
|
token: token,
|
|
baseUrl: baseUrl,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|