feat: Enhance SAR message handling with color indexing and localization

- Added `sarColorIndex` to `Message` and `SarMarker` models to support color indexing for SAR markers.
- Introduced a standard color palette in `SarTemplate` and methods to retrieve colors based on index.
- Updated `SarTemplate` to include localization for template names.
- Modified `SarUpdateSheet` and message sending logic to include color index in SAR messages.
- Enhanced `SarMessageParser` to support both old and new message formats with color index.
- Updated UI components to reflect changes in SAR marker color handling based on the new color index.
- Improved sample data generation to utilize localized strings for better testing and demonstration.
This commit is contained in:
Janez T
2025-10-23 19:17:13 +02:00
parent b70eed1bf2
commit 98cda8c976
28 changed files with 2734 additions and 270 deletions

View File

@@ -18,6 +18,7 @@ class SarUpdateSheet extends StatefulWidget {
Position,
Uint8List?,
bool,
int colorIndex,
)
onSend;
final Position? prePopulatedPosition;
@@ -784,7 +785,7 @@ class _SarUpdateSheetState extends State<SarUpdateSheet> {
displayText = _selectedTemplate!.name;
}
// Send SAR marker with emoji and display text
// Send SAR marker with emoji, display text, and color index
await widget.onSend(
_selectedTemplate!.emoji,
displayText,
@@ -793,6 +794,7 @@ class _SarUpdateSheetState extends State<SarUpdateSheet> {
? null
: _selectedContact!.publicKey,
_selectedContact!.isChannel,
_selectedTemplate!.getColorIndex(), // Include color index
);
if (context.mounted) {
Navigator.pop(context);
@@ -869,7 +871,7 @@ class TemplateChip extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
template.name,
template.getLocalizedName(context),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,