mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-06 08:46:40 +10:00
Fixed banner flash, added enable bluetooth button fixed theme to use app theme colors removed FAB overrides because material 3 does this for us, fixed missing translations.
This commit is contained in:
@@ -80,7 +80,7 @@ class _ScannerScreenState extends State<ScannerScreen> {
|
||||
return Column(
|
||||
children: [
|
||||
// Bluetooth off warning
|
||||
if (_bluetoothState != BluetoothAdapterState.on)
|
||||
if (_bluetoothState == BluetoothAdapterState.off)
|
||||
_bluetoothOffWarning(context),
|
||||
|
||||
// Status bar
|
||||
@@ -97,23 +97,18 @@ class _ScannerScreenState extends State<ScannerScreen> {
|
||||
builder: (context, connector, child) {
|
||||
final isScanning =
|
||||
connector.state == MeshCoreConnectionState.scanning;
|
||||
final isBluetoothOn = _bluetoothState == BluetoothAdapterState.on;
|
||||
final isBluetoothOff = _bluetoothState == BluetoothAdapterState.off;
|
||||
|
||||
return FloatingActionButton.extended(
|
||||
onPressed: isBluetoothOn
|
||||
? () {
|
||||
onPressed: isBluetoothOff
|
||||
? null
|
||||
: () {
|
||||
if (isScanning) {
|
||||
connector.stopScan();
|
||||
} else {
|
||||
connector.startScan();
|
||||
}
|
||||
}
|
||||
: null,
|
||||
backgroundColor: isBluetoothOn ? null : Colors.grey,
|
||||
foregroundColor: isBluetoothOn ? null : Colors.white,
|
||||
mouseCursor: isBluetoothOn
|
||||
? SystemMouseCursors.click
|
||||
: SystemMouseCursors.forbidden,
|
||||
},
|
||||
icon: isScanning
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
@@ -236,13 +231,14 @@ 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: Colors.red.withValues(alpha: 0.15),
|
||||
color: errorColor.withValues(alpha: 0.15),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.bluetooth_disabled, size: 24, color: Colors.red),
|
||||
Icon(Icons.bluetooth_disabled, size: 24, color: errorColor),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -250,8 +246,8 @@ class _ScannerScreenState extends State<ScannerScreen> {
|
||||
children: [
|
||||
Text(
|
||||
context.l10n.scanner_bluetoothOff,
|
||||
style: const TextStyle(
|
||||
color: Colors.red,
|
||||
style: TextStyle(
|
||||
color: errorColor,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
@@ -260,13 +256,17 @@ class _ScannerScreenState extends State<ScannerScreen> {
|
||||
Text(
|
||||
context.l10n.scanner_bluetoothOffMessage,
|
||||
style: TextStyle(
|
||||
color: Colors.red.withValues(alpha: 0.85),
|
||||
color: errorColor.withValues(alpha: 0.85),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => FlutterBluePlus.turnOn(),
|
||||
child: Text(context.l10n.scanner_enableBluetooth),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user