mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-26 21:46:38 +10:00
Added support for left-click copy, and snackbar message about copying the data.
This commit is contained in:
@@ -110,20 +110,29 @@ class _BleDebugLogScreenState extends State<BleDebugLogScreen> {
|
|||||||
final entry = entries[index];
|
final entry = entries[index];
|
||||||
final time =
|
final time =
|
||||||
'${entry.timestamp.hour.toString().padLeft(2, '0')}:${entry.timestamp.minute.toString().padLeft(2, '0')}:${entry.timestamp.second.toString().padLeft(2, '0')}';
|
'${entry.timestamp.hour.toString().padLeft(2, '0')}:${entry.timestamp.minute.toString().padLeft(2, '0')}:${entry.timestamp.second.toString().padLeft(2, '0')}';
|
||||||
return GestureDetector(
|
Future<void> copyHex() async {
|
||||||
onLongPress: () async {
|
await Clipboard.setData(
|
||||||
await Clipboard.setData(
|
ClipboardData(
|
||||||
ClipboardData(
|
text: entry.payload
|
||||||
text: entry.payload
|
.map(
|
||||||
.map(
|
(b) => b
|
||||||
(b) => b
|
.toRadixString(16)
|
||||||
.toRadixString(16)
|
.padLeft(2, '0'),
|
||||||
.padLeft(2, '0'),
|
)
|
||||||
)
|
.join(''),
|
||||||
.join(''),
|
),
|
||||||
),
|
);
|
||||||
|
if (context.mounted) {
|
||||||
|
showDismissibleSnackBar(
|
||||||
|
context,
|
||||||
|
content: Text(context.l10n.debugLog_bleCopied),
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: copyHex,
|
||||||
|
onLongPress: copyHex,
|
||||||
child: Container(
|
child: Container(
|
||||||
color: MeshPalette.bg,
|
color: MeshPalette.bg,
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
|
|||||||
Reference in New Issue
Block a user