Fix layouts on small screens and large text, and test every screen
Contact rows give the name its own line (wrapping to two) with route and last seen below, right-aligned on wide windows. Fixes overflows found by a new widget test that renders every screen at 320x568 with text scales up to 2.0 and on a desktop window: region dropdown, contacts list, repeater CLI, status grid and settings card, map cache buttons, and empty states. Dropdowns truncate long labels, and option sheets and dialogs scroll.
This commit is contained in:
1 parent
f0144ca959
commit
979e1a7d2a
21 files changed
+1512
-979
No files matched your search
@@ -77,6 +77,7 @@ class LinkHandler {
|
||||
final shouldOpen = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(context.l10n.chat_openLink),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -26,46 +26,51 @@ class ReviewModeBanner extends StatelessWidget {
|
||||
minimumSize: const Size(48, 48),
|
||||
);
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: const BoxDecoration(
|
||||
color: MeshPalette.bg3,
|
||||
border: Border(bottom: BorderSide(color: MeshPalette.warnLine)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.science, color: MeshPalette.warn, size: 24),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: Text(l10n.reviewMode_banner, style: textStyle)),
|
||||
],
|
||||
),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
children: [
|
||||
TextButton(
|
||||
style: buttonStyle,
|
||||
onPressed: () {
|
||||
connector.sendReviewTestMessage();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(l10n.reviewMode_testSent)),
|
||||
);
|
||||
},
|
||||
child: Text(l10n.reviewMode_sendTest),
|
||||
),
|
||||
TextButton(
|
||||
style: buttonStyle,
|
||||
// The screens hosting the banner return to the Connect screen
|
||||
// themselves once disconnected.
|
||||
onPressed: () => connector.disconnect(manual: true),
|
||||
child: Text(l10n.reviewMode_exit),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
// A status strip on every main screen: capped so that at the largest
|
||||
// text sizes it can't take over a small phone's screen.
|
||||
return MediaQuery.withClampedTextScaling(
|
||||
maxScaleFactor: 1.3,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: const BoxDecoration(
|
||||
color: MeshPalette.bg3,
|
||||
border: Border(bottom: BorderSide(color: MeshPalette.warnLine)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.science, color: MeshPalette.warn, size: 24),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: Text(l10n.reviewMode_banner, style: textStyle)),
|
||||
],
|
||||
),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
children: [
|
||||
TextButton(
|
||||
style: buttonStyle,
|
||||
onPressed: () {
|
||||
connector.sendReviewTestMessage();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(l10n.reviewMode_testSent)),
|
||||
);
|
||||
},
|
||||
child: Text(l10n.reviewMode_sendTest),
|
||||
),
|
||||
TextButton(
|
||||
style: buttonStyle,
|
||||
// The screens hosting the banner return to the Connect screen
|
||||
// themselves once disconnected.
|
||||
onPressed: () => connector.disconnect(manual: true),
|
||||
child: Text(l10n.reviewMode_exit),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1418,56 +1418,58 @@ class AppSettingsScreen extends StatelessWidget {
|
||||
) {
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (ctx) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.appSettings_mapTimeFilter),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 4, 16, 8),
|
||||
child: Text(context.l10n.appSettings_showNodesDiscoveredWithin),
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_allTime,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 0,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(0);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_lastHour,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 1,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(1);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_last6Hours,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 6,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(6);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_last24Hours,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 24,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(24);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_lastWeek,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 168,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(168);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8),
|
||||
],
|
||||
builder: (ctx) => SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.appSettings_mapTimeFilter),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 4, 16, 8),
|
||||
child: Text(context.l10n.appSettings_showNodesDiscoveredWithin),
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_allTime,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 0,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(0);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_lastHour,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 1,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(1);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_last6Hours,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 6,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(6);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_last24Hours,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 24,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(24);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_lastWeek,
|
||||
selected: settingsService.settings.mapTimeFilterHours == 168,
|
||||
onTap: () {
|
||||
settingsService.setMapTimeFilterHours(168);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1478,29 +1480,32 @@ class AppSettingsScreen extends StatelessWidget {
|
||||
) {
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (ctx) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.appSettings_unitsTitle),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_unitsMetric,
|
||||
selected: settingsService.settings.unitSystem == UnitSystem.metric,
|
||||
onTap: () {
|
||||
settingsService.setUnitSystem(UnitSystem.metric);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_unitsImperial,
|
||||
selected:
|
||||
settingsService.settings.unitSystem == UnitSystem.imperial,
|
||||
onTap: () {
|
||||
settingsService.setUnitSystem(UnitSystem.imperial);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8),
|
||||
],
|
||||
builder: (ctx) => SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.appSettings_unitsTitle),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_unitsMetric,
|
||||
selected:
|
||||
settingsService.settings.unitSystem == UnitSystem.metric,
|
||||
onTap: () {
|
||||
settingsService.setUnitSystem(UnitSystem.metric);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
MeshSheetOption(
|
||||
label: context.l10n.appSettings_unitsImperial,
|
||||
selected:
|
||||
settingsService.settings.unitSystem == UnitSystem.imperial,
|
||||
onTap: () {
|
||||
settingsService.setUnitSystem(UnitSystem.imperial);
|
||||
Navigator.pop(ctx);
|
||||
},
|
||||
),
|
||||
SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1917,6 +1922,7 @@ class _MapApiKeyDialogState extends State<_MapApiKeyDialog> {
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
return AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(l10n.appSettings_stadiaApiKey),
|
||||
content: SizedBox(
|
||||
width: 420,
|
||||
|
||||
@@ -1775,57 +1775,59 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: l10n.receivedImage_awaiting(
|
||||
entry.bitstreamByteCount,
|
||||
entry.totalChunks,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: l10n.receivedImage_awaiting(
|
||||
entry.bitstreamByteCount,
|
||||
entry.totalChunks,
|
||||
),
|
||||
subtitle: _imageSenderLabel(entry),
|
||||
),
|
||||
subtitle: _imageSenderLabel(entry),
|
||||
),
|
||||
if (canSave)
|
||||
if (canSave)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.save_alt),
|
||||
title: Text(l10n.receivedImage_save),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_saveImage(entry);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.save_alt),
|
||||
title: Text(l10n.receivedImage_save),
|
||||
leading: const Icon(Icons.info_outline),
|
||||
title: Text(l10n.receivedImage_packetInfo),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_saveImage(entry);
|
||||
_showImagePacketInfo(entry);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.info_outline),
|
||||
title: Text(l10n.receivedImage_packetInfo),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showImagePacketInfo(entry);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await context.read<ReceivedImageStore>().deleteImage(
|
||||
entry.streamId,
|
||||
);
|
||||
if (!mounted) return;
|
||||
showDismissibleSnackBar(
|
||||
context,
|
||||
content: Text(l10n.chat_messageDeleted),
|
||||
);
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await context.read<ReceivedImageStore>().deleteImage(
|
||||
entry.streamId,
|
||||
);
|
||||
if (!mounted) return;
|
||||
showDismissibleSnackBar(
|
||||
context,
|
||||
content: Text(l10n.chat_messageDeleted),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1860,6 +1862,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(l10n.receivedImage_packetInfo),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -2234,109 +2237,111 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: message.text.characters.length > 40
|
||||
? '${message.text.characters.take(40)}…'
|
||||
: message.text,
|
||||
subtitle: message.senderName.isNotEmpty
|
||||
? message.senderName
|
||||
: null,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.reply),
|
||||
title: Text(context.l10n.chat_reply),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_setReplyingTo(message);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.route),
|
||||
title: Text(context.l10n.chat_path),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showMessagePathInfo(message);
|
||||
},
|
||||
),
|
||||
if (message.pathBytes.isNotEmpty)
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: message.text.characters.length > 40
|
||||
? '${message.text.characters.take(40)}…'
|
||||
: message.text,
|
||||
subtitle: message.senderName.isNotEmpty
|
||||
? message.senderName
|
||||
: null,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.map_outlined),
|
||||
title: Text(context.l10n.chat_viewPathOnMap),
|
||||
leading: const Icon(Icons.reply),
|
||||
title: Text(context.l10n.chat_reply),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChannelMessagePathMapScreen(
|
||||
message: message,
|
||||
channelMessage: true,
|
||||
_setReplyingTo(message);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.route),
|
||||
title: Text(context.l10n.chat_path),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showMessagePathInfo(message);
|
||||
},
|
||||
),
|
||||
if (message.pathBytes.isNotEmpty)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.map_outlined),
|
||||
title: Text(context.l10n.chat_viewPathOnMap),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChannelMessagePathMapScreen(
|
||||
message: message,
|
||||
channelMessage: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
// Can't react to your own messages
|
||||
if (!message.isOutgoing)
|
||||
);
|
||||
},
|
||||
),
|
||||
// Can't react to your own messages
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.add_reaction_outlined),
|
||||
title: Text(context.l10n.chat_addReaction),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showEmojiPicker(message);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.add_reaction_outlined),
|
||||
title: Text(context.l10n.chat_addReaction),
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.common_copy),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showEmojiPicker(message);
|
||||
copyChatMessageText(context, message.text);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.common_copy),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
copyChatMessageText(context, message.text);
|
||||
},
|
||||
),
|
||||
if (canTranslateMessage)
|
||||
if (canTranslateMessage)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.translate),
|
||||
title: Text(context.l10n.translation_translateMessage),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
unawaited(
|
||||
context.read<MeshCoreConnector>().translateChannelMessage(
|
||||
widget.channel.index,
|
||||
message,
|
||||
manualTranslation: true,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.mark_chat_unread_outlined),
|
||||
title: Text(context.l10n.chat_markAsUnread),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_markAsUnread(message);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.translate),
|
||||
title: Text(context.l10n.translation_translateMessage),
|
||||
onTap: () {
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
unawaited(
|
||||
context.read<MeshCoreConnector>().translateChannelMessage(
|
||||
widget.channel.index,
|
||||
message,
|
||||
manualTranslation: true,
|
||||
),
|
||||
);
|
||||
await _deleteMessage(message);
|
||||
},
|
||||
),
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.mark_chat_unread_outlined),
|
||||
title: Text(context.l10n.chat_markAsUnread),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_markAsUnread(message);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await _deleteMessage(message);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -631,56 +631,58 @@ class _ChannelsScreenState extends State<ChannelsScreen>
|
||||
showMeshSheet(
|
||||
parentContext,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.edit_outlined),
|
||||
title: Text(sheetContext.l10n.channels_editChannel),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
_showEditChannelDialog(parentContext, connector, channel);
|
||||
}
|
||||
},
|
||||
),
|
||||
// Notification mode selection
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications_outlined),
|
||||
title: Text(sheetContext.l10n.channels_notificationSettings),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
showChannelNotificationModeSheet(
|
||||
parentContext,
|
||||
channel.muteKey,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(sheetContext).colorScheme.error,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.edit_outlined),
|
||||
title: Text(sheetContext.l10n.channels_editChannel),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
_showEditChannelDialog(parentContext, connector, channel);
|
||||
}
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
sheetContext.l10n.channels_deleteChannel,
|
||||
style: TextStyle(
|
||||
// Notification mode selection
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications_outlined),
|
||||
title: Text(sheetContext.l10n.channels_notificationSettings),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
showChannelNotificationModeSheet(
|
||||
parentContext,
|
||||
channel.muteKey,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(sheetContext).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
sheetContext.l10n.channels_deleteChannel,
|
||||
style: TextStyle(
|
||||
color: Theme.of(sheetContext).colorScheme.error,
|
||||
),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
_confirmDeleteChannel(parentContext, connector, channel);
|
||||
}
|
||||
},
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (parentContext.mounted) {
|
||||
_confirmDeleteChannel(parentContext, connector, channel);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1191,12 +1193,16 @@ class _ChannelsScreenState extends State<ChannelsScreen>
|
||||
vertical: 8,
|
||||
),
|
||||
child: DropdownButtonFormField<Community>(
|
||||
isExpanded: true,
|
||||
initialValue: selectedCommunity,
|
||||
items: _communities
|
||||
.map(
|
||||
(c) => DropdownMenuItem(
|
||||
value: c,
|
||||
child: Text(c.name),
|
||||
child: Text(
|
||||
c.name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
@@ -1751,6 +1757,7 @@ class _ChannelsScreenState extends State<ChannelsScreen>
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
|
||||
child: DropdownButtonFormField<String>(
|
||||
isExpanded: true,
|
||||
initialValue: selectedCyr2LatProfileId,
|
||||
decoration: InputDecoration(
|
||||
labelText: sheetContext
|
||||
@@ -1762,7 +1769,10 @@ class _ChannelsScreenState extends State<ChannelsScreen>
|
||||
.map((profile) {
|
||||
return DropdownMenuItem(
|
||||
value: profile.id,
|
||||
child: Text(profile.name),
|
||||
child: Text(
|
||||
profile.name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
);
|
||||
})
|
||||
.toList(),
|
||||
|
||||
@@ -870,6 +870,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
|
||||
child: DropdownButtonFormField<String>(
|
||||
isExpanded: true,
|
||||
initialValue: selectedCyr2LatProfileId,
|
||||
decoration: InputDecoration(
|
||||
labelText:
|
||||
@@ -881,7 +882,10 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
) {
|
||||
return DropdownMenuItem(
|
||||
value: profile.id,
|
||||
child: Text(profile.name),
|
||||
child: Text(
|
||||
profile.name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
@@ -1071,109 +1075,111 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: message.text.characters.length > 40
|
||||
? '${message.text.characters.take(40)}…'
|
||||
: message.text,
|
||||
),
|
||||
// Can't react to your own messages
|
||||
if (!message.isOutgoing)
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: message.text.characters.length > 40
|
||||
? '${message.text.characters.take(40)}…'
|
||||
: message.text,
|
||||
),
|
||||
// Can't react to your own messages
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.add_reaction_outlined),
|
||||
title: Text(context.l10n.chat_addReaction),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showEmojiPicker(message, contact);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.add_reaction_outlined),
|
||||
title: Text(context.l10n.chat_addReaction),
|
||||
leading: const Icon(Icons.route),
|
||||
title: Text(context.l10n.chat_path),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showEmojiPicker(message, contact);
|
||||
_openMessagePath(message, contact);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.route),
|
||||
title: Text(context.l10n.chat_path),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_openMessagePath(message, contact);
|
||||
},
|
||||
),
|
||||
if (message.pathBytes.isNotEmpty)
|
||||
if (message.pathBytes.isNotEmpty)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.map_outlined),
|
||||
title: Text(context.l10n.chat_viewPathOnMap),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_openMessagePath(message, contact, openMap: true);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.map_outlined),
|
||||
title: Text(context.l10n.chat_viewPathOnMap),
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.common_copy),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_openMessagePath(message, contact, openMap: true);
|
||||
copyChatMessageText(context, message.text);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.common_copy),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
copyChatMessageText(context, message.text);
|
||||
},
|
||||
),
|
||||
if (canTranslateMessage)
|
||||
if (canTranslateMessage)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.translate),
|
||||
title: Text(context.l10n.translation_translateMessage),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
unawaited(
|
||||
context.read<MeshCoreConnector>().translateContactMessage(
|
||||
widget.contact.publicKeyHex,
|
||||
message,
|
||||
manualTranslation: true,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.mark_chat_unread_outlined),
|
||||
title: Text(context.l10n.chat_markAsUnread),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_markAsUnread(message);
|
||||
},
|
||||
),
|
||||
if (message.isOutgoing && message.status == MessageStatus.failed)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.refresh),
|
||||
title: Text(context.l10n.common_retry),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_retryMessage(message);
|
||||
},
|
||||
),
|
||||
if (_resolveContact(context.read<MeshCoreConnector>()).type ==
|
||||
advTypeRoom)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.chat),
|
||||
title: Text(context.l10n.contacts_openChat),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_openChat(context, contact);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.translate),
|
||||
title: Text(context.l10n.translation_translateMessage),
|
||||
onTap: () {
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
unawaited(
|
||||
context.read<MeshCoreConnector>().translateContactMessage(
|
||||
widget.contact.publicKeyHex,
|
||||
message,
|
||||
manualTranslation: true,
|
||||
),
|
||||
);
|
||||
await _deleteMessage(message);
|
||||
},
|
||||
),
|
||||
if (!message.isOutgoing)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.mark_chat_unread_outlined),
|
||||
title: Text(context.l10n.chat_markAsUnread),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_markAsUnread(message);
|
||||
},
|
||||
),
|
||||
if (message.isOutgoing && message.status == MessageStatus.failed)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.refresh),
|
||||
title: Text(context.l10n.common_retry),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_retryMessage(message);
|
||||
},
|
||||
),
|
||||
if (_resolveContact(context.read<MeshCoreConnector>()).type ==
|
||||
advTypeRoom)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.chat),
|
||||
title: Text(context.l10n.contacts_openChat),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_openChat(context, contact);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.common_delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await _deleteMessage(message);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -168,61 +168,63 @@ class _CommunityQrScannerScreenState extends State<CommunityQrScannerScreen> {
|
||||
context,
|
||||
builder: (sheetContext) {
|
||||
final sheetScheme = Theme.of(sheetContext).colorScheme;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.channels_joinChannelTitle),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.channels_joinChannelConfirm(name),
|
||||
style: TextStyle(color: sheetScheme.onSurfaceVariant),
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.channels_joinChannelTitle),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.channels_joinChannelConfirm(name),
|
||||
style: TextStyle(color: sheetScheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
),
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
AvatarCircle(
|
||||
name: name,
|
||||
icon: Icons.lock,
|
||||
color: MeshPalette.blue,
|
||||
size: 44,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Text(
|
||||
name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
AvatarCircle(
|
||||
name: name,
|
||||
icon: Icons.lock,
|
||||
color: MeshPalette.blue,
|
||||
size: 44,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Text(
|
||||
name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, false),
|
||||
child: Text(context.l10n.common_cancel),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, false),
|
||||
child: Text(context.l10n.common_cancel),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: FilledButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, true),
|
||||
child: Text(context.l10n.common_add),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: FilledButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, true),
|
||||
child: Text(context.l10n.common_add),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -271,61 +273,63 @@ class _CommunityQrScannerScreenState extends State<CommunityQrScannerScreen> {
|
||||
context,
|
||||
builder: (sheetContext) {
|
||||
final sheetScheme = Theme.of(sheetContext).colorScheme;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.community_alreadyMember),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.community_alreadyMemberMessage(community.name),
|
||||
style: TextStyle(color: sheetScheme.onSurfaceVariant),
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.community_alreadyMember),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.community_alreadyMemberMessage(community.name),
|
||||
style: TextStyle(color: sheetScheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
),
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.groups,
|
||||
color: MeshPalette.magenta,
|
||||
size: 32,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
community.name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
context.l10n.community_shortId(
|
||||
community.shortCommunityId,
|
||||
),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 13,
|
||||
color: sheetScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.groups,
|
||||
color: MeshPalette.magenta,
|
||||
size: 32,
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
community.name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
context.l10n.community_shortId(
|
||||
community.shortCommunityId,
|
||||
),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 13,
|
||||
color: sheetScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: FilledButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, true),
|
||||
child: Text(context.l10n.common_ok),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: FilledButton(
|
||||
onPressed: () => Navigator.pop(sheetContext, true),
|
||||
child: Text(context.l10n.common_ok),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -348,93 +352,95 @@ class _CommunityQrScannerScreenState extends State<CommunityQrScannerScreen> {
|
||||
builder: (sheetContext) => StatefulBuilder(
|
||||
builder: (sheetContext, setSheetState) {
|
||||
final joinScheme = Theme.of(sheetContext).colorScheme;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.community_joinTitle),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.community_joinConfirmation(community.name),
|
||||
style: TextStyle(color: joinScheme.onSurfaceVariant),
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.community_joinTitle),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 4),
|
||||
child: Text(
|
||||
context.l10n.community_joinConfirmation(community.name),
|
||||
style: TextStyle(color: joinScheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
),
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
AvatarCircle(
|
||||
name: community.name,
|
||||
icon: Icons.groups,
|
||||
color: MeshPalette.magenta,
|
||||
size: 44,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
community.name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
context.l10n.community_shortId(
|
||||
community.shortCommunityId,
|
||||
),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 13,
|
||||
color: joinScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
MeshCard(
|
||||
child: Row(
|
||||
children: [
|
||||
AvatarCircle(
|
||||
name: community.name,
|
||||
icon: Icons.groups,
|
||||
color: MeshPalette.magenta,
|
||||
size: 44,
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
community.name,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
context.l10n.community_shortId(
|
||||
community.shortCommunityId,
|
||||
),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 13,
|
||||
color: joinScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
CheckboxListTile(
|
||||
value: addPublicChannel,
|
||||
onChanged: (value) {
|
||||
setSheetState(() {
|
||||
addPublicChannel = value ?? true;
|
||||
});
|
||||
},
|
||||
title: Text(context.l10n.community_addPublicChannel),
|
||||
subtitle: Text(context.l10n.community_addPublicChannelHint),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: () {
|
||||
completer.complete(false);
|
||||
Navigator.pop(sheetContext);
|
||||
},
|
||||
child: Text(context.l10n.common_cancel),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: FilledButton(
|
||||
onPressed: () {
|
||||
completer.complete(true);
|
||||
Navigator.pop(sheetContext);
|
||||
},
|
||||
child: Text(context.l10n.community_join),
|
||||
),
|
||||
),
|
||||
],
|
||||
CheckboxListTile(
|
||||
value: addPublicChannel,
|
||||
onChanged: (value) {
|
||||
setSheetState(() {
|
||||
addPublicChannel = value ?? true;
|
||||
});
|
||||
},
|
||||
title: Text(context.l10n.community_addPublicChannel),
|
||||
subtitle: Text(context.l10n.community_addPublicChannelHint),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
),
|
||||
),
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: () {
|
||||
completer.complete(false);
|
||||
Navigator.pop(sheetContext);
|
||||
},
|
||||
child: Text(context.l10n.common_cancel),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: FilledButton(
|
||||
onPressed: () {
|
||||
completer.complete(true);
|
||||
Navigator.pop(sheetContext);
|
||||
},
|
||||
child: Text(context.l10n.community_join),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
+287
-261
@@ -1,4 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -544,46 +545,48 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.contacts_title),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.paste),
|
||||
title: Text(context.l10n.contacts_addContactFromClipboard),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactImport();
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.qr_code_scanner),
|
||||
title: Text(context.l10n.contacts_scanQrCode),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ContactQrScannerScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.person_add_rounded),
|
||||
title: Text(context.l10n.discoveredContacts_Title),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const DiscoveryScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(title: context.l10n.contacts_title),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.paste),
|
||||
title: Text(context.l10n.contacts_addContactFromClipboard),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactImport();
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.qr_code_scanner),
|
||||
title: Text(context.l10n.contacts_scanQrCode),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ContactQrScannerScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.person_add_rounded),
|
||||
title: Text(context.l10n.discoveredContacts_Title),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const DiscoveryScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -915,6 +918,23 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
120.0,
|
||||
); //two 48px icon buttons + 1px divider
|
||||
|
||||
// Scrolls with the list rather than staying pinned above it, so large
|
||||
// text or an open keyboard on a short screen can't squeeze the list out.
|
||||
final discoveredTile = ListTile(
|
||||
dense: true,
|
||||
leading: const Icon(Icons.person_add_rounded),
|
||||
title: Text(
|
||||
context.l10n.contacts_discoveredNearby(
|
||||
connector.discoveredContacts.where((c) => !c.isActive).length,
|
||||
),
|
||||
),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const DiscoveryScreen()),
|
||||
),
|
||||
);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
@@ -1038,20 +1058,6 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
],
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
dense: true,
|
||||
leading: const Icon(Icons.person_add_rounded),
|
||||
title: Text(
|
||||
context.l10n.contacts_discoveredNearby(
|
||||
connector.discoveredContacts.where((c) => !c.isActive).length,
|
||||
),
|
||||
),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const DiscoveryScreen()),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => connector.getContacts(),
|
||||
@@ -1060,9 +1066,13 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
builder: (context, constraints) => ListView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
children: [
|
||||
discoveredTile,
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight,
|
||||
minHeight: math.max(
|
||||
0,
|
||||
constraints.maxHeight - kMinInteractiveDimension,
|
||||
),
|
||||
),
|
||||
child: EmptyState(
|
||||
icon: Icons.search_off,
|
||||
@@ -1076,8 +1086,10 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.only(bottom: 88),
|
||||
itemCount: filteredAndSorted.length,
|
||||
itemBuilder: (context, index) {
|
||||
itemCount: filteredAndSorted.length + 1,
|
||||
itemBuilder: (context, row) {
|
||||
if (row == 0) return discoveredTile;
|
||||
final index = row - 1;
|
||||
final contact = filteredAndSorted[index];
|
||||
final unreadCount = connector.getUnreadCountForContact(
|
||||
contact,
|
||||
@@ -1561,98 +1573,18 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
showMeshSheet(
|
||||
context,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: contact.name,
|
||||
subtitle: contact.typeLabel(context.l10n),
|
||||
),
|
||||
if (isRepeater) ...[
|
||||
ListTile(
|
||||
leading: Icon(Icons.radar, color: MeshPalette.signal),
|
||||
title: Text(context.l10n.contacts_ping),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final hw = context
|
||||
.read<MeshCoreConnector>()
|
||||
.pathHashByteWidth;
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PathTraceMapScreen(
|
||||
title: context.l10n.contacts_repeaterPing,
|
||||
path: contact.pathBytesForDisplay.isNotEmpty
|
||||
? contact.pathBytesForDisplay
|
||||
: _contactPathPrefix(contact, hw),
|
||||
flipPathAround: true,
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: contact.name,
|
||||
subtitle: contact.typeLabel(context.l10n),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.cell_tower, color: MeshPalette.warn),
|
||||
title: Text(context.l10n.contacts_manageRepeater),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRepeaterLogin(context, contact);
|
||||
},
|
||||
),
|
||||
] else if (isRoom) ...[
|
||||
ListTile(
|
||||
leading: Icon(Icons.radar, color: MeshPalette.signal),
|
||||
title: Text(context.l10n.contacts_pathTrace),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final hw = context
|
||||
.read<MeshCoreConnector>()
|
||||
.pathHashByteWidth;
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PathTraceMapScreen(
|
||||
title: contact.pathBytesForDisplay.isNotEmpty
|
||||
? context.l10n.contacts_roomPathTrace
|
||||
: context.l10n.contacts_roomPing,
|
||||
path: contact.pathBytesForDisplay.isNotEmpty
|
||||
? contact.pathBytesForDisplay
|
||||
: _contactPathPrefix(contact, hw),
|
||||
flipPathAround: true,
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.meeting_room, color: MeshPalette.blue),
|
||||
title: Text(context.l10n.contacts_roomLogin),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRoomLogin(context, contact, RoomLoginDestination.chat);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.room_preferences, color: MeshPalette.warn),
|
||||
title: Text(context.l10n.room_management),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRoomLogin(
|
||||
context,
|
||||
contact,
|
||||
RoomLoginDestination.management,
|
||||
);
|
||||
},
|
||||
),
|
||||
] else ...[
|
||||
if (contact.pathLength > 0)
|
||||
if (isRepeater) ...[
|
||||
ListTile(
|
||||
leading: Icon(Icons.radar, color: MeshPalette.signal),
|
||||
title: Text(context.l10n.contacts_chatTraceRoute),
|
||||
title: Text(context.l10n.contacts_ping),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final hw = context
|
||||
@@ -1662,10 +1594,10 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PathTraceMapScreen(
|
||||
title: context.l10n.contacts_pathTraceTo(
|
||||
contact.name,
|
||||
),
|
||||
path: contact.pathBytesForDisplay,
|
||||
title: context.l10n.contacts_repeaterPing,
|
||||
path: contact.pathBytesForDisplay.isNotEmpty
|
||||
? contact.pathBytesForDisplay
|
||||
: _contactPathPrefix(contact, hw),
|
||||
flipPathAround: true,
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
@@ -1674,57 +1606,142 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.cell_tower, color: MeshPalette.warn),
|
||||
title: Text(context.l10n.contacts_manageRepeater),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRepeaterLogin(context, contact);
|
||||
},
|
||||
),
|
||||
] else if (isRoom) ...[
|
||||
ListTile(
|
||||
leading: Icon(Icons.radar, color: MeshPalette.signal),
|
||||
title: Text(context.l10n.contacts_pathTrace),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final hw = context
|
||||
.read<MeshCoreConnector>()
|
||||
.pathHashByteWidth;
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PathTraceMapScreen(
|
||||
title: contact.pathBytesForDisplay.isNotEmpty
|
||||
? context.l10n.contacts_roomPathTrace
|
||||
: context.l10n.contacts_roomPing,
|
||||
path: contact.pathBytesForDisplay.isNotEmpty
|
||||
? contact.pathBytesForDisplay
|
||||
: _contactPathPrefix(contact, hw),
|
||||
flipPathAround: true,
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.meeting_room, color: MeshPalette.blue),
|
||||
title: Text(context.l10n.contacts_roomLogin),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRoomLogin(context, contact, RoomLoginDestination.chat);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.room_preferences,
|
||||
color: MeshPalette.warn,
|
||||
),
|
||||
title: Text(context.l10n.room_management),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_showRoomLogin(
|
||||
context,
|
||||
contact,
|
||||
RoomLoginDestination.management,
|
||||
);
|
||||
},
|
||||
),
|
||||
] else ...[
|
||||
if (contact.pathLength > 0)
|
||||
ListTile(
|
||||
leading: Icon(Icons.radar, color: MeshPalette.signal),
|
||||
title: Text(context.l10n.contacts_chatTraceRoute),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
final hw = context
|
||||
.read<MeshCoreConnector>()
|
||||
.pathHashByteWidth;
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PathTraceMapScreen(
|
||||
title: context.l10n.contacts_pathTraceTo(
|
||||
contact.name,
|
||||
),
|
||||
path: contact.pathBytesForDisplay,
|
||||
flipPathAround: true,
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
isFavorite ? Icons.star : Icons.star_border,
|
||||
color: MeshPalette.warn,
|
||||
),
|
||||
title: Text(
|
||||
isFavorite
|
||||
? context.l10n.listFilter_removeFromFavorites
|
||||
: context.l10n.listFilter_addToFavorites,
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await connector.setContactFlags(
|
||||
contact,
|
||||
isFavorite: !isFavorite,
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.contacts_ShareContact),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactExport(contact.publicKey);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.connect_without_contact),
|
||||
title: Text(context.l10n.contacts_ShareContactZeroHop),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactZeroHop(contact.publicKey);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.contacts_removeFromContacts,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_confirmDelete(context, connector, contact);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
isFavorite ? Icons.star : Icons.star_border,
|
||||
color: MeshPalette.warn,
|
||||
),
|
||||
title: Text(
|
||||
isFavorite
|
||||
? context.l10n.listFilter_removeFromFavorites
|
||||
: context.l10n.listFilter_addToFavorites,
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await connector.setContactFlags(
|
||||
contact,
|
||||
isFavorite: !isFavorite,
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(context.l10n.contacts_ShareContact),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactExport(contact.publicKey);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.connect_without_contact),
|
||||
title: Text(context.l10n.contacts_ShareContactZeroHop),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_contactZeroHop(contact.publicKey);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.delete,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
context.l10n.contacts_removeFromContacts,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
_confirmDelete(context, connector, contact);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1750,6 +1767,7 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
context: context,
|
||||
builder: (dialogContext) => StatefulBuilder(
|
||||
builder: (dialogContext, setDialogState) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(context.l10n.contacts_removeFromContacts),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -1871,45 +1889,61 @@ class _ContactTile extends StatelessWidget {
|
||||
icon: contactTypeIcon(contact.type),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
// Main content
|
||||
// Main content. The name owns the whole first row (wrapping to
|
||||
// a second line if needed); last-seen and the route share the row
|
||||
// below so long names stay readable on narrow screens and large
|
||||
// text scales.
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// Name row + route chip
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
contact.name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: unreadCount > 0
|
||||
? FontWeight.w700
|
||||
: FontWeight.w500,
|
||||
fontSize: 15,
|
||||
color: scheme.onSurface,
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
text: contact.name,
|
||||
children: [
|
||||
if (isFavorite)
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
start: 4,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.star,
|
||||
size: 16,
|
||||
color: MeshPalette.warn,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (contact.hasLocation)
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
start: 4,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.location_on,
|
||||
size: 16,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (isFavorite) ...[
|
||||
const SizedBox(width: 4),
|
||||
Icon(Icons.star, size: 16, color: MeshPalette.warn),
|
||||
],
|
||||
if (contact.hasLocation) ...[
|
||||
const SizedBox(width: 4),
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
size: 16,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: unreadCount > 0
|
||||
? FontWeight.w700
|
||||
: FontWeight.w500,
|
||||
fontSize: 15,
|
||||
color: scheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
// Key prefix + path / subtitle row
|
||||
// Key prefix + path + last seen
|
||||
Row(
|
||||
children: [
|
||||
_KeyPrefixBadge(
|
||||
@@ -1917,6 +1951,7 @@ class _ContactTile extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
contact.pathLabel(
|
||||
context.l10n,
|
||||
@@ -1930,42 +1965,33 @@ class _ContactTile extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
// Fills its share and right-aligns, so the time sits at
|
||||
// the row's end on wide screens too.
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
formatContactLastSeen(context.l10n, lastSeen),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.end,
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 12.5,
|
||||
color: unreadCount > 0
|
||||
? MeshPalette.blue
|
||||
: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
// Trailing: time + unread badge. A width cap + wrapping keeps
|
||||
// large text scales from overflowing without clamping them.
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: MediaQuery.sizeOf(context).width * 0.25,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (unreadCount > 0) ...[
|
||||
UnreadBadge(count: unreadCount),
|
||||
const SizedBox(height: 4),
|
||||
],
|
||||
Text(
|
||||
formatContactLastSeen(context.l10n, lastSeen),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.right,
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 12.5,
|
||||
color: unreadCount > 0
|
||||
? MeshPalette.blue
|
||||
: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (unreadCount > 0) ...[
|
||||
const SizedBox(width: 10),
|
||||
UnreadBadge(count: unreadCount),
|
||||
],
|
||||
if (onManage != null)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.admin_panel_settings_outlined),
|
||||
|
||||
@@ -345,25 +345,27 @@ class _DiscoveryScreenState extends State<DiscoveryScreen> {
|
||||
builder: (sheetContext) {
|
||||
final l10n = context.l10n;
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: contact.name,
|
||||
subtitle: contact.typeLabel(l10n),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(l10n.discoveredContacts_copyContact),
|
||||
onTap: () => Navigator.of(sheetContext).pop('copy_contact'),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete),
|
||||
title: Text(l10n.discoveredContacts_deleteContact),
|
||||
onTap: () => Navigator.of(sheetContext).pop('delete_contact'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BottomSheetHeader(
|
||||
title: contact.name,
|
||||
subtitle: contact.typeLabel(l10n),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.copy),
|
||||
title: Text(l10n.discoveredContacts_copyContact),
|
||||
onTap: () => Navigator.of(sheetContext).pop('copy_contact'),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete),
|
||||
title: Text(l10n.discoveredContacts_deleteContact),
|
||||
onTap: () => Navigator.of(sheetContext).pop('delete_contact'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -735,15 +735,22 @@ class _MapCacheScreenState extends State<MapCacheScreen> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: MeshPalette.alert,
|
||||
side: const BorderSide(
|
||||
color: MeshPalette.alertLine,
|
||||
// Flexible lets the label wrap instead of pushing
|
||||
// the row past the screen edge at large text sizes.
|
||||
Flexible(
|
||||
child: OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: MeshPalette.alert,
|
||||
side: const BorderSide(
|
||||
color: MeshPalette.alertLine,
|
||||
),
|
||||
),
|
||||
onPressed: _isDownloading ? null : _clearCache,
|
||||
child: Text(
|
||||
l10n.mapCache_clearCacheButton,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
onPressed: _isDownloading ? null : _clearCache,
|
||||
child: Text(l10n.mapCache_clearCacheButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -180,9 +180,11 @@ class _RegionManagementScreenState extends State<RegionManagementScreen> {
|
||||
child: DropdownButtonFormField<Region>(
|
||||
key: ValueKey(current),
|
||||
initialValue: current,
|
||||
isExpanded: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.settings_regionDefault,
|
||||
helperText: l10n.settings_regionDefaultSubtitle,
|
||||
helperMaxLines: 3,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
items: [
|
||||
@@ -192,15 +194,22 @@ class _RegionManagementScreenState extends State<RegionManagementScreen> {
|
||||
radioDefault == null
|
||||
? l10n.settings_regionDefaultNone
|
||||
: l10n.settings_regionUseRadioDefault(radioDefault),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (canForceUnscoped)
|
||||
DropdownMenuItem(
|
||||
value: kUnscopedRegion,
|
||||
child: Text(l10n.settings_regionNoRegion),
|
||||
child: Text(
|
||||
l10n.settings_regionNoRegion,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
for (final region in _regions)
|
||||
DropdownMenuItem(value: region, child: Text(region)),
|
||||
DropdownMenuItem(
|
||||
value: region,
|
||||
child: Text(region, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
],
|
||||
onChanged: (value) => connector.setDefaultRegion(value ?? ''),
|
||||
),
|
||||
@@ -222,6 +231,7 @@ class _RegionManagementScreenState extends State<RegionManagementScreen> {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 8),
|
||||
child: DropdownButtonFormField<Region>(
|
||||
isExpanded: true,
|
||||
key: ValueKey('radio-default-$radioDefault'),
|
||||
initialValue: radioDefault,
|
||||
decoration: InputDecoration(
|
||||
@@ -233,10 +243,16 @@ class _RegionManagementScreenState extends State<RegionManagementScreen> {
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: '',
|
||||
child: Text(l10n.settings_regionDefaultNone),
|
||||
child: Text(
|
||||
l10n.settings_regionDefaultNone,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
for (final region in options)
|
||||
DropdownMenuItem(value: region, child: Text(region)),
|
||||
DropdownMenuItem(
|
||||
value: region,
|
||||
child: Text(region, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
],
|
||||
onChanged: (value) => _setRadioDefaultRegion(connector, value ?? ''),
|
||||
),
|
||||
|
||||
@@ -471,7 +471,6 @@ class _RepeaterCliScreenState extends State<RepeaterCliScreen> {
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
const RadioDisconnectedBanner(),
|
||||
// Quick commands bar
|
||||
Container(
|
||||
color: scheme.surfaceContainer,
|
||||
@@ -506,10 +505,29 @@ class _RepeaterCliScreenState extends State<RepeaterCliScreen> {
|
||||
Divider(height: 1, color: scheme.outlineVariant),
|
||||
|
||||
// Output area
|
||||
// The disconnected banner lives in the output area and is capped at
|
||||
// half of it, so large text or an open keyboard can't push the
|
||||
// command input off screen.
|
||||
Expanded(
|
||||
child: _commandHistory.isEmpty
|
||||
? _buildEmptyState()
|
||||
: _buildCommandHistory(),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => Column(
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: constraints.maxHeight / 2,
|
||||
),
|
||||
child: const SingleChildScrollView(
|
||||
child: RadioDisconnectedBanner(),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _commandHistory.isEmpty
|
||||
? _buildEmptyState()
|
||||
: _buildCommandHistory(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Divider(height: 1, color: scheme.outlineVariant),
|
||||
@@ -616,10 +634,10 @@ class _RepeaterCliScreenState extends State<RepeaterCliScreen> {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
return Center(
|
||||
child: Padding(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.terminal, size: 48, color: scheme.onSurfaceVariant),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
@@ -1411,14 +1411,21 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: MeshCard(
|
||||
child: Row(
|
||||
// The button sits under the message so neither is
|
||||
// squeezed on narrow screens or large text.
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
const Icon(Icons.info_outline, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
context.l10n.repeater_settingsNotLoaded,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.info_outline, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
context.l10n.repeater_settingsNotLoaded,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TextButton(
|
||||
onPressed: _isLoading || !connected
|
||||
@@ -1626,12 +1633,16 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: _bandwidth,
|
||||
decoration: InputDecoration(labelText: l10n.repeater_bandwidth),
|
||||
items: _bandwidthOptions.map((bw) {
|
||||
return DropdownMenuItem(
|
||||
value: bw,
|
||||
child: Text(_formatBandwidthLabel(bw)),
|
||||
child: Text(
|
||||
_formatBandwidthLabel(bw),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: !_loaded('radio')
|
||||
@@ -1647,12 +1658,16 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: _spreadingFactor,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.repeater_spreadingFactor,
|
||||
),
|
||||
items: _spreadingFactorOptions.map((sf) {
|
||||
return DropdownMenuItem(value: sf, child: Text('SF$sf'));
|
||||
return DropdownMenuItem(
|
||||
value: sf,
|
||||
child: Text('SF$sf', overflow: TextOverflow.ellipsis),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: !_loaded('radio')
|
||||
? null
|
||||
@@ -1667,12 +1682,16 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: _codingRate,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.repeater_codingRate,
|
||||
),
|
||||
items: _codingRateOptions.map((cr) {
|
||||
return DropdownMenuItem(value: cr, child: Text('4/$cr'));
|
||||
return DropdownMenuItem(
|
||||
value: cr,
|
||||
child: Text('4/$cr', overflow: TextOverflow.ellipsis),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: !_loaded('radio')
|
||||
? null
|
||||
@@ -2122,6 +2141,7 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: DropdownButtonFormField<String>(
|
||||
isExpanded: true,
|
||||
initialValue: _loaded('loop.detect') ? _loopDetect : null,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.repeater_loopDetect,
|
||||
@@ -2131,19 +2151,31 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: 'off',
|
||||
child: Text(l10n.repeater_loopDetectOff),
|
||||
child: Text(
|
||||
l10n.repeater_loopDetectOff,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'minimal',
|
||||
child: Text(l10n.repeater_loopDetectMinimal),
|
||||
child: Text(
|
||||
l10n.repeater_loopDetectMinimal,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'moderate',
|
||||
child: Text(l10n.repeater_loopDetectModerate),
|
||||
child: Text(
|
||||
l10n.repeater_loopDetectModerate,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'strict',
|
||||
child: Text(l10n.repeater_loopDetectStrict),
|
||||
child: Text(
|
||||
l10n.repeater_loopDetectStrict,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: !_loaded('loop.detect')
|
||||
@@ -2322,6 +2354,7 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: _loaded('path.hash.mode')
|
||||
? _pathHashMode
|
||||
: null,
|
||||
@@ -2333,15 +2366,24 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: 0,
|
||||
child: Text(l10n.repeater_pathHashModeOption0),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption0,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 1,
|
||||
child: Text(l10n.repeater_pathHashModeOption1),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 2,
|
||||
child: Text(l10n.repeater_pathHashModeOption2),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: !_loaded('path.hash.mode')
|
||||
|
||||
@@ -705,25 +705,38 @@ class _RepeaterStatusScreenState extends State<RepeaterStatusScreen> {
|
||||
final columns = constraints.maxWidth / textScaler.scale(1) < 320
|
||||
? 1
|
||||
: 2;
|
||||
return GridView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: items.length,
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: columns,
|
||||
mainAxisSpacing: 8,
|
||||
crossAxisSpacing: 8,
|
||||
mainAxisExtent: textScaler.scale(52) + 28,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final item = items[index];
|
||||
return StatTile(
|
||||
icon: item.icon,
|
||||
label: item.label,
|
||||
value: item.value,
|
||||
color: item.color,
|
||||
);
|
||||
},
|
||||
// Rows size to their tallest tile, so labels that wrap at large
|
||||
// text scales grow the row instead of overflowing a fixed extent.
|
||||
Widget tile(_StatItem item) => StatTile(
|
||||
icon: item.icon,
|
||||
label: item.label,
|
||||
value: item.value,
|
||||
color: item.color,
|
||||
);
|
||||
return Column(
|
||||
children: [
|
||||
for (var i = 0; i < items.length; i += columns)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: i + columns < items.length ? 8 : 0,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
for (var j = 0; j < columns; j++) ...[
|
||||
if (j > 0) const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: i + j < items.length
|
||||
? tile(items[i + j])
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -805,12 +805,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
context: context,
|
||||
builder: (dialogContext) => StatefulBuilder(
|
||||
builder: (builderContext, setDialogState) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(l10n.repeater_pathHashMode),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: selectedMode,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.repeater_pathHashMode,
|
||||
@@ -819,15 +821,24 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: 0,
|
||||
child: Text(l10n.repeater_pathHashModeOption0),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption0,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 1,
|
||||
child: Text(l10n.repeater_pathHashModeOption1),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 2,
|
||||
child: Text(l10n.repeater_pathHashModeOption2),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
|
||||
@@ -36,28 +36,32 @@ void showChannelNotificationModeSheet(BuildContext context, String muteKey) {
|
||||
builder: (sheetContext) {
|
||||
final scheme = Theme.of(sheetContext).colorScheme;
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
for (final mode in ChannelNotificationMode.values)
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
channelNotificationModeIcon(mode),
|
||||
color: mode == currentMode
|
||||
? scheme.primary
|
||||
: scheme.onSurfaceVariant,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
for (final mode in ChannelNotificationMode.values)
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
channelNotificationModeIcon(mode),
|
||||
color: mode == currentMode
|
||||
? scheme.primary
|
||||
: scheme.onSurfaceVariant,
|
||||
),
|
||||
title: Text(channelNotificationModeLabel(sheetContext, mode)),
|
||||
trailing: mode == currentMode
|
||||
? const Icon(Icons.check)
|
||||
: null,
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await settingsService.setChannelNotificationMode(
|
||||
muteKey,
|
||||
mode,
|
||||
);
|
||||
},
|
||||
),
|
||||
title: Text(channelNotificationModeLabel(sheetContext, mode)),
|
||||
trailing: mode == currentMode ? const Icon(Icons.check) : null,
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await settingsService.setChannelNotificationMode(
|
||||
muteKey,
|
||||
mode,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -55,56 +55,70 @@ class _EmptyStateState extends State<EmptyState>
|
||||
begin: const Offset(0, 0.06),
|
||||
end: Offset.zero,
|
||||
).animate(_curve),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: scheme.primary.withValues(alpha: 0.08),
|
||||
border: Border.all(
|
||||
color: scheme.primary.withValues(alpha: 0.18),
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
child: Icon(
|
||||
widget.icon,
|
||||
size: 36,
|
||||
color: scheme.onSurfaceVariant,
|
||||
// Scrolls instead of overflowing when a short screen or a large text
|
||||
// scale makes the content taller than the space it gets.
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.hasBoundedHeight
|
||||
? constraints.maxHeight
|
||||
: 0,
|
||||
),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: scheme.primary.withValues(alpha: 0.08),
|
||||
border: Border.all(
|
||||
color: scheme.primary.withValues(alpha: 0.18),
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
child: Icon(
|
||||
widget.icon,
|
||||
size: 36,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
widget.title,
|
||||
style: Theme.of(context).textTheme.titleMedium
|
||||
?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: scheme.onSurface,
|
||||
letterSpacing: -0.1,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (widget.subtitle != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
widget.subtitle!,
|
||||
style: TextStyle(
|
||||
fontSize: 13.5,
|
||||
color: scheme.onSurfaceVariant,
|
||||
height: 1.45,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
if (widget.action != null) ...[
|
||||
const SizedBox(height: 28),
|
||||
widget.action!,
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
widget.title,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: scheme.onSurface,
|
||||
letterSpacing: -0.1,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (widget.subtitle != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
widget.subtitle!,
|
||||
style: TextStyle(
|
||||
fontSize: 13.5,
|
||||
color: scheme.onSurfaceVariant,
|
||||
height: 1.45,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
if (widget.action != null) ...[
|
||||
const SizedBox(height: 28),
|
||||
widget.action!,
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../l10n/app_localizations.dart';
|
||||
@@ -55,7 +57,8 @@ void showLanguagePickerSheet(
|
||||
children: [
|
||||
BottomSheetHeader(title: l10n.appSettings_language),
|
||||
SizedBox(
|
||||
height: 400,
|
||||
// Capped so the sheet still fits short screens and landscape.
|
||||
height: math.min(400, MediaQuery.sizeOf(ctx).height * 0.6),
|
||||
child: ListView(
|
||||
children: [
|
||||
for (final (code, label) in appLanguageOptions)
|
||||
|
||||
@@ -645,6 +645,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
DropdownButtonFormField<LoRaBandwidth>(
|
||||
isExpanded: true,
|
||||
initialValue: _bandwidth,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.settings_bandwidth,
|
||||
@@ -652,7 +653,10 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
items: LoRaBandwidth.values
|
||||
.map(
|
||||
(bw) => DropdownMenuItem(value: bw, child: Text(bw.label)),
|
||||
(bw) => DropdownMenuItem(
|
||||
value: bw,
|
||||
child: Text(bw.label, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (value) {
|
||||
@@ -667,6 +671,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
DropdownButtonFormField<LoRaSpreadingFactor>(
|
||||
isExpanded: true,
|
||||
initialValue: _spreadingFactor,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.settings_spreadingFactor,
|
||||
@@ -674,7 +679,10 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
items: LoRaSpreadingFactor.values
|
||||
.map(
|
||||
(sf) => DropdownMenuItem(value: sf, child: Text(sf.label)),
|
||||
(sf) => DropdownMenuItem(
|
||||
value: sf,
|
||||
child: Text(sf.label, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (value) {
|
||||
@@ -691,6 +699,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
DropdownButtonFormField<LoRaCodingRate>(
|
||||
isExpanded: true,
|
||||
initialValue: _codingRate,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.settings_codingRate,
|
||||
@@ -698,7 +707,10 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
),
|
||||
items: LoRaCodingRate.values
|
||||
.map(
|
||||
(cr) => DropdownMenuItem(value: cr, child: Text(cr.label)),
|
||||
(cr) => DropdownMenuItem(
|
||||
value: cr,
|
||||
child: Text(cr.label, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (value) {
|
||||
@@ -716,6 +728,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
// Values are path hash modes (0-2, byte width - 1), matching
|
||||
// the selectors in settings_screen and repeater_settings_screen.
|
||||
DropdownButtonFormField<int>(
|
||||
isExpanded: true,
|
||||
initialValue: (_pathHashByteWidth - 1).clamp(0, 2).toInt(),
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.repeater_pathHashMode,
|
||||
@@ -726,15 +739,24 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
||||
items: [
|
||||
DropdownMenuItem(
|
||||
value: 0,
|
||||
child: Text(l10n.repeater_pathHashModeOption0),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption0,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 1,
|
||||
child: Text(l10n.repeater_pathHashModeOption1),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 2,
|
||||
child: Text(l10n.repeater_pathHashModeOption2),
|
||||
child: Text(
|
||||
l10n.repeater_pathHashModeOption2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
|
||||
@@ -313,6 +313,7 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(l10n.chat_fullPath),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -0,0 +1,315 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:provider/single_child_widget.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'package:meshcore_open/connector/meshcore_connector.dart';
|
||||
import 'package:meshcore_open/connector/meshcore_protocol.dart';
|
||||
import 'package:meshcore_open/l10n/app_localizations.dart';
|
||||
import 'package:meshcore_open/models/contact.dart';
|
||||
import 'package:meshcore_open/review_mode/review_radio.dart';
|
||||
import 'package:meshcore_open/screens/app_debug_log_screen.dart';
|
||||
import 'package:meshcore_open/screens/app_settings_screen.dart';
|
||||
import 'package:meshcore_open/screens/ble_debug_log_screen.dart';
|
||||
import 'package:meshcore_open/screens/channel_chat_screen.dart';
|
||||
import 'package:meshcore_open/screens/channel_message_path_screen.dart';
|
||||
import 'package:meshcore_open/screens/channels_screen.dart';
|
||||
import 'package:meshcore_open/screens/chat_screen.dart';
|
||||
import 'package:meshcore_open/screens/chrome_required_screen.dart';
|
||||
import 'package:meshcore_open/screens/companion_radio_stats_screen.dart';
|
||||
import 'package:meshcore_open/screens/contacts_screen.dart';
|
||||
import 'package:meshcore_open/screens/discovery_screen.dart';
|
||||
import 'package:meshcore_open/screens/line_of_sight_map_screen.dart';
|
||||
import 'package:meshcore_open/screens/map_cache_screen.dart';
|
||||
import 'package:meshcore_open/screens/map_screen.dart';
|
||||
import 'package:meshcore_open/screens/neighbors_screen.dart';
|
||||
import 'package:meshcore_open/screens/path_trace_map.dart';
|
||||
import 'package:meshcore_open/screens/region_management_screen.dart';
|
||||
import 'package:meshcore_open/screens/repeater_cli_screen.dart';
|
||||
import 'package:meshcore_open/screens/repeater_hub_screen.dart';
|
||||
import 'package:meshcore_open/screens/repeater_settings_screen.dart';
|
||||
import 'package:meshcore_open/screens/repeater_status_screen.dart';
|
||||
import 'package:meshcore_open/screens/scanner_screen.dart';
|
||||
import 'package:meshcore_open/screens/settings_screen.dart';
|
||||
import 'package:meshcore_open/screens/tcp_screen.dart';
|
||||
import 'package:meshcore_open/screens/telemetry_screen.dart';
|
||||
import 'package:meshcore_open/screens/usb_screen.dart';
|
||||
import 'package:meshcore_open/services/app_debug_log_service.dart';
|
||||
import 'package:meshcore_open/services/app_settings_service.dart';
|
||||
import 'package:meshcore_open/services/ble_debug_log_service.dart';
|
||||
import 'package:meshcore_open/services/chat_text_scale_service.dart';
|
||||
import 'package:meshcore_open/services/image_codec_service.dart';
|
||||
import 'package:meshcore_open/services/map_tile_cache_service.dart';
|
||||
import 'package:meshcore_open/services/message_retry_service.dart';
|
||||
import 'package:meshcore_open/services/network_map/network_map_upload_service.dart';
|
||||
import 'package:meshcore_open/services/path_history_service.dart';
|
||||
import 'package:meshcore_open/services/received_image_store.dart';
|
||||
import 'package:meshcore_open/services/storage_service.dart';
|
||||
import 'package:meshcore_open/services/timeout_prediction_service.dart';
|
||||
import 'package:meshcore_open/services/translation_service.dart';
|
||||
import 'package:meshcore_open/services/ui_view_state_service.dart';
|
||||
import 'package:meshcore_open/storage/prefs_manager.dart';
|
||||
import 'package:meshcore_open/theme/mesh_theme.dart';
|
||||
|
||||
/// Renders every screen on a small phone (320x568, the narrowest common
|
||||
/// width) at several text scales, plus a desktop window, and fails on any
|
||||
/// layout overflow.
|
||||
const _layouts = [
|
||||
(Size(320, 568), [1.0, 1.3, 2.0]),
|
||||
(Size(1280, 800), [1.0]),
|
||||
];
|
||||
|
||||
class _Env {
|
||||
final MeshCoreConnector connector;
|
||||
final List<SingleChildWidget> providers;
|
||||
_Env(this.connector, this.providers);
|
||||
}
|
||||
|
||||
Future<_Env> _connect(WidgetTester tester) async {
|
||||
final storage = StorageService();
|
||||
final connector = MeshCoreConnector();
|
||||
final retry = MessageRetryService();
|
||||
final settings = AppSettingsService();
|
||||
final translation = TranslationService(settings);
|
||||
final env = _Env(connector, [
|
||||
ChangeNotifierProvider.value(value: connector),
|
||||
ChangeNotifierProvider.value(value: retry),
|
||||
ChangeNotifierProvider.value(value: PathHistoryService(storage)),
|
||||
ChangeNotifierProvider.value(value: settings),
|
||||
ChangeNotifierProvider.value(value: BleDebugLogService()),
|
||||
ChangeNotifierProvider.value(value: AppDebugLogService()),
|
||||
ChangeNotifierProvider.value(value: ChatTextScaleService()),
|
||||
ChangeNotifierProvider.value(value: translation),
|
||||
ChangeNotifierProvider.value(value: UiViewStateService()),
|
||||
Provider.value(value: storage),
|
||||
ChangeNotifierProvider.value(
|
||||
value: MapTileCacheService(appSettingsService: settings),
|
||||
),
|
||||
ChangeNotifierProvider.value(value: TimeoutPredictionService(storage)),
|
||||
ChangeNotifierProvider.value(value: ImageCodecService(settings)),
|
||||
ChangeNotifierProvider.value(value: ReceivedImageStore()),
|
||||
ChangeNotifierProvider.value(
|
||||
value: NetworkMapUploadService(connector: connector, settings: settings),
|
||||
),
|
||||
]);
|
||||
await tester.runAsync(() async {
|
||||
await settings.loadSettings();
|
||||
connector.initialize(
|
||||
retryService: retry,
|
||||
pathHistoryService: PathHistoryService(storage),
|
||||
appSettingsService: settings,
|
||||
translationService: translation,
|
||||
);
|
||||
connector.reviewRadioFactoryForTest = () => ReviewRadio(
|
||||
scheduledMessageInterval: const Duration(hours: 1),
|
||||
ackDelay: const Duration(hours: 1),
|
||||
replyDelay: const Duration(hours: 1),
|
||||
);
|
||||
await connector.connectReview();
|
||||
final end = DateTime.now().add(const Duration(seconds: 8));
|
||||
while ((connector.contacts.isEmpty || connector.channels.isEmpty) &&
|
||||
DateTime.now().isBefore(end)) {
|
||||
await Future<void>.delayed(const Duration(milliseconds: 25));
|
||||
}
|
||||
});
|
||||
return env;
|
||||
}
|
||||
|
||||
Contact _contactOfType(MeshCoreConnector c, int type) => c.contacts.firstWhere(
|
||||
(x) => x.type == type,
|
||||
orElse: () => c.contacts.first,
|
||||
);
|
||||
|
||||
_Env? _shared;
|
||||
|
||||
typedef _ScreenBuilder = Widget Function(MeshCoreConnector c);
|
||||
|
||||
/// Screens that open a sheet after the first frame, keyed like [_screens].
|
||||
final Map<String, Future<void> Function(WidgetTester t, MeshCoreConnector c)>
|
||||
_interactions = {
|
||||
'Contacts options sheet': (t, _) async {
|
||||
// At large text the first contact can start below the fold.
|
||||
await t.drag(find.byType(RefreshIndicator), const Offset(0, -150));
|
||||
await t.pump(const Duration(milliseconds: 500));
|
||||
await t.longPress(
|
||||
find
|
||||
.byWidgetPredicate((w) => w.runtimeType.toString() == '_ContactTile')
|
||||
.first,
|
||||
);
|
||||
},
|
||||
'Contacts add sheet': (t, _) async {
|
||||
await t.tap(find.byType(FloatingActionButton));
|
||||
},
|
||||
};
|
||||
|
||||
final Map<String, _ScreenBuilder> _screens = {
|
||||
'Contacts options sheet': (_) => const ContactsScreen(),
|
||||
'Contacts add sheet': (_) => const ContactsScreen(),
|
||||
'Scanner': (_) => const ScannerScreen(),
|
||||
'Tcp': (_) => const TcpScreen(),
|
||||
'Usb': (_) => const UsbScreen(),
|
||||
'ChromeRequired': (_) => const ChromeRequiredScreen(),
|
||||
'Contacts': (_) => const ContactsScreen(),
|
||||
'Channels': (_) => const ChannelsScreen(),
|
||||
'Settings': (_) => const SettingsScreen(),
|
||||
'AppSettings': (_) => const AppSettingsScreen(),
|
||||
'Discovery': (_) => const DiscoveryScreen(),
|
||||
'RegionManagement': (_) => const RegionManagementScreen(),
|
||||
'MapCache': (_) => const MapCacheScreen(),
|
||||
'CompanionRadioStats': (_) => const CompanionRadioStatsScreen(),
|
||||
'AppDebugLog': (_) => const AppDebugLogScreen(),
|
||||
'BleDebugLog': (_) => const BleDebugLogScreen(),
|
||||
'Map': (_) => const MapScreen(),
|
||||
'Chat': (c) => ChatScreen(contact: _contactOfType(c, advTypeChat)),
|
||||
'ChannelChat': (c) => ChannelChatScreen(channel: c.channels.first),
|
||||
'ChannelMessagePath': (c) {
|
||||
final msgs = c.getChannelMessages(c.channels.first);
|
||||
return ChannelMessagePathScreen(message: msgs.last);
|
||||
},
|
||||
'Telemetry': (c) => TelemetryScreen(contact: _contactOfType(c, advTypeChat)),
|
||||
'RepeaterHub': (c) => RepeaterHubScreen(
|
||||
repeater: _contactOfType(c, advTypeRepeater),
|
||||
password: '',
|
||||
isAdmin: true,
|
||||
),
|
||||
'RepeaterStatus': (c) => RepeaterStatusScreen(
|
||||
repeater: _contactOfType(c, advTypeRepeater),
|
||||
password: '',
|
||||
),
|
||||
'RepeaterSettings': (c) => RepeaterSettingsScreen(
|
||||
repeater: _contactOfType(c, advTypeRepeater),
|
||||
password: '',
|
||||
),
|
||||
'RepeaterCli': (c) => RepeaterCliScreen(
|
||||
repeater: _contactOfType(c, advTypeRepeater),
|
||||
password: '',
|
||||
),
|
||||
'Neighbors': (c) => NeighborsScreen(
|
||||
repeater: _contactOfType(c, advTypeRepeater),
|
||||
password: '',
|
||||
),
|
||||
'PathTraceMap': (c) {
|
||||
final r = _contactOfType(c, advTypeRepeater);
|
||||
return PathTraceMapScreen(
|
||||
title: 'Trace',
|
||||
path: r.publicKey.sublist(0, 1),
|
||||
targetContact: r,
|
||||
);
|
||||
},
|
||||
'LineOfSightMap': (_) => const LineOfSightMapScreen(
|
||||
title: 'Line of sight',
|
||||
candidates: [
|
||||
LineOfSightEndpoint(label: 'A', point: LatLng(45.5, -122.6)),
|
||||
LineOfSightEndpoint(label: 'B', point: LatLng(45.6, -122.7)),
|
||||
],
|
||||
),
|
||||
};
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
final tempDir = Directory.systemTemp.createTempSync('small_screen_test');
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
const MethodChannel('plugins.flutter.io/path_provider'),
|
||||
(call) async => tempDir.path,
|
||||
);
|
||||
|
||||
setUpAll(() async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
PrefsManager.reset();
|
||||
await PrefsManager.initialize();
|
||||
});
|
||||
|
||||
final variants = [
|
||||
for (final entry in _screens.entries) (entry, false),
|
||||
// Repeater screens add a banner while the companion radio is offline.
|
||||
for (final entry in _screens.entries)
|
||||
if (entry.key.startsWith('Repeater') || entry.key == 'Neighbors')
|
||||
(entry, true),
|
||||
];
|
||||
for (final (entry, offline) in variants) {
|
||||
for (final (size, scales) in _layouts) {
|
||||
for (final scale in scales) {
|
||||
final state = offline ? ' (radio offline)' : '';
|
||||
testWidgets('${entry.key}$state fits ${size.width.toInt()}dp at '
|
||||
'${scale}x', (tester) async {
|
||||
tester.view.physicalSize = size;
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
addTearDown(tester.view.reset);
|
||||
|
||||
final shared = _shared ??= await _connect(tester);
|
||||
final env = offline
|
||||
? _Env(shared.connector, [
|
||||
ChangeNotifierProvider.value(value: MeshCoreConnector()),
|
||||
...shared.providers.skip(1),
|
||||
])
|
||||
: shared;
|
||||
final overflows = <String>[];
|
||||
final previous = FlutterError.onError;
|
||||
FlutterError.onError = (details) {
|
||||
final text = details.exceptionAsString();
|
||||
if (!text.contains('overflowed')) {
|
||||
previous?.call(details);
|
||||
return;
|
||||
}
|
||||
// The creation location names the overflowing Flex in lib/.
|
||||
final where = RegExp(r'lib/[\w/]+\.dart:\d+')
|
||||
.allMatches(details.toString())
|
||||
.map((m) => m[0])
|
||||
.toSet()
|
||||
.join(', ');
|
||||
overflows.add('${text.split('\n').first} at $where');
|
||||
};
|
||||
addTearDown(() => FlutterError.onError = previous);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MultiProvider(
|
||||
providers: env.providers,
|
||||
child: MaterialApp(
|
||||
theme: MeshTheme.light(),
|
||||
locale: const Locale('en'),
|
||||
localizationsDelegates: const [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
builder: (context, child) => MediaQuery(
|
||||
data: MediaQuery.of(
|
||||
context,
|
||||
).copyWith(textScaler: TextScaler.linear(scale)),
|
||||
child: child!,
|
||||
),
|
||||
home: entry.value(env.connector),
|
||||
),
|
||||
),
|
||||
);
|
||||
for (var i = 0; i < 10; i++) {
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
}
|
||||
final interaction = _interactions[entry.key];
|
||||
if (interaction != null) {
|
||||
await interaction(tester, env.connector);
|
||||
for (var i = 0; i < 10; i++) {
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
}
|
||||
}
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
// Let one-shot timers (scan and request timeouts) run out.
|
||||
await tester.pump(const Duration(minutes: 1));
|
||||
|
||||
FlutterError.onError = previous;
|
||||
expect(overflows, isEmpty, reason: overflows.join('\n---\n'));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user