feat: ui rework and gear generator
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import 'package:abawo_bt_app/controller/bluetooth.dart';
|
||||
import 'package:abawo_bt_app/controller/shifter_device_telemetry.dart';
|
||||
import 'package:abawo_bt_app/database/database.dart';
|
||||
import 'package:abawo_bt_app/model/bluetooth_device_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -253,7 +254,7 @@ class _SavedDevicesListState extends ConsumerState<_SavedDevicesList> {
|
||||
}
|
||||
}
|
||||
|
||||
class _ActiveDeviceCard extends StatelessWidget {
|
||||
class _ActiveDeviceCard extends ConsumerWidget {
|
||||
const _ActiveDeviceCard({
|
||||
required this.devices,
|
||||
required this.connectionData,
|
||||
@ -263,7 +264,7 @@ class _ActiveDeviceCard extends StatelessWidget {
|
||||
final (ConnectionStatus, String?)? connectionData;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final shifterDevices = devices
|
||||
.where(
|
||||
(device) =>
|
||||
@ -291,11 +292,14 @@ class _ActiveDeviceCard extends StatelessWidget {
|
||||
final isConnected = connectedId == primaryDevice.deviceAddress &&
|
||||
connectionData?.$1 == ConnectionStatus.connected;
|
||||
|
||||
// TODO(yannik): Populate battery, signal, and firmware from real device
|
||||
// telemetry once these values are exposed in the saved-device overview.
|
||||
const batteryLabel = '--';
|
||||
final telemetry = ref.watch(
|
||||
shifterDeviceTelemetryCacheProvider.select(
|
||||
(cache) => cache[primaryDevice.deviceAddress],
|
||||
),
|
||||
);
|
||||
final batteryLabel = telemetry?.batteryLabel ?? '--';
|
||||
const signalLabel = 'Ready';
|
||||
const firmwareLabel = '--';
|
||||
final firmwareLabel = telemetry?.firmwareLabel ?? '--';
|
||||
|
||||
return Card(
|
||||
child: Padding(
|
||||
@ -350,7 +354,7 @@ class _ActiveDeviceCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
Row(
|
||||
children: const [
|
||||
children: [
|
||||
Expanded(
|
||||
child: _MetricTile(
|
||||
label: 'Battery',
|
||||
@ -358,15 +362,15 @@ class _ActiveDeviceCard extends StatelessWidget {
|
||||
icon: Icons.battery_charging_full_rounded,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Expanded(
|
||||
const SizedBox(width: 10),
|
||||
const Expanded(
|
||||
child: _MetricTile(
|
||||
label: 'Signal',
|
||||
value: signalLabel,
|
||||
icon: Icons.signal_cellular_alt,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: _MetricTile(
|
||||
label: 'Firmware',
|
||||
|
||||
Reference in New Issue
Block a user