mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
fix: Reset fallback sharing state
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:math' as math;
|
||||
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import 'package:meshcore_client/meshcore_client.dart' show Message;
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -233,7 +234,7 @@ class _BTHomeMetHistorySheetState extends State<_BTHomeMetHistorySheet> {
|
||||
),
|
||||
),
|
||||
icon: const Icon(Icons.chevron_left),
|
||||
label: const Text('Newer'),
|
||||
label: Text(AppLocalizations.of(context)!.newer),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
OutlinedButton.icon(
|
||||
@@ -249,7 +250,7 @@ class _BTHomeMetHistorySheetState extends State<_BTHomeMetHistorySheet> {
|
||||
),
|
||||
),
|
||||
icon: const Icon(Icons.chevron_right),
|
||||
label: const Text('Older'),
|
||||
label: Text(AppLocalizations.of(context)!.older),
|
||||
),
|
||||
const Spacer(),
|
||||
if (_loading)
|
||||
@@ -276,13 +277,13 @@ class _BTHomeMetHistorySheetState extends State<_BTHomeMetHistorySheet> {
|
||||
if (_error != null)
|
||||
_HistoryMessageCard(
|
||||
icon: Icons.error_outline,
|
||||
title: 'Could not load MET history',
|
||||
title: AppLocalizations.of(context)!.couldNotLoadMetHistory,
|
||||
body: _error!,
|
||||
)
|
||||
else if (_loading && history == null)
|
||||
const _HistoryMessageCard(
|
||||
_HistoryMessageCard(
|
||||
icon: Icons.hourglass_top,
|
||||
title: 'Loading',
|
||||
title: AppLocalizations.of(context)!.loading,
|
||||
body: 'Waiting for the sensor to reply.',
|
||||
)
|
||||
else if (history != null) ...[
|
||||
@@ -362,19 +363,19 @@ class _HistoryStatsGrid extends StatelessWidget {
|
||||
final compact = constraints.maxWidth < 520;
|
||||
final tiles = <Widget>[
|
||||
_HistoryStatTile(
|
||||
label: 'Latest',
|
||||
label: AppLocalizations.of(context)!.latest,
|
||||
value: _formatMeasurementValue(measurement, history.latest),
|
||||
),
|
||||
_HistoryStatTile(
|
||||
label: 'Min',
|
||||
label: AppLocalizations.of(context)!.min,
|
||||
value: _formatMeasurementValue(measurement, history.minimum),
|
||||
),
|
||||
_HistoryStatTile(
|
||||
label: 'Max',
|
||||
label: AppLocalizations.of(context)!.max,
|
||||
value: _formatMeasurementValue(measurement, history.maximum),
|
||||
),
|
||||
_HistoryStatTile(
|
||||
label: 'Samples',
|
||||
label: AppLocalizations.of(context)!.samples,
|
||||
value: history.values.length.toString(),
|
||||
),
|
||||
];
|
||||
|
||||
@@ -1140,7 +1140,7 @@ class SensorTelemetryCard extends StatelessWidget {
|
||||
await Clipboard.setData(ClipboardData(text: rawTelemetry));
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Raw response copied')),
|
||||
SnackBar(content: Text(AppLocalizations.of(context)!.rawResponseCopied)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1173,13 +1173,13 @@ class SensorTelemetryCard extends StatelessWidget {
|
||||
if (onPing != null)
|
||||
_SensorSheetAction(
|
||||
icon: Icons.network_ping,
|
||||
label: 'Ping',
|
||||
label: AppLocalizations.of(context)!.ping,
|
||||
onTap: () => _handleAction(context, 'ping'),
|
||||
),
|
||||
if (_rawTelemetryHex(contact?.telemetry) != null)
|
||||
_SensorSheetAction(
|
||||
icon: Icons.copy_all_outlined,
|
||||
label: 'Copy raw response',
|
||||
label: AppLocalizations.of(context)!.copyRawResponse,
|
||||
onTap: () => _handleAction(context, 'copy_raw'),
|
||||
),
|
||||
if (onCustomize != null)
|
||||
@@ -1193,7 +1193,7 @@ class SensorTelemetryCard extends StatelessWidget {
|
||||
supportsBTHomeMetHistory(contact))
|
||||
_SensorSheetAction(
|
||||
icon: Icons.show_chart,
|
||||
label: 'MET history',
|
||||
label: AppLocalizations.of(context)!.metHistory,
|
||||
onTap: () => _handleAction(context, 'met_history'),
|
||||
),
|
||||
if (onRemove != null)
|
||||
@@ -1309,10 +1309,10 @@ class SensorTelemetryCard extends StatelessWidget {
|
||||
tooltip: l10n.refreshing,
|
||||
),
|
||||
if (state == SensorRefreshState.success)
|
||||
const _InlineStateMeta(
|
||||
_InlineStateMeta(
|
||||
color: Color(0xFF218B63),
|
||||
icon: Icons.check_circle,
|
||||
tooltip: 'Updated',
|
||||
tooltip: AppLocalizations.of(context)!.updated,
|
||||
),
|
||||
if (state == SensorRefreshState.unavailable)
|
||||
_InlineStateMeta(
|
||||
|
||||
Reference in New Issue
Block a user