Add region management

This adds region management: the user can manage a list of available regions
and for each channel pick a region from that list to apply to messages.

Region discovery from nearby repeaters will be done in a separate PR.

This is a part of the work needed for #120.
This commit is contained in:
Stephan Rodemeier
2026-04-05 21:35:39 +02:00
parent 0757c8e53a
commit 0e074fd806
33 changed files with 1653 additions and 68 deletions
+11 -15
View File
@@ -1,8 +1,8 @@
import 'dart:async';
import 'dart:math';
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:meshcore_open/storage/channel_message_store.dart';
import 'package:meshcore_open/utils/platform_info.dart';
import 'package:meshcore_open/widgets/app_bar.dart';
@@ -380,10 +380,15 @@ class _ChannelsScreenState extends State<ChannelsScreen>
isCommunityChannel && _isCommunityPublicChannel(channel, community);
// Determine icon and colors based on channel type
IconData icon;
Color iconColor;
Color bgColor;
String subtitle;
IconData icon = Icons.lock;
Color iconColor = Colors.blue;
Color bgColor = Colors.blue.withValues(alpha: 0.2);
String region = connector.hasChannelRegion(channel.index)
? context.l10n.channels_regionSetTo(
connector.getChannelRegion(channel.index),
)
: context.l10n.channels_regionNotSet;
String subtitle = region;
if (isCommunityChannel) {
// Community channel styling
@@ -402,17 +407,8 @@ class _ChannelsScreenState extends State<ChannelsScreen>
icon = Icons.public;
iconColor = Colors.green;
bgColor = Colors.green.withValues(alpha: 0.2);
subtitle = context.l10n.channels_publicChannel;
} else if (channel.name.startsWith('#')) {
} else if (channel.isHashtagChannel) {
icon = Icons.tag;
iconColor = Colors.blue;
bgColor = Colors.blue.withValues(alpha: 0.2);
subtitle = context.l10n.channels_hashtagChannel;
} else {
icon = Icons.lock;
iconColor = Colors.blue;
bgColor = Colors.blue.withValues(alpha: 0.2);
subtitle = context.l10n.channels_privateChannel;
}
return Card(