UI adjustments
This commit is contained in:
@@ -47,16 +47,16 @@ class _ConnectionSection extends ConsumerWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text('Verbindung', style: Theme.of(context).textTheme.titleMedium),
|
||||
Text('Connection', style: Theme.of(context).textTheme.titleMedium),
|
||||
const Spacer(),
|
||||
_StatePill(state: linkState),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const Text('Art: Bluetooth'),
|
||||
const Text('Type: Bluetooth'),
|
||||
const SizedBox(height: 4),
|
||||
const Text(
|
||||
'WLAN und USB folgen spaeter (Doku Kommunikationsschicht 6/7).',
|
||||
'Wi-Fi and USB support are coming later.',
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
if (errorReason != null) ...[
|
||||
@@ -68,24 +68,24 @@ class _ConnectionSection extends ConsumerWidget {
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () => _connect(ref),
|
||||
child: const Text('Verbinden'),
|
||||
child: const Text('Connect'),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
OutlinedButton(
|
||||
onPressed: () => ref.read(bluetoothTransportProvider).disconnect(),
|
||||
child: const Text('Trennen'),
|
||||
child: const Text('Disconnect'),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
TextButton(
|
||||
onPressed: BluetoothSystemSettings.openBluetoothSettings,
|
||||
child: const Text('Geraet koppeln'),
|
||||
child: const Text('Pair device'),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SwitchListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const Text('Beim Wechsel in Fly automatisch verbinden'),
|
||||
title: const Text('Auto-connect when entering Fly mode'),
|
||||
value: connectionSettings?.connectionAutoConnect ?? true,
|
||||
onChanged: (value) async {
|
||||
await ref
|
||||
@@ -95,13 +95,13 @@ class _ConnectionSection extends ConsumerWidget {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text('Gekoppelte Geraete', style: Theme.of(context).textTheme.titleSmall),
|
||||
Text('Paired devices', style: Theme.of(context).textTheme.titleSmall),
|
||||
const SizedBox(height: 4),
|
||||
bondedDevices.when(
|
||||
data: (devices) => devices.isEmpty
|
||||
? const Text(
|
||||
'Keine gekoppelten Geraete. Ueber "Geraet koppeln" '
|
||||
'zunaechst einmalig ueber den Systemdialog koppeln.',
|
||||
'No paired devices yet. Pair one once via the system '
|
||||
'dialog using "Pair device".',
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey),
|
||||
)
|
||||
: RadioGroup<String>(
|
||||
@@ -129,13 +129,13 @@ class _ConnectionSection extends ConsumerWidget {
|
||||
child: LinearProgressIndicator(),
|
||||
),
|
||||
error: (e, _) => Text(
|
||||
'Gekoppelte Geraete konnten nicht gelesen werden: $e',
|
||||
'Could not read paired devices: $e',
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Verbindungsprotokoll ($packetCount Datenpakete empfangen)',
|
||||
'Connection log ($packetCount packets received)',
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
@@ -143,7 +143,7 @@ class _ConnectionSection extends ConsumerWidget {
|
||||
height: 120,
|
||||
child: log.isEmpty
|
||||
? const Text(
|
||||
'Noch keine Ereignisse.',
|
||||
'No events yet.',
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey),
|
||||
)
|
||||
: ListView.builder(
|
||||
@@ -203,10 +203,10 @@ class _StatePill extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final (label, color) = switch (state) {
|
||||
LinkState.connected => ('Verbunden', DmcColors.liveGreen),
|
||||
LinkState.connecting => ('Verbinde ...', DmcColors.pafAmber),
|
||||
LinkState.error => ('Fehler', DmcColors.warnRed),
|
||||
LinkState.disconnected || null => ('Getrennt', Colors.grey),
|
||||
LinkState.connected => ('Connected', DmcColors.liveGreen),
|
||||
LinkState.connecting => ('Connecting…', DmcColors.pafAmber),
|
||||
LinkState.error => ('Error', DmcColors.warnRed),
|
||||
LinkState.disconnected || null => ('Disconnected', Colors.grey),
|
||||
};
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
@@ -229,29 +229,28 @@ class _ErrorHint extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final (text, action) = switch (reason) {
|
||||
LinkErrorReason.bluetoothOff => (
|
||||
'Bluetooth ist aus. Bitte in den Systemeinstellungen einschalten.',
|
||||
_HintAction('Einstellungen', BluetoothSystemSettings.openBluetoothSettings),
|
||||
'Bluetooth is off. Please enable it in system settings.',
|
||||
_HintAction('Settings', BluetoothSystemSettings.openBluetoothSettings),
|
||||
),
|
||||
LinkErrorReason.permissionDenied => (
|
||||
'"Geraete in der Naehe"-Berechtigung wird benoetigt. Bitte erneut '
|
||||
'auf "Verbinden" tippen.',
|
||||
'The "Nearby devices" permission is required. Please tap '
|
||||
'"Connect" again.',
|
||||
null,
|
||||
),
|
||||
LinkErrorReason.permissionDeniedPermanently => (
|
||||
'"Geraete in der Naehe"-Berechtigung wurde dauerhaft abgelehnt. '
|
||||
'Bitte in den App-Einstellungen manuell erteilen.',
|
||||
_HintAction('App-Einstellungen', BluetoothSystemSettings.openAppSettings),
|
||||
'The "Nearby devices" permission was permanently denied. Please '
|
||||
'grant it manually in the app settings.',
|
||||
_HintAction('App settings', BluetoothSystemSettings.openAppSettings),
|
||||
),
|
||||
LinkErrorReason.deviceSelectionRequired => (
|
||||
'Kein gekoppeltes mLRS-Geraet gefunden. Bitte unten ein Geraet '
|
||||
'auswaehlen.',
|
||||
'No paired mLRS device found. Please select a device below.',
|
||||
null,
|
||||
),
|
||||
LinkErrorReason.connectionFailed => (
|
||||
'Verbindung zum Geraet ist fehlgeschlagen.',
|
||||
'Connection to the device failed.',
|
||||
null,
|
||||
),
|
||||
LinkErrorReason.unknown => ('Unbekannter Verbindungsfehler.', null),
|
||||
LinkErrorReason.unknown => ('Unknown connection error.', null),
|
||||
};
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
|
||||
Reference in New Issue
Block a user