APP远程遥控推出页面释放权限集成-待测试

This commit is contained in:
2026-04-16 10:49:45 +08:00
parent c45f8ee867
commit 407bcf026c
5 changed files with 102 additions and 9 deletions

View File

@@ -28,11 +28,13 @@ class RemoteControlPage extends StatefulWidget {
class _RemoteControlPageState extends State<RemoteControlPage> {
String _videoStreamUrl = "";
late RemoteControlCubit _cubit;
DevicesCubit? _devicesCubit;
@override
void didChangeDependencies() {
super.didChangeDependencies();
_cubit = context.read<RemoteControlCubit>();
_devicesCubit = context.read<DevicesCubit>();
}
@override
void initState() {
@@ -53,9 +55,16 @@ class _RemoteControlPageState extends State<RemoteControlPage> {
@override
void dispose() {
// 释放远程控制权限
// _cubit.releasePermission("app");
//print("远程控制要推出啦");
final deviceState = _devicesCubit?.state;
if (deviceState?.selectedDevice != null) {
_cubit.releasePermission("app");
}
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
// context.read<RemoteControlCubit>().stopControlLoop();
_cubit.stopControlLoop();
super.dispose();
}
@@ -138,7 +147,7 @@ class _RemoteControlPageState extends State<RemoteControlPage> {
width: sideAreaWidth,
child: Align(
alignment: Alignment.bottomCenter,
child: LeftJoystickArea(isLocked: remoteState.isLocked, width: sideAreaWidth * 0.5 * 0.7),
child: LeftJoystickArea(isLocked: remoteState.isLocked, width: sideAreaWidth * 0.45),
),
),
@@ -156,7 +165,7 @@ class _RemoteControlPageState extends State<RemoteControlPage> {
width: sideAreaWidth,
child: Align(
alignment: Alignment.bottomCenter,
child: RightJoystickArea(isLocked: remoteState.isLocked, width: sideAreaWidth * 0.5 * 0.7),
child: RightJoystickArea(isLocked: remoteState.isLocked, width: sideAreaWidth * 0.45),
),
),
],