第二次提交
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import 'package:cc_ui_kit/cc_ui_kit.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../bloc/remote_control_cubit.dart';
|
||||
|
||||
class LeftJoystickArea extends StatelessWidget {
|
||||
final bool isLocked;
|
||||
|
||||
const LeftJoystickArea({super.key, required this.isLocked});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min, // 紧凑布局
|
||||
children: [
|
||||
// 使用 IgnorePointer 处理锁定逻辑,对应 Android 的 isLocked 判断
|
||||
IgnorePointer(
|
||||
ignoring: isLocked,
|
||||
child: AnimatedOpacity(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
opacity: isLocked ? 0.3 : 1.0, // 锁定后变透明
|
||||
child: CCJoystick(
|
||||
radius: 100, // 对应 size(200.dp)
|
||||
axisHint: AxisHint.forwardBackward,
|
||||
onValueChanged: (value) {
|
||||
// 对应 viewModel.updateOriginY(y)
|
||||
context.read<RemoteControlCubit>().updateOriginY(value.y);
|
||||
},
|
||||
onPress: () {
|
||||
// 对应 VibrateOnce(current, 100)
|
||||
HapticFeedback.mediumImpact();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
"前后控制",
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user