Merge pull request #161 from ChaoticLeah/enhancement/bluetooth-disabled-warning

Add warning when bluetooth is off
This commit is contained in:
zjs81
2026-02-14 02:00:36 -07:00
committed by GitHub
33 changed files with 311 additions and 31 deletions
+4 -1
View File
@@ -1595,5 +1595,8 @@
"pathTrace_clearTooltip": "Изчисти пътя", "pathTrace_clearTooltip": "Изчисти пътя",
"map_removeLast": "Премахни Последно", "map_removeLast": "Премахни Последно",
"map_runTrace": "Изпълни Път на Следване", "map_runTrace": "Изпълни Път на Следване",
"map_tapToAdd": "Натиснете върху възлите, за да ги добавите към пътя." "map_tapToAdd": "Натиснете върху възлите, за да ги добавите към пътя.",
"scanner_bluetoothOff": "Bluetooth е изключен.",
"scanner_enableBluetooth": "Активирайте Bluetooth",
"scanner_bluetoothOffMessage": "Моля, активирайте Bluetooth, за да сканирате за устройства."
} }
+4 -1
View File
@@ -1623,5 +1623,8 @@
"map_tapToAdd": "Tippen Sie auf Knoten, um sie zum Pfad hinzuzufügen.", "map_tapToAdd": "Tippen Sie auf Knoten, um sie zum Pfad hinzuzufügen.",
"map_runTrace": "Pfadverlauf ausführen", "map_runTrace": "Pfadverlauf ausführen",
"pathTrace_clearTooltip": "Pfad löschen", "pathTrace_clearTooltip": "Pfad löschen",
"map_pathTraceCancelled": "Pfadverfolgung abgebrochen." "map_pathTraceCancelled": "Pfadverfolgung abgebrochen.",
"scanner_bluetoothOffMessage": "Bitte aktivieren Sie Bluetooth, um nach Geräten zu suchen.",
"scanner_bluetoothOff": "Bluetooth ist deaktiviert.",
"scanner_enableBluetooth": "Bluetooth aktivieren"
} }
+3
View File
@@ -66,6 +66,9 @@
}, },
"scanner_stop": "Stop", "scanner_stop": "Stop",
"scanner_scan": "Scan", "scanner_scan": "Scan",
"scanner_bluetoothOff": "Bluetooth is off",
"scanner_bluetoothOffMessage": "Please turn on Bluetooth to scan for devices",
"scanner_enableBluetooth": "Enable Bluetooth",
"device_quickSwitch": "Quick switch", "device_quickSwitch": "Quick switch",
"device_meshcore": "MeshCore", "device_meshcore": "MeshCore",
+4 -1
View File
@@ -1623,5 +1623,8 @@
"map_runTrace": "Ejecutar Rastreo de Ruta", "map_runTrace": "Ejecutar Rastreo de Ruta",
"map_tapToAdd": "Pulse en los nodos para agregarlos al camino.", "map_tapToAdd": "Pulse en los nodos para agregarlos al camino.",
"map_removeLast": "Eliminar último", "map_removeLast": "Eliminar último",
"map_pathTraceCancelled": "Rastreo de ruta cancelado." "map_pathTraceCancelled": "Rastreo de ruta cancelado.",
"scanner_bluetoothOffMessage": "Por favor, active el Bluetooth para escanear dispositivos.",
"scanner_bluetoothOff": "Bluetooth está desactivado.",
"scanner_enableBluetooth": "Habilitar Bluetooth"
} }
+4 -1
View File
@@ -1595,5 +1595,8 @@
"pathTrace_clearTooltip": "Effacer le chemin", "pathTrace_clearTooltip": "Effacer le chemin",
"map_pathTraceCancelled": "Traçage de chemin annulé", "map_pathTraceCancelled": "Traçage de chemin annulé",
"map_removeLast": "Supprimer le dernier", "map_removeLast": "Supprimer le dernier",
"map_runTrace": "Exécuter la traçage de chemin" "map_runTrace": "Exécuter la traçage de chemin",
"scanner_bluetoothOffMessage": "Veuillez activer le Bluetooth pour rechercher des appareils.",
"scanner_bluetoothOff": "Le Bluetooth est désactivé.",
"scanner_enableBluetooth": "Activer le Bluetooth"
} }
+4 -1
View File
@@ -1595,5 +1595,8 @@
"map_pathTraceCancelled": "Tracciamento del percorso annullato.", "map_pathTraceCancelled": "Tracciamento del percorso annullato.",
"pathTrace_clearTooltip": "Pulisci percorso", "pathTrace_clearTooltip": "Pulisci percorso",
"map_runTrace": "Esegui Path Trace", "map_runTrace": "Esegui Path Trace",
"map_tapToAdd": "Tocca i nodi per aggiungerli al percorso." "map_tapToAdd": "Tocca i nodi per aggiungerli al percorso.",
"scanner_bluetoothOff": "Il Bluetooth è disattivato.",
"scanner_bluetoothOffMessage": "Si prega di attivare il Bluetooth per effettuare la scansione dei dispositivi.",
"scanner_enableBluetooth": "Abilita il Bluetooth"
} }
+18
View File
@@ -376,6 +376,24 @@ abstract class AppLocalizations {
/// **'Scan'** /// **'Scan'**
String get scanner_scan; String get scanner_scan;
/// No description provided for @scanner_bluetoothOff.
///
/// In en, this message translates to:
/// **'Bluetooth is off'**
String get scanner_bluetoothOff;
/// No description provided for @scanner_bluetoothOffMessage.
///
/// In en, this message translates to:
/// **'Please turn on Bluetooth to scan for devices'**
String get scanner_bluetoothOffMessage;
/// No description provided for @scanner_enableBluetooth.
///
/// In en, this message translates to:
/// **'Enable Bluetooth'**
String get scanner_enableBluetooth;
/// No description provided for @device_quickSwitch. /// No description provided for @device_quickSwitch.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
+10
View File
@@ -143,6 +143,16 @@ class AppLocalizationsBg extends AppLocalizations {
@override @override
String get scanner_scan => 'Сканирай'; String get scanner_scan => 'Сканирай';
@override
String get scanner_bluetoothOff => 'Bluetooth е изключен.';
@override
String get scanner_bluetoothOffMessage =>
'Моля, активирайте Bluetooth, за да сканирате за устройства.';
@override
String get scanner_enableBluetooth => 'Активирайте Bluetooth';
@override @override
String get device_quickSwitch => 'Бързо превключване'; String get device_quickSwitch => 'Бързо превключване';
+10
View File
@@ -143,6 +143,16 @@ class AppLocalizationsDe extends AppLocalizations {
@override @override
String get scanner_scan => 'Scannen'; String get scanner_scan => 'Scannen';
@override
String get scanner_bluetoothOff => 'Bluetooth ist deaktiviert.';
@override
String get scanner_bluetoothOffMessage =>
'Bitte aktivieren Sie Bluetooth, um nach Geräten zu suchen.';
@override
String get scanner_enableBluetooth => 'Bluetooth aktivieren';
@override @override
String get device_quickSwitch => 'Schnelles Umschalten'; String get device_quickSwitch => 'Schnelles Umschalten';
+10
View File
@@ -142,6 +142,16 @@ class AppLocalizationsEn extends AppLocalizations {
@override @override
String get scanner_scan => 'Scan'; String get scanner_scan => 'Scan';
@override
String get scanner_bluetoothOff => 'Bluetooth is off';
@override
String get scanner_bluetoothOffMessage =>
'Please turn on Bluetooth to scan for devices';
@override
String get scanner_enableBluetooth => 'Enable Bluetooth';
@override @override
String get device_quickSwitch => 'Quick switch'; String get device_quickSwitch => 'Quick switch';
+10
View File
@@ -143,6 +143,16 @@ class AppLocalizationsEs extends AppLocalizations {
@override @override
String get scanner_scan => 'Escanea'; String get scanner_scan => 'Escanea';
@override
String get scanner_bluetoothOff => 'Bluetooth está desactivado.';
@override
String get scanner_bluetoothOffMessage =>
'Por favor, active el Bluetooth para escanear dispositivos.';
@override
String get scanner_enableBluetooth => 'Habilitar Bluetooth';
@override @override
String get device_quickSwitch => 'Cambiar rápidamente'; String get device_quickSwitch => 'Cambiar rápidamente';
+10
View File
@@ -143,6 +143,16 @@ class AppLocalizationsFr extends AppLocalizations {
@override @override
String get scanner_scan => 'Scanner'; String get scanner_scan => 'Scanner';
@override
String get scanner_bluetoothOff => 'Le Bluetooth est désactivé.';
@override
String get scanner_bluetoothOffMessage =>
'Veuillez activer le Bluetooth pour rechercher des appareils.';
@override
String get scanner_enableBluetooth => 'Activer le Bluetooth';
@override @override
String get device_quickSwitch => 'Basculement rapide'; String get device_quickSwitch => 'Basculement rapide';
+10
View File
@@ -143,6 +143,16 @@ class AppLocalizationsIt extends AppLocalizations {
@override @override
String get scanner_scan => 'Scansiona'; String get scanner_scan => 'Scansiona';
@override
String get scanner_bluetoothOff => 'Il Bluetooth è disattivato.';
@override
String get scanner_bluetoothOffMessage =>
'Si prega di attivare il Bluetooth per effettuare la scansione dei dispositivi.';
@override
String get scanner_enableBluetooth => 'Abilita il Bluetooth';
@override @override
String get device_quickSwitch => 'Passa velocemente'; String get device_quickSwitch => 'Passa velocemente';
+10
View File
@@ -142,6 +142,16 @@ class AppLocalizationsNl extends AppLocalizations {
@override @override
String get scanner_scan => 'Scan'; String get scanner_scan => 'Scan';
@override
String get scanner_bluetoothOff => 'Bluetooth is uitgeschakeld';
@override
String get scanner_bluetoothOffMessage =>
'Zorg ervoor dat Bluetooth is ingeschakeld om naar apparaten te zoeken.';
@override
String get scanner_enableBluetooth => 'Activeer Bluetooth';
@override @override
String get device_quickSwitch => 'Snelle overschakeling'; String get device_quickSwitch => 'Snelle overschakeling';
+10
View File
@@ -143,6 +143,16 @@ class AppLocalizationsPl extends AppLocalizations {
@override @override
String get scanner_scan => 'Przeskanuj'; String get scanner_scan => 'Przeskanuj';
@override
String get scanner_bluetoothOff => 'Bluetooth jest wyłączony';
@override
String get scanner_bluetoothOffMessage =>
'Prosimy włączyć Bluetooth, aby przeskanować urządzenia.';
@override
String get scanner_enableBluetooth => 'Włącz Bluetooth';
@override @override
String get device_quickSwitch => 'Szybka zmiana'; String get device_quickSwitch => 'Szybka zmiana';
+10
View File
@@ -143,6 +143,16 @@ class AppLocalizationsPt extends AppLocalizations {
@override @override
String get scanner_scan => 'Digitalizar'; String get scanner_scan => 'Digitalizar';
@override
String get scanner_bluetoothOff => 'Bluetooth está desativado';
@override
String get scanner_bluetoothOffMessage =>
'Por favor, ative o Bluetooth para escanear por dispositivos.';
@override
String get scanner_enableBluetooth => 'Ative o Bluetooth';
@override @override
String get device_quickSwitch => 'Mudar rapidamente'; String get device_quickSwitch => 'Mudar rapidamente';
+10
View File
@@ -142,6 +142,16 @@ class AppLocalizationsRu extends AppLocalizations {
@override @override
String get scanner_scan => 'Сканирование'; String get scanner_scan => 'Сканирование';
@override
String get scanner_bluetoothOff => 'Bluetooth выключен';
@override
String get scanner_bluetoothOffMessage =>
'Пожалуйста, включите Bluetooth, чтобы найти устройства.';
@override
String get scanner_enableBluetooth => 'Включите Bluetooth';
@override @override
String get device_quickSwitch => 'Быстрое переключение'; String get device_quickSwitch => 'Быстрое переключение';
+10
View File
@@ -143,6 +143,16 @@ class AppLocalizationsSk extends AppLocalizations {
@override @override
String get scanner_scan => 'Skončiť'; String get scanner_scan => 'Skončiť';
@override
String get scanner_bluetoothOff => 'Bluetooth je vypnutý';
@override
String get scanner_bluetoothOffMessage =>
'Prosím, zapnite Bluetooth, aby ste mohli skenovať pre zariadenia.';
@override
String get scanner_enableBluetooth => 'Povolte Bluetooth';
@override @override
String get device_quickSwitch => 'Rýchle prepínač'; String get device_quickSwitch => 'Rýchle prepínač';
+10
View File
@@ -143,6 +143,16 @@ class AppLocalizationsSl extends AppLocalizations {
@override @override
String get scanner_scan => 'Skeniraj'; String get scanner_scan => 'Skeniraj';
@override
String get scanner_bluetoothOff => 'Bluetooth je izklopljen';
@override
String get scanner_bluetoothOffMessage =>
'Prosimo, vklopite Bluetooth, da lahko poiščete naprave.';
@override
String get scanner_enableBluetooth => 'Omogočite Bluetooth';
@override @override
String get device_quickSwitch => 'Hitro preklop'; String get device_quickSwitch => 'Hitro preklop';
+10
View File
@@ -142,6 +142,16 @@ class AppLocalizationsSv extends AppLocalizations {
@override @override
String get scanner_scan => 'Skanna'; String get scanner_scan => 'Skanna';
@override
String get scanner_bluetoothOff => 'Bluetooth är avstängt';
@override
String get scanner_bluetoothOffMessage =>
'Vänligen aktivera Bluetooth för att söka efter enheter.';
@override
String get scanner_enableBluetooth => 'Aktivera Bluetooth';
@override @override
String get device_quickSwitch => 'Snabb växling'; String get device_quickSwitch => 'Snabb växling';
+10
View File
@@ -143,6 +143,16 @@ class AppLocalizationsUk extends AppLocalizations {
@override @override
String get scanner_scan => 'Сканувати'; String get scanner_scan => 'Сканувати';
@override
String get scanner_bluetoothOff => 'Bluetooth вимкнено';
@override
String get scanner_bluetoothOffMessage =>
'Будь ласка, увімкніть Bluetooth, щоб сканувати пристрої.';
@override
String get scanner_enableBluetooth => 'Увімкніть Bluetooth';
@override @override
String get device_quickSwitch => 'Швидке перемикання'; String get device_quickSwitch => 'Швидке перемикання';
+9
View File
@@ -142,6 +142,15 @@ class AppLocalizationsZh extends AppLocalizations {
@override @override
String get scanner_scan => '扫描'; String get scanner_scan => '扫描';
@override
String get scanner_bluetoothOff => '蓝牙已关闭';
@override
String get scanner_bluetoothOffMessage => '请打开蓝牙功能,以便搜索设备。';
@override
String get scanner_enableBluetooth => '启用蓝牙';
@override @override
String get device_quickSwitch => '快速切换'; String get device_quickSwitch => '快速切换';
+4 -1
View File
@@ -1595,5 +1595,8 @@
"pathTrace_clearTooltip": "Weg wissen", "pathTrace_clearTooltip": "Weg wissen",
"map_pathTraceCancelled": "Pad traceren geannuleerd", "map_pathTraceCancelled": "Pad traceren geannuleerd",
"map_tapToAdd": "Tik op knooppunten om ze toe te voegen aan het pad", "map_tapToAdd": "Tik op knooppunten om ze toe te voegen aan het pad",
"map_runTrace": "Padeshulp traceren" "map_runTrace": "Padeshulp traceren",
"scanner_enableBluetooth": "Activeer Bluetooth",
"scanner_bluetoothOffMessage": "Zorg ervoor dat Bluetooth is ingeschakeld om naar apparaten te zoeken.",
"scanner_bluetoothOff": "Bluetooth is uitgeschakeld"
} }
+4 -1
View File
@@ -1595,5 +1595,8 @@
"map_runTrace": "Uruchom ślad ścieżki", "map_runTrace": "Uruchom ślad ścieżki",
"pathTrace_clearTooltip": "Wyczyść ścieżkę", "pathTrace_clearTooltip": "Wyczyść ścieżkę",
"map_removeLast": "Usuń ostatni", "map_removeLast": "Usuń ostatni",
"map_tapToAdd": "Kliknij na węzły, aby dodać je do ścieżki." "map_tapToAdd": "Kliknij na węzły, aby dodać je do ścieżki.",
"scanner_bluetoothOffMessage": "Prosimy włączyć Bluetooth, aby przeskanować urządzenia.",
"scanner_bluetoothOff": "Bluetooth jest wyłączony",
"scanner_enableBluetooth": "Włącz Bluetooth"
} }
+4 -1
View File
@@ -1595,5 +1595,8 @@
"map_pathTraceCancelled": "Rastreamento de caminho cancelado.", "map_pathTraceCancelled": "Rastreamento de caminho cancelado.",
"pathTrace_clearTooltip": "Limpar caminho", "pathTrace_clearTooltip": "Limpar caminho",
"map_removeLast": "Remover Último", "map_removeLast": "Remover Último",
"map_tapToAdd": "Toque nos nós para adicioná-los ao caminho." "map_tapToAdd": "Toque nos nós para adicioná-los ao caminho.",
"scanner_enableBluetooth": "Ative o Bluetooth",
"scanner_bluetoothOff": "Bluetooth está desativado",
"scanner_bluetoothOffMessage": "Por favor, ative o Bluetooth para escanear por dispositivos."
} }
+4 -1
View File
@@ -835,5 +835,8 @@
"map_removeLast": "Удалить последний", "map_removeLast": "Удалить последний",
"map_pathTraceCancelled": "Отмена трассировки пути", "map_pathTraceCancelled": "Отмена трассировки пути",
"pathTrace_clearTooltip": "Очистить путь", "pathTrace_clearTooltip": "Очистить путь",
"map_runTrace": "Запустить трассировку пути" "map_runTrace": "Запустить трассировку пути",
"scanner_enableBluetooth": "Включите Bluetooth",
"scanner_bluetoothOff": "Bluetooth выключен",
"scanner_bluetoothOffMessage": "Пожалуйста, включите Bluetooth, чтобы найти устройства."
} }
+4 -1
View File
@@ -1595,5 +1595,8 @@
"map_tapToAdd": "Kliknite na uzly, aby ste ich pridali k ceste.", "map_tapToAdd": "Kliknite na uzly, aby ste ich pridali k ceste.",
"map_removeLast": "Odstrániť posledný", "map_removeLast": "Odstrániť posledný",
"map_runTrace": "Spustiť trasovaním cesty", "map_runTrace": "Spustiť trasovaním cesty",
"map_pathTraceCancelled": "Zrušenie stopáže cesty bolo zrušené." "map_pathTraceCancelled": "Zrušenie stopáže cesty bolo zrušené.",
"scanner_bluetoothOffMessage": "Prosím, zapnite Bluetooth, aby ste mohli skenovať pre zariadenia.",
"scanner_bluetoothOff": "Bluetooth je vypnutý",
"scanner_enableBluetooth": "Povolte Bluetooth"
} }
+4 -1
View File
@@ -1595,5 +1595,8 @@
"map_removeLast": "Odstrani Zadnji", "map_removeLast": "Odstrani Zadnji",
"map_runTrace": "Zaženi sledenje poti", "map_runTrace": "Zaženi sledenje poti",
"pathTrace_clearTooltip": "Počisti pot", "pathTrace_clearTooltip": "Počisti pot",
"map_pathTraceCancelled": "Spremljanje poti je prekinjeno." "map_pathTraceCancelled": "Spremljanje poti je prekinjeno.",
"scanner_enableBluetooth": "Omogočite Bluetooth",
"scanner_bluetoothOffMessage": "Prosimo, vklopite Bluetooth, da lahko poiščete naprave.",
"scanner_bluetoothOff": "Bluetooth je izklopljen"
} }
+4 -1
View File
@@ -1595,5 +1595,8 @@
"map_pathTraceCancelled": "Sökvägsspårning avbruten.", "map_pathTraceCancelled": "Sökvägsspårning avbruten.",
"map_runTrace": "Kör spårsökning", "map_runTrace": "Kör spårsökning",
"map_tapToAdd": "Tryck på noder för att lägga till dem i banan.", "map_tapToAdd": "Tryck på noder för att lägga till dem i banan.",
"map_removeLast": "Ta bort sista" "map_removeLast": "Ta bort sista",
"scanner_enableBluetooth": "Aktivera Bluetooth",
"scanner_bluetoothOffMessage": "Vänligen aktivera Bluetooth för att söka efter enheter.",
"scanner_bluetoothOff": "Bluetooth är avstängt"
} }
+4 -1
View File
@@ -1595,5 +1595,8 @@
"map_runTrace": "Виконати трасування шляху", "map_runTrace": "Виконати трасування шляху",
"pathTrace_clearTooltip": "Очистити шлях", "pathTrace_clearTooltip": "Очистити шлях",
"map_removeLast": "Видалити останній", "map_removeLast": "Видалити останній",
"map_pathTraceCancelled": "Відмінується трасування шляху" "map_pathTraceCancelled": "Відмінується трасування шляху",
"scanner_enableBluetooth": "Увімкніть Bluetooth",
"scanner_bluetoothOffMessage": "Будь ласка, увімкніть Bluetooth, щоб сканувати пристрої.",
"scanner_bluetoothOff": "Bluetooth вимкнено"
} }
+4 -1
View File
@@ -1595,5 +1595,8 @@
"pathTrace_clearTooltip": "清除路径", "pathTrace_clearTooltip": "清除路径",
"map_pathTraceCancelled": "路径跟踪已取消", "map_pathTraceCancelled": "路径跟踪已取消",
"map_removeLast": "删除最后一个", "map_removeLast": "删除最后一个",
"map_runTrace": "运行路径跟踪" "map_runTrace": "运行路径跟踪",
"scanner_bluetoothOffMessage": "请打开蓝牙功能,以便搜索设备。",
"scanner_bluetoothOff": "蓝牙已关闭",
"scanner_enableBluetooth": "启用蓝牙"
} }
+75 -7
View File
@@ -1,3 +1,6 @@
import 'dart:async';
import 'dart:io' show Platform;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -18,6 +21,8 @@ class ScannerScreen extends StatefulWidget {
class _ScannerScreenState extends State<ScannerScreen> { class _ScannerScreenState extends State<ScannerScreen> {
bool _changedNavigation = false; bool _changedNavigation = false;
late final VoidCallback _connectionListener; late final VoidCallback _connectionListener;
BluetoothAdapterState _bluetoothState = BluetoothAdapterState.unknown;
late StreamSubscription<BluetoothAdapterState> _bluetoothStateSubscription;
@override @override
void initState() { void initState() {
@@ -39,12 +44,25 @@ class _ScannerScreenState extends State<ScannerScreen> {
}; };
connector.addListener(_connectionListener); connector.addListener(_connectionListener);
_bluetoothStateSubscription = FlutterBluePlus.adapterState.listen((state) {
if (mounted) {
setState(() {
_bluetoothState = state;
});
// Cancel scan if Bluetooth turns off while scanning
if (state != BluetoothAdapterState.on) {
unawaited(connector.stopScan());
}
}
});
} }
@override @override
void dispose() { void dispose() {
final connector = Provider.of<MeshCoreConnector>(context, listen: false); final connector = Provider.of<MeshCoreConnector>(context, listen: false);
connector.removeListener(_connectionListener); connector.removeListener(_connectionListener);
unawaited(_bluetoothStateSubscription.cancel());
super.dispose(); super.dispose();
} }
@@ -62,6 +80,10 @@ class _ScannerScreenState extends State<ScannerScreen> {
builder: (context, connector, child) { builder: (context, connector, child) {
return Column( return Column(
children: [ children: [
// Bluetooth off warning
if (_bluetoothState == BluetoothAdapterState.off)
_bluetoothOffWarning(context),
// Status bar // Status bar
_buildStatusBar(context, connector), _buildStatusBar(context, connector),
@@ -76,15 +98,18 @@ class _ScannerScreenState extends State<ScannerScreen> {
builder: (context, connector, child) { builder: (context, connector, child) {
final isScanning = final isScanning =
connector.state == MeshCoreConnectionState.scanning; connector.state == MeshCoreConnectionState.scanning;
final isBluetoothOff = _bluetoothState == BluetoothAdapterState.off;
return FloatingActionButton.extended( return FloatingActionButton.extended(
onPressed: () { onPressed: isBluetoothOff
if (isScanning) { ? null
connector.stopScan(); : () {
} else { if (isScanning) {
connector.startScan(); connector.stopScan();
} } else {
}, connector.startScan();
}
},
icon: isScanning icon: isScanning
? const SizedBox( ? const SizedBox(
width: 20, width: 20,
@@ -205,4 +230,47 @@ class _ScannerScreenState extends State<ScannerScreen> {
} }
} }
} }
Widget _bluetoothOffWarning(BuildContext context) {
final errorColor = Theme.of(context).colorScheme.error;
return Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
color: errorColor.withValues(alpha: 0.15),
child: Row(
children: [
Icon(Icons.bluetooth_disabled, size: 24, color: errorColor),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
context.l10n.scanner_bluetoothOff,
style: TextStyle(
color: errorColor,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
const SizedBox(height: 4),
Text(
context.l10n.scanner_bluetoothOffMessage,
style: TextStyle(
color: errorColor.withValues(alpha: 0.85),
fontSize: 12,
),
),
],
),
),
if (Platform.isAndroid)
TextButton(
onPressed: () => FlutterBluePlus.turnOn(),
child: Text(context.l10n.scanner_enableBluetooth),
),
],
),
);
}
} }
+10 -10
View File
@@ -69,10 +69,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: characters name: characters
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.1" version: "1.4.0"
checked_yaml: checked_yaml:
dependency: transitive dependency: transitive
description: description:
@@ -489,26 +489,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6" sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.18" version: "0.12.17"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.13.0" version: "0.11.1"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349" sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.18.0" version: "1.17.0"
mgrs_dart: mgrs_dart:
dependency: transitive dependency: transitive
description: description:
@@ -910,10 +910,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636" sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.9" version: "0.7.7"
timezone: timezone:
dependency: transitive dependency: transitive
description: description: