tracpulse/lib/status_screen.dart

72 lines
1.9 KiB
Dart

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;
}
}
}