修复远程遥控的顶部的布局优化,
完成实现远程遥控的电压和电量和模式实时从tcp获取和展示
This commit is contained in:
@@ -27,7 +27,6 @@ class RemoteControlPage extends StatefulWidget {
|
||||
|
||||
class _RemoteControlPageState extends State<RemoteControlPage> {
|
||||
String _videoStreamUrl = "";
|
||||
StreamSubscription? _deviceStatusSubscription;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -36,17 +35,12 @@ class _RemoteControlPageState extends State<RemoteControlPage> {
|
||||
// 2. 隐藏状态栏和虚拟按键
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
|
||||
|
||||
// 🔥 关键:订阅 DeviceStatusBloc 的状态流
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
final remoteCubit = context.read<RemoteControlCubit>();
|
||||
final devicesCubit = context.read<DevicesCubit>();
|
||||
|
||||
remoteCubit.startControlLoop();
|
||||
// 🔥 关键:订阅 DeviceStatusBloc 的状态流
|
||||
remoteCubit.subscribeToDeviceStatus(devicesCubit.stream);
|
||||
|
||||
debugPrint('🚀 [遥控页面] 已启动控制循环和设备状态监听');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -54,7 +48,6 @@ class _RemoteControlPageState extends State<RemoteControlPage> {
|
||||
void dispose() {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
_deviceStatusSubscription?.cancel();
|
||||
context.read<RemoteControlCubit>().stopControlLoop();
|
||||
super.dispose();
|
||||
}
|
||||
@@ -167,7 +160,6 @@ class _RemoteControlPageState extends State<RemoteControlPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// 权限弹窗
|
||||
BlocBuilder<RemoteControlCubit, RemoteControlState>(
|
||||
buildWhen: (p, c) => p.showPermissionRequestDialog != c.showPermissionRequestDialog,
|
||||
|
||||
Reference in New Issue
Block a user