mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-12 08:50:30 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user