feat: add StatusScreen for event log viewing
This commit is contained in:
parent
4e2afa3428
commit
01cf56f998
1 changed files with 77 additions and 0 deletions
77
lib/status_screen.dart
Normal file
77
lib/status_screen.dart
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class StatusScreen extends StatelessWidget {
|
||||||
|
const StatusScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('Event Log'),
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
children: [
|
||||||
|
Card(
|
||||||
|
child: ListTile(
|
||||||
|
leading: const Icon(Icons.info, color: Colors.blue),
|
||||||
|
title: const Text('Status Screen'),
|
||||||
|
subtitle: const Text('Event logs will be displayed here'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
_buildPlaceholderEvent('LOCATION', '37.7749', '-122.4194'),
|
||||||
|
_buildPlaceholderEvent('SYNC', 'Location sent to server', ''),
|
||||||
|
_buildPlaceholderEvent('HEARTBEAT', 'Heartbeat fired', ''),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPlaceholderEvent(String type, String detail, String extra) {
|
||||||
|
return Card(
|
||||||
|
child: ListTile(
|
||||||
|
leading: Icon(
|
||||||
|
_getIconForType(type),
|
||||||
|
color: _getColorForType(type),
|
||||||
|
),
|
||||||
|
title: Text(type),
|
||||||
|
subtitle: Text('$detail $extra'.trim()),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
IconData _getIconForType(String type) {
|
||||||
|
switch (type) {
|
||||||
|
case 'LOCATION':
|
||||||
|
return Icons.location_on;
|
||||||
|
case 'SYNC':
|
||||||
|
return Icons.cloud_done;
|
||||||
|
case 'HEARTBEAT':
|
||||||
|
return Icons.favorite;
|
||||||
|
case 'FILTERED':
|
||||||
|
return Icons.filter_alt;
|
||||||
|
case 'ERROR':
|
||||||
|
return Icons.error;
|
||||||
|
default:
|
||||||
|
return Icons.info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Color _getColorForType(String type) {
|
||||||
|
switch (type) {
|
||||||
|
case 'LOCATION':
|
||||||
|
return Colors.green;
|
||||||
|
case 'SYNC':
|
||||||
|
return Colors.blue;
|
||||||
|
case 'HEARTBEAT':
|
||||||
|
return Colors.orange;
|
||||||
|
case 'FILTERED':
|
||||||
|
return Colors.grey;
|
||||||
|
case 'ERROR':
|
||||||
|
return Colors.red;
|
||||||
|
default:
|
||||||
|
return Colors.grey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue