fix bug
This commit is contained in:
parent
6e0c8e943f
commit
ce53e93864
@ -10,6 +10,7 @@ import 'package:airhub_app/pages/product_selection_page.dart';
|
||||
import 'package:airhub_app/widgets/glass_dialog.dart';
|
||||
import 'package:airhub_app/features/auth/presentation/controllers/auth_controller.dart';
|
||||
import 'package:airhub_app/features/system/data/datasources/system_remote_data_source.dart';
|
||||
import 'package:airhub_app/features/device/presentation/controllers/device_controller.dart';
|
||||
|
||||
class SettingsPage extends ConsumerStatefulWidget {
|
||||
const SettingsPage({super.key});
|
||||
@ -23,6 +24,8 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// watch 保持 provider 存活,确保硬件信息可用
|
||||
ref.watch(deviceControllerProvider);
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Stack(
|
||||
@ -81,10 +84,7 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
|
||||
_buildItem(
|
||||
'💻',
|
||||
'硬件信息',
|
||||
onTap: () => _showMessage(
|
||||
'硬件信息',
|
||||
'设备型号: Airhub_5G\n固件版本: 2.1.3',
|
||||
),
|
||||
onTap: _showHardwareInfo,
|
||||
),
|
||||
_buildItem(
|
||||
'📄',
|
||||
@ -294,6 +294,24 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void _showHardwareInfo() {
|
||||
final devicesAsync = ref.read(deviceControllerProvider);
|
||||
final devices = devicesAsync.value ?? [];
|
||||
final firstDevice = devices.isNotEmpty ? devices.first : null;
|
||||
|
||||
final deviceModel = firstDevice?.device.deviceTypeInfo?.name ?? '未知';
|
||||
final sn = firstDevice?.device.sn ?? '未知';
|
||||
final firmwareVersion = firstDevice?.device.firmwareVersion;
|
||||
final fwDisplay = (firmwareVersion != null && firmwareVersion.isNotEmpty)
|
||||
? firmwareVersion
|
||||
: '等待设备上报';
|
||||
|
||||
_showMessage(
|
||||
'硬件信息',
|
||||
'设备型号: $deviceModel\nSN码: $sn\n固件版本: $fwDisplay',
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _checkUpdate() async {
|
||||
try {
|
||||
final ds = ref.read(systemRemoteDataSourceProvider);
|
||||
|
||||
14
airhub_app/restart.sh
Executable file
14
airhub_app/restart.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# 重新编译并启动 Flutter Web (localhost:8080)
|
||||
|
||||
# 杀掉占用 8080 端口的进程
|
||||
PID=$(lsof -ti:8080 2>/dev/null)
|
||||
if [ -n "$PID" ]; then
|
||||
echo "正在停止旧进程 (PID: $PID)..."
|
||||
kill $PID 2>/dev/null
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
echo "正在编译并启动 Flutter Web..."
|
||||
cd "$(dirname "$0")"
|
||||
flutter run -d web-server --web-port=8080 --no-pub
|
||||
Loading…
x
Reference in New Issue
Block a user