mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-25 03:42:55 +10:00
Refactor AppBarTitle widget to remove unused style parameter; update related screens to reflect changes
Improve SNR handling by adding validation for spreading factor range in snrUiFromSNR function Update contact handling in MeshCoreConnector to fix variable naming and improve readability Stop parsing unsupported LPP types in CayenneLpp to avoid misalignment
This commit is contained in:
@@ -7,16 +7,9 @@ import 'snr_indicator.dart';
|
||||
|
||||
class AppBarTitle extends StatelessWidget {
|
||||
final String title;
|
||||
final TextStyle? style;
|
||||
final Widget? leading;
|
||||
final Widget? trailing;
|
||||
const AppBarTitle(
|
||||
this.title,
|
||||
this.style, {
|
||||
this.leading,
|
||||
this.trailing,
|
||||
super.key,
|
||||
});
|
||||
const AppBarTitle(this.title, {this.leading, this.trailing, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -25,6 +18,7 @@ class AppBarTitle extends StatelessWidget {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
leading ?? const SizedBox.shrink(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -29,7 +29,10 @@ List<double> getSNRfromSF(int spreadingFactor) {
|
||||
}
|
||||
|
||||
SNRUi snrUiFromSNR(double? snr, int? spreadingFactor) {
|
||||
if (snr == null || spreadingFactor == null) {
|
||||
if (snr == null ||
|
||||
spreadingFactor == null ||
|
||||
spreadingFactor < 7 ||
|
||||
spreadingFactor > 12) {
|
||||
return const SNRUi(Icons.signal_cellular_off, Colors.grey, '—');
|
||||
}
|
||||
|
||||
@@ -125,8 +128,10 @@ class _SNRIndicatorState extends State<SNRIndicator> {
|
||||
String _formatLastUpdated(DateTime lastSeen) {
|
||||
final now = DateTime.now();
|
||||
final diff = now.difference(lastSeen);
|
||||
|
||||
if (diff.isNegative || diff.inMinutes < 1) {
|
||||
if (diff.isNegative) {
|
||||
return "0s";
|
||||
}
|
||||
if (diff.inMinutes < 1) {
|
||||
return "${diff.inSeconds}s";
|
||||
}
|
||||
if (diff.inMinutes < 60) {
|
||||
|
||||
Reference in New Issue
Block a user