diff --git a/lib/features/home/presentation/widgets/map/testmap_pages.dart b/lib/features/home/presentation/widgets/map/testmap_pages.dart index f862faf1..1235e237 100644 --- a/lib/features/home/presentation/widgets/map/testmap_pages.dart +++ b/lib/features/home/presentation/widgets/map/testmap_pages.dart @@ -164,7 +164,7 @@ class _MapPageEnterpriseState extends State { child: BottomOperationPanel( // 传入初始值 initialRobotMode:RobotMode.point , - initialAreaMode: _currentAreaMode, + initialAreaMode: AreaMode.work, // 接收面板的事件回调 onComplete: () { // 完成按钮点击:关闭面板 @@ -172,12 +172,12 @@ class _MapPageEnterpriseState extends State { }, onRobotModeChanged: (mode) { // 接收机器人模式变更 - //setState(() => _currentRobotMode = mode); + setState(() => _currentRobotMode = mode); debugPrint('外部收到机器人模式:$mode'); }, onAreaModeChanged: (mode) { // 接收作业区域模式变更 - //setState(() => _currentAreaMode = mode); + setState(() => _currentAreaMode = mode); debugPrint('外部收到区域模式:$mode'); }, onAddTap: () { diff --git a/lib/features/home/presentation/widgets/path_list_pages.dart b/lib/features/home/presentation/widgets/path_list_pages.dart index 998feb21..0293edc2 100644 --- a/lib/features/home/presentation/widgets/path_list_pages.dart +++ b/lib/features/home/presentation/widgets/path_list_pages.dart @@ -210,356 +210,9 @@ class _VerticalFloatMenuState extends State { ); } - /// ================= 底部面板 ================= - /// - /// // 构建底部面板(和原有样式一致,无遮罩) - //Widget _buildBottomPanel() { - // return Container( - // decoration: const BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.vertical(top: Radius.circular(20)), - // boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 8)], - // ), - // padding: const EdgeInsets.all(16), - // constraints: const BoxConstraints(minHeight: 260), - // child: SingleChildScrollView( - // child: Column( - // mainAxisSize: MainAxisSize.min, - // children: [ - // // 顶部拖拽指示器(可选) - // Container( - // width: 40, - // height: 5, - // decoration: BoxDecoration( - // color: Colors.grey[300], - // borderRadius: BorderRadius.circular(3), - // ), - // ), - // const SizedBox(height: 16), - // // 面板核心内容 - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // DropdownButton( - // value: _robotMode, - // items: const [ - // DropdownMenuItem( - // value: RobotMode.point, - // child: Text("地图打点"), - // ), - // DropdownMenuItem( - // value: RobotMode.robot, - // child: Text("机器人模式"), - // ), - // ], - // onChanged: (v) { - // setState(() => _robotMode = v!); - // }, - // ), - // GestureDetector( - // onTap: () => debugPrint('点击了添加按钮'), - // child: Container( - // width: 60, - // height: 60, - // decoration: const BoxDecoration( - // color: Color(0xFF00C853), - // shape: BoxShape.circle, - // ), - // child: const Icon(Icons.add, color: Colors.white, size: 32), - // ), - // ), - // DropdownButton( - // value: _areaMode, - // items: const [ - // DropdownMenuItem(value: AreaMode.work, child: Text("作业区域")), - // DropdownMenuItem( - // value: AreaMode.obstacle, - // child: Text("障碍区域"), - // ), - // ], - // onChanged: (v) { - // setState(() => _areaMode = v!); - // }, - // ), - // ], - // ), - // const SizedBox(height: 32), - // // 操作按钮行 - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // children: [ - // _buildActionButton(Icons.delete_outline, '删除', false, () {}), - // _buildActionButton(Icons.undo_outlined, '撤回', false, () {}), - // _buildActionButton(Icons.check_outlined, '完成', true, () { - // setState(() => _isPanelOpen = false); // 完成后关闭面板 - // }), - // ], - // ), - // const SizedBox(height: 32), - // // 底部标签页切换 - // Container( - // decoration: BoxDecoration( - // color: Colors.grey[200], - // borderRadius: BorderRadius.circular(8), - // ), - // child: Row( - // children: [ - // Expanded( - // child: GestureDetector( - // onTap: () => debugPrint('切换到地块标签'), - // child: Container( - // padding: const EdgeInsets.symmetric(vertical: 10), - // decoration: BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.circular(8), - // ), - // child: const Center( - // child: Text( - // '地块', - // style: TextStyle( - // color: Colors.black87, - // fontSize: 16, - // ), - // ), - // ), - // ), - // ), - // ), - // Expanded( - // child: GestureDetector( - // onTap: () => debugPrint('切换到航线标签'), - // child: const Center( - // child: Text( - // '航线', - // style: TextStyle(color: Colors.grey, fontSize: 16), - // ), - // ), - // ), - // ), - // ], - // ), - // ), - // const SizedBox(height: 5), - // ], - // ), - // ), - // ); - //} - - void _showBottomPanel() { - showModalBottomSheet( - context: context, - // 关键1:设置弹窗可滚动,避免内容超出 - isScrollControlled: true, - barrierColor: Colors.transparent, - // 关键2:禁止点击空白区域关闭弹窗 - isDismissible: false, - // 关键3:禁止拖拽关闭弹窗(可选,根据需求) - enableDrag: false, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.vertical(top: Radius.circular(20)), - ), - builder: (context) { - return StatefulBuilder( - builder: (context, setState) { - // 关键2:移除固定高度,改用最小高度+自适应 - // 关键3:用SingleChildScrollView包裹,内容超出时可滚动 - return SingleChildScrollView( - // 关键4:适配底部安全区,避免被系统导航栏遮挡 - child: SafeArea( - child: Container( - padding: const EdgeInsets.all(16), - // 用最小高度替代固定高度,保证内容能完整显示 - constraints: const BoxConstraints(minHeight: 260), - child: Column( - // 关键5:设置mainAxisSize为min,Column高度自适应内容 - mainAxisSize: MainAxisSize.min, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - DropdownButton( - value: _robotMode, - items: const [ - DropdownMenuItem( - value: RobotMode.point, - child: Text("地图打点"), - ), - DropdownMenuItem( - value: RobotMode.robot, - child: Text("机器人模式"), - ), - ], - onChanged: (v) { - setState(() { - _robotMode = v!; - }); - }, - ), - GestureDetector( - onTap: () { - // 加号按钮点击逻辑 - debugPrint('点击了添加按钮'); - }, - child: Container( - width: 60, - height: 60, - decoration: const BoxDecoration( - color: Color(0xFF00C853), - shape: BoxShape.circle, - ), - child: const Icon( - Icons.add, - color: Colors.white, - size: 32, - ), - ), - ), - DropdownButton( - value: _areaMode, - items: const [ - DropdownMenuItem( - value: AreaMode.work, - child: Text("作业区域"), - ), - DropdownMenuItem( - value: AreaMode.obstacle, - child: Text("障碍区域"), - ), - ], - onChanged: (v) { - setState(() { - _areaMode = v!; - }); - }, - ), - ], - ), - const SizedBox(height: 32), - - // 操作按钮行 - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - _buildActionButton( - icon: Icons.delete_outline, - label: '删除', - isEnabled: false, - onTap: () {}, - ), - _buildActionButton( - icon: Icons.undo_outlined, - label: '撤回', - isEnabled: false, - onTap: () {}, - ), - _buildActionButton( - icon: Icons.check_outlined, - label: '完成', - isEnabled: true, - onTap: () { - // 完成按钮点击逻辑 - debugPrint('点击了完成按钮'); - Navigator.pop(context); // 关闭底部弹窗 - }, - ), - ], - ), - const SizedBox(height: 32), - - // 底部标签页切换 - Container( - decoration: BoxDecoration( - color: Colors.grey[200], - borderRadius: BorderRadius.circular(8), - ), - child: Row( - children: [ - Expanded( - child: GestureDetector( - onTap: () => debugPrint('切换到地块标签'), - child: Container( - padding: const EdgeInsets.symmetric( - vertical: 10, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - ), - child: const Center( - child: Text( - '地块', - style: TextStyle( - color: Colors.black87, - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - ), - ), - ), - ), - Expanded( - child: GestureDetector( - onTap: () => debugPrint('切换到航线标签'), - child: const Center( - child: Text( - '航线', - style: TextStyle( - color: Colors.grey, - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - ), - ), - ), - ], - ), - ), - const SizedBox(height: 5), // 底部留白 - ], - ), - ), - ), - ); - }, - ); - }, - ); - } - - Widget _buildActionButton({ - required IconData icon, - required String label, - required bool isEnabled, - required VoidCallback onTap, - }) { - return InkWell( - onTap: isEnabled ? onTap : null, - child: Column( - children: [ - Container( - width: 50, - height: 50, - decoration: BoxDecoration( - color: isEnabled ? Colors.blue : Colors.grey[300], - shape: BoxShape.circle, - ), - child: Icon(icon, color: Colors.white), - ), - const SizedBox(height: 6), - Text( - label, - style: TextStyle(color: isEnabled ? Colors.black : Colors.grey), - ), - ], - ), - ); - } void _handleSubmit() { debugPrint("作业模式: $_selectedWorkMode"); diff --git a/lib/features/home/presentation/widgets/startpoint_area.dart b/lib/features/home/presentation/widgets/startpoint_area.dart index f2ba00cc..658fa17c 100644 --- a/lib/features/home/presentation/widgets/startpoint_area.dart +++ b/lib/features/home/presentation/widgets/startpoint_area.dart @@ -122,8 +122,8 @@ class _BottomOperationPanelState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - _buildActionButton(Icons.delete_outline, '删除', false, () {}), - _buildActionButton(Icons.undo_outlined, '撤回', false, () {}), + _buildActionButton(Icons.delete_outline, '删除', true, () {}), + _buildActionButton(Icons.undo_outlined, '撤回', true, () {}), _buildActionButton(Icons.check_outlined, '完成', true, () { // 触发完成按钮回调,通知外部关闭面板 widget.onComplete.call(); @@ -199,18 +199,19 @@ class _BottomOperationPanelState extends State { onTap: isEnabled ? onTap : null, child: Column( children: [ - Icon( - icon, - color: isEnabled ? Colors.black87 : Colors.grey[400], - size: 32, + Container( + width: 50, + height: 50, + decoration: BoxDecoration( + color: isEnabled ? Colors.blue : Colors.grey[300], + shape: BoxShape.circle, + ), + child: Icon(icon, color: Colors.white), ), - const SizedBox(height: 8), + const SizedBox(height: 6), Text( label, - style: TextStyle( - color: isEnabled ? Colors.black87 : Colors.grey[400], - fontSize: 16, - ), + style: TextStyle(color: isEnabled ? Colors.black : Colors.grey), ), ], ),