mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-04-20 22:13:48 +00:00
Got the basic path tracing working.
This commit is contained in:
parent
2089613696
commit
fcf741b20a
3 changed files with 104 additions and 2 deletions
52
lib/widgets/path_trace_dialog.dart
Normal file
52
lib/widgets/path_trace_dialog.dart
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:meshcore_open/widgets/snr_indicator.dart';
|
||||
|
||||
class PathTraceDialog extends StatefulWidget {
|
||||
|
||||
const PathTraceDialog({
|
||||
super.key,
|
||||
required this.pathData,
|
||||
required this.snrData,
|
||||
});
|
||||
|
||||
final Uint8List pathData;
|
||||
final Uint8List snrData;
|
||||
|
||||
@override
|
||||
State<PathTraceDialog> createState() => _PathTraceDialogState();
|
||||
}
|
||||
|
||||
class _PathTraceDialogState extends State<PathTraceDialog> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Path Trace'),
|
||||
content: SizedBox(
|
||||
width: double.maxFinite,
|
||||
child: ListView.builder(
|
||||
itemCount: widget.snrData.length,
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
leading: index >= widget.snrData.length / 2 ? Icon(Icons.arrow_circle_left) : Icon(Icons.arrow_circle_right),
|
||||
title: index == 0 || index == widget.snrData.length - 1 ? ( index == 0 ? Text('You to 0x${widget.pathData[0].toRadixString(16).toUpperCase()}') : Text('0x${widget.pathData[widget.pathData.length - 1].toRadixString(16).toUpperCase()} to You')) : Text('0x${widget.pathData[index-1].toRadixString(16).toUpperCase()} to 0x${widget.pathData[index].toRadixString(16).toUpperCase()}'),
|
||||
trailing: SNRIcon(snr: widget.snrData[index] / 4.0),
|
||||
onTap: () {
|
||||
// Handle item tap
|
||||
},
|
||||
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Close'),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue