mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
feat: Favourites support using firmware flags bit 0
- Contact.isFavourite reads bit 0 of firmware flags field - Toggle favourite via contact action sheet (writes to device) - Favourites section shown first in contacts tab - Path size options corrected to [1, 2, 3] bytes
This commit is contained in:
@@ -348,6 +348,29 @@ class ContactTile extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (!contact.isChannel)
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
contact.isFavourite ? Icons.star : Icons.star_outline,
|
||||
color: contact.isFavourite ? Colors.amber : null,
|
||||
),
|
||||
title: Text(
|
||||
contact.isFavourite
|
||||
? 'Remove from Favourites'
|
||||
: 'Add to Favourites',
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
final toggled = contact.toggleFavourite();
|
||||
final connectionProvider =
|
||||
context.read<ConnectionProvider>();
|
||||
await connectionProvider.addOrUpdateContact(toggled);
|
||||
if (context.mounted) {
|
||||
// Refresh contact from device so the local cache is updated
|
||||
await connectionProvider.getContact(contact.publicKey);
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.message_outlined),
|
||||
title: Text(l10n.messages),
|
||||
|
||||
Reference in New Issue
Block a user