mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-23 02:44:30 +10:00
formatting fixes
This commit is contained in:
@@ -694,7 +694,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
|||||||
try {
|
try {
|
||||||
await FlutterBluePlus.stopScan();
|
await FlutterBluePlus.stopScan();
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await _scanSubscription?.cancel();
|
await _scanSubscription?.cancel();
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
@@ -743,7 +743,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
|||||||
await FlutterBluePlus.startScan(
|
await FlutterBluePlus.startScan(
|
||||||
withServices: [Guid(MeshCoreUuids.service)],
|
withServices: [Guid(MeshCoreUuids.service)],
|
||||||
);
|
);
|
||||||
// On web, the chooser returns once a device is picked, but the scanResults
|
// On web, the chooser returns once a device is picked, but the scanResults
|
||||||
// stream might take a moment to emit the last result. Wait briefly so the
|
// stream might take a moment to emit the last result. Wait briefly so the
|
||||||
// device appears in the UI before stopScan() clears the list.
|
// device appears in the UI before stopScan() clears the list.
|
||||||
await Future.delayed(const Duration(milliseconds: 500));
|
await Future.delayed(const Duration(milliseconds: 500));
|
||||||
@@ -760,7 +760,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
|||||||
debugPrint("Scan error: $e");
|
debugPrint("Scan error: $e");
|
||||||
// On web, suppress common cancellation and chooser errors
|
// On web, suppress common cancellation and chooser errors
|
||||||
if (kIsWeb) return;
|
if (kIsWeb) return;
|
||||||
|
|
||||||
if (!PlatformInfo.isWeb) {
|
if (!PlatformInfo.isWeb) {
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,17 +367,24 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
(message.status == ChannelMessageStatus.sent && displayPath.isNotEmpty)
|
(message.status ==
|
||||||
|
ChannelMessageStatus.sent &&
|
||||||
|
displayPath.isNotEmpty)
|
||||||
? Icons.check_circle
|
? Icons.check_circle
|
||||||
: message.status == ChannelMessageStatus.failed
|
: message.status ==
|
||||||
? Icons.cancel
|
ChannelMessageStatus.failed
|
||||||
: Icons.cloud,
|
? Icons.cancel
|
||||||
|
: Icons.cloud,
|
||||||
size: 14,
|
size: 14,
|
||||||
color: (message.status == ChannelMessageStatus.sent && displayPath.isNotEmpty)
|
color:
|
||||||
|
(message.status ==
|
||||||
|
ChannelMessageStatus.sent &&
|
||||||
|
displayPath.isNotEmpty)
|
||||||
? Colors.green
|
? Colors.green
|
||||||
: message.status == ChannelMessageStatus.failed
|
: message.status ==
|
||||||
? Colors.red
|
ChannelMessageStatus.failed
|
||||||
: Colors.white70,
|
? Colors.red
|
||||||
|
: Colors.white70,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -402,8 +409,10 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
defaultToHttps: false,
|
defaultToHttps: false,
|
||||||
),
|
),
|
||||||
linkifiers: const [UrlLinkifier()],
|
linkifiers: const [UrlLinkifier()],
|
||||||
onOpen: (link) =>
|
onOpen: (link) => LinkHandler.handleLinkTap(
|
||||||
LinkHandler.handleLinkTap(context, link.url),
|
context,
|
||||||
|
link.url,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!enableTracing && isOutgoing) ...[
|
if (!enableTracing && isOutgoing) ...[
|
||||||
@@ -411,17 +420,24 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 2),
|
padding: const EdgeInsets.only(bottom: 2),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
(message.status == ChannelMessageStatus.sent && displayPath.isNotEmpty)
|
(message.status ==
|
||||||
|
ChannelMessageStatus.sent &&
|
||||||
|
displayPath.isNotEmpty)
|
||||||
? Icons.check_circle
|
? Icons.check_circle
|
||||||
: message.status == ChannelMessageStatus.failed
|
: message.status ==
|
||||||
? Icons.cancel
|
ChannelMessageStatus.failed
|
||||||
: Icons.cloud,
|
? Icons.cancel
|
||||||
|
: Icons.cloud,
|
||||||
size: 14,
|
size: 14,
|
||||||
color: (message.status == ChannelMessageStatus.sent && displayPath.isNotEmpty)
|
color:
|
||||||
|
(message.status ==
|
||||||
|
ChannelMessageStatus.sent &&
|
||||||
|
displayPath.isNotEmpty)
|
||||||
? Colors.green
|
? Colors.green
|
||||||
: message.status == ChannelMessageStatus.failed
|
: message.status ==
|
||||||
? Colors.red
|
ChannelMessageStatus.failed
|
||||||
: Colors.grey,
|
? Colors.red
|
||||||
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -915,7 +931,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
onKeyEvent: (node, event) {
|
onKeyEvent: (node, event) {
|
||||||
if (event is KeyDownEvent &&
|
if (event is KeyDownEvent &&
|
||||||
(event.logicalKey == LogicalKeyboardKey.enter ||
|
(event.logicalKey == LogicalKeyboardKey.enter ||
|
||||||
event.logicalKey == LogicalKeyboardKey.numpadEnter)) {
|
event.logicalKey ==
|
||||||
|
LogicalKeyboardKey.numpadEnter)) {
|
||||||
_sendMessage();
|
_sendMessage();
|
||||||
return KeyEventResult.handled;
|
return KeyEventResult.handled;
|
||||||
}
|
}
|
||||||
@@ -932,9 +949,10 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
backgroundColor: Theme.of(
|
backgroundColor: Theme.of(
|
||||||
context,
|
context,
|
||||||
).colorScheme.surfaceContainerHighest,
|
).colorScheme.surfaceContainerHighest,
|
||||||
fallbackTextColor: Theme.of(
|
fallbackTextColor: Theme.of(context)
|
||||||
context,
|
.colorScheme
|
||||||
).colorScheme.onSurface.withValues(alpha: 0.6),
|
.onSurface
|
||||||
|
.withValues(alpha: 0.6),
|
||||||
maxSize: 160,
|
maxSize: 160,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -346,7 +346,8 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
onKeyEvent: (node, event) {
|
onKeyEvent: (node, event) {
|
||||||
if (event is KeyDownEvent &&
|
if (event is KeyDownEvent &&
|
||||||
(event.logicalKey == LogicalKeyboardKey.enter ||
|
(event.logicalKey == LogicalKeyboardKey.enter ||
|
||||||
event.logicalKey == LogicalKeyboardKey.numpadEnter)) {
|
event.logicalKey ==
|
||||||
|
LogicalKeyboardKey.numpadEnter)) {
|
||||||
_sendMessage(connector);
|
_sendMessage(connector);
|
||||||
return KeyEventResult.handled;
|
return KeyEventResult.handled;
|
||||||
}
|
}
|
||||||
@@ -1290,21 +1291,30 @@ class _MessageBubble extends StatelessWidget {
|
|||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(2),
|
padding: const EdgeInsets.all(2),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.black.withValues(alpha: 0.3),
|
color: Colors.black.withValues(
|
||||||
|
alpha: 0.3,
|
||||||
|
),
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
(message.status == MessageStatus.delivered && message.pathBytes.isNotEmpty)
|
(message.status ==
|
||||||
|
MessageStatus.delivered &&
|
||||||
|
message.pathBytes.isNotEmpty)
|
||||||
? Icons.check_circle
|
? Icons.check_circle
|
||||||
: message.status == MessageStatus.failed
|
: message.status ==
|
||||||
? Icons.cancel
|
MessageStatus.failed
|
||||||
: Icons.cloud,
|
? Icons.cancel
|
||||||
|
: Icons.cloud,
|
||||||
size: 14,
|
size: 14,
|
||||||
color: (message.status == MessageStatus.delivered && message.pathBytes.isNotEmpty)
|
color:
|
||||||
|
(message.status ==
|
||||||
|
MessageStatus.delivered &&
|
||||||
|
message.pathBytes.isNotEmpty)
|
||||||
? Colors.green
|
? Colors.green
|
||||||
: message.status == MessageStatus.failed
|
: message.status ==
|
||||||
? Colors.red
|
MessageStatus.failed
|
||||||
: Colors.white70,
|
? Colors.red
|
||||||
|
: Colors.white70,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1328,8 +1338,10 @@ class _MessageBubble extends StatelessWidget {
|
|||||||
defaultToHttps: false,
|
defaultToHttps: false,
|
||||||
),
|
),
|
||||||
linkifiers: const [UrlLinkifier()],
|
linkifiers: const [UrlLinkifier()],
|
||||||
onOpen: (link) =>
|
onOpen: (link) => LinkHandler.handleLinkTap(
|
||||||
LinkHandler.handleLinkTap(context, link.url),
|
context,
|
||||||
|
link.url,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!enableTracing && isOutgoing) ...[
|
if (!enableTracing && isOutgoing) ...[
|
||||||
@@ -1337,17 +1349,22 @@ class _MessageBubble extends StatelessWidget {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 2),
|
padding: const EdgeInsets.only(bottom: 2),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
(message.status == MessageStatus.delivered && message.pathBytes.isNotEmpty)
|
(message.status ==
|
||||||
|
MessageStatus.delivered &&
|
||||||
|
message.pathBytes.isNotEmpty)
|
||||||
? Icons.check_circle
|
? Icons.check_circle
|
||||||
: message.status == MessageStatus.failed
|
: message.status == MessageStatus.failed
|
||||||
? Icons.cancel
|
? Icons.cancel
|
||||||
: Icons.cloud,
|
: Icons.cloud,
|
||||||
size: 14,
|
size: 14,
|
||||||
color: (message.status == MessageStatus.delivered && message.pathBytes.isNotEmpty)
|
color:
|
||||||
|
(message.status ==
|
||||||
|
MessageStatus.delivered &&
|
||||||
|
message.pathBytes.isNotEmpty)
|
||||||
? Colors.green
|
? Colors.green
|
||||||
: message.status == MessageStatus.failed
|
: message.status == MessageStatus.failed
|
||||||
? Colors.red
|
? Colors.red
|
||||||
: Colors.grey,
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -64,9 +64,7 @@ class ChromeRequiredScreen extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.blue.withValues(alpha: 0.1),
|
color: Colors.blue.withValues(alpha: 0.1),
|
||||||
borderRadius: BorderRadius.circular(30),
|
borderRadius: BorderRadius.circular(30),
|
||||||
border: Border.all(
|
border: Border.all(color: Colors.blue.withValues(alpha: 0.3)),
|
||||||
color: Colors.blue.withValues(alpha: 0.3),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
|||||||
@@ -112,9 +112,11 @@ class _ScannerScreenState extends State<ScannerScreen> {
|
|||||||
if (isScanning) {
|
if (isScanning) {
|
||||||
connector.stopScan();
|
connector.stopScan();
|
||||||
} else {
|
} else {
|
||||||
unawaited(connector.startScan().catchError((e) {
|
unawaited(
|
||||||
debugPrint("Scanner screen startScan error: $e");
|
connector.startScan().catchError((e) {
|
||||||
}));
|
debugPrint("Scanner screen startScan error: $e");
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: isScanning
|
icon: isScanning
|
||||||
|
|||||||
Reference in New Issue
Block a user