mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Enhance compass dialog to include SAR markers; update settings screen to load combined messages from SAR and channel sources
This commit is contained in:
@@ -506,7 +506,7 @@ class _MapTabState extends State<MapTab> with AutomaticKeepAliveClientMixin {
|
||||
);
|
||||
}
|
||||
|
||||
void _showDetailedCompass(BuildContext context, List<Contact> contacts) {
|
||||
void _showDetailedCompass(BuildContext context, List<Contact> contacts, List<SarMarker> sarMarkers) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
@@ -521,6 +521,7 @@ class _MapTabState extends State<MapTab> with AutomaticKeepAliveClientMixin {
|
||||
initialPosition: _currentPosition,
|
||||
initialHeading: _currentHeading,
|
||||
contacts: contacts,
|
||||
sarMarkers: sarMarkers,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -665,6 +666,7 @@ class _MapTabState extends State<MapTab> with AutomaticKeepAliveClientMixin {
|
||||
onTap: () => _showDetailedCompass(
|
||||
context,
|
||||
contactsProvider.chatContactsWithLocation,
|
||||
messagesProvider.sarMarkers,
|
||||
),
|
||||
child: _CompassWidget(
|
||||
heading: _currentHeading ?? 0,
|
||||
@@ -972,11 +974,13 @@ class _DetailedCompassDialog extends StatefulWidget {
|
||||
final Position? initialPosition;
|
||||
final double? initialHeading;
|
||||
final List<Contact> contacts;
|
||||
final List<SarMarker> sarMarkers;
|
||||
|
||||
const _DetailedCompassDialog({
|
||||
required this.initialPosition,
|
||||
required this.initialHeading,
|
||||
required this.contacts,
|
||||
required this.sarMarkers,
|
||||
});
|
||||
|
||||
@override
|
||||
|
||||
@@ -93,12 +93,20 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
stagingCount: 1,
|
||||
);
|
||||
|
||||
final channelMessages = SampleDataGenerator.generateChannelMessages(
|
||||
generalChannelMessages: 8,
|
||||
emergencyChannelMessages: 5,
|
||||
);
|
||||
|
||||
// Combine all messages
|
||||
final allMessages = [...sarMessages, ...channelMessages];
|
||||
|
||||
// Add to providers
|
||||
final contactsProvider = Provider.of<ContactsProvider>(context, listen: false);
|
||||
final messagesProvider = Provider.of<MessagesProvider>(context, listen: false);
|
||||
|
||||
contactsProvider.addContacts(contacts);
|
||||
messagesProvider.addMessages(sarMessages);
|
||||
messagesProvider.addMessages(allMessages);
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
@@ -108,7 +116,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Loaded $teamCount team members, $channelCount channels, ${sarMessages.length} SAR markers',
|
||||
'Loaded $teamCount team members, $channelCount channels, ${sarMessages.length} SAR markers, ${channelMessages.length} messages',
|
||||
),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
@@ -227,7 +235,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Text(
|
||||
'Load or clear sample contacts and SAR markers for testing',
|
||||
'Load or clear sample contacts, channel messages, and SAR markers for testing',
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.6),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user