对接远程遥控
This commit is contained in:
@@ -76,7 +76,7 @@ class DroneStationBloc extends Bloc<DroneStationEvent, DroneStationState> {
|
||||
|
||||
result.fold(
|
||||
(failure) => emit(VideoStreamError(failure.message)),
|
||||
(videoStream) => emit(VideoStreamLoaded(videoStream)),
|
||||
(videoStream) => emit(VideoStreamLoaded(videoStream, event.cameraPosition)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import '../../domain/entities/drone_station_entity.dart';
|
||||
import '../../domain/entities/video_stream_entity.dart';
|
||||
|
||||
abstract class DroneStationState extends Equatable {
|
||||
const DroneStationState();
|
||||
@@ -62,11 +63,12 @@ class VideoStreamLoading extends DroneStationState {
|
||||
|
||||
class VideoStreamLoaded extends DroneStationState {
|
||||
final VideoStreamEntity videoStream;
|
||||
final String cameraPosition;
|
||||
|
||||
const VideoStreamLoaded(this.videoStream);
|
||||
const VideoStreamLoaded(this.videoStream, this.cameraPosition);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [videoStream];
|
||||
List<Object?> get props => [videoStream, cameraPosition];
|
||||
}
|
||||
|
||||
class VideoStreamError extends DroneStationState {
|
||||
@@ -76,4 +78,4 @@ class VideoStreamError extends DroneStationState {
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../../core/di/injection.dart';
|
||||
import '../../../../../core/app/app_user_cubit.dart';
|
||||
import '../../../../../components/tcp_status_indicator.dart';
|
||||
import '../../../../v2/site/presentation/cubit/site_cubit.dart';
|
||||
import '../bloc/device_status_bloc.dart';
|
||||
import '../bloc/device_status_event.dart';
|
||||
@@ -14,6 +15,7 @@ import '../widgets/device_item_widget.dart';
|
||||
import '../widgets/drone_station_item_card.dart';
|
||||
import 'robot_list_page.dart';
|
||||
import 'drone_station_detail_page.dart';
|
||||
|
||||
/// 设备状态页面 - 使用 BLoC 模式
|
||||
class DeviceStatusPage extends StatelessWidget {
|
||||
const DeviceStatusPage({super.key});
|
||||
@@ -22,9 +24,10 @@ class DeviceStatusPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final selectedSite = sl<SiteCubit>().state.selectedSite;
|
||||
final siteId = selectedSite?.id;
|
||||
|
||||
|
||||
return BlocProvider(
|
||||
create: (_) => sl<DeviceStatusBloc>()..add(DeviceStatusLoadData(siteId: siteId)),
|
||||
create: (_) =>
|
||||
sl<DeviceStatusBloc>()..add(DeviceStatusLoadData(siteId: siteId)),
|
||||
child: const DeviceStatusView(),
|
||||
);
|
||||
}
|
||||
@@ -51,9 +54,7 @@ class DeviceStatusView extends StatelessWidget {
|
||||
_buildAppBar(),
|
||||
_buildSearchBar(context),
|
||||
_buildTypeFilterBar(context),
|
||||
Expanded(
|
||||
child: _buildContent(context, state),
|
||||
),
|
||||
Expanded(child: _buildContent(context, state)),
|
||||
],
|
||||
);
|
||||
},
|
||||
@@ -67,9 +68,9 @@ class DeviceStatusView extends StatelessWidget {
|
||||
return Container(
|
||||
height: 44.0,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: const Row(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'设备状态',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
@@ -77,11 +78,23 @@ class DeviceStatusView extends StatelessWidget {
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons.more_vert,
|
||||
size: 24,
|
||||
color: Color(0xFF1D2129),
|
||||
const Spacer(),
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'TCP',
|
||||
style: TextStyle(fontSize: 12, color: Color(0xFF86909C)),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.blue.withOpacity(0.1),
|
||||
),
|
||||
child: const TcpStatusIndicator(size: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -94,10 +107,7 @@ class DeviceStatusView extends StatelessWidget {
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: '搜索设备名称/编号',
|
||||
hintStyle: const TextStyle(
|
||||
color: Color(0xFF86909C),
|
||||
fontSize: 14,
|
||||
),
|
||||
hintStyle: const TextStyle(color: Color(0xFF86909C), fontSize: 14),
|
||||
prefixIcon: const Icon(
|
||||
Icons.search,
|
||||
color: Color(0xFF86909C),
|
||||
@@ -120,34 +130,22 @@ class DeviceStatusView extends StatelessWidget {
|
||||
fillColor: const Color(0xFFF2F3F5),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0xFFE5E6EB),
|
||||
width: 1,
|
||||
),
|
||||
borderSide: const BorderSide(color: Color(0xFFE5E6EB), width: 1),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0xFFE5E6EB),
|
||||
width: 1,
|
||||
),
|
||||
borderSide: const BorderSide(color: Color(0xFFE5E6EB), width: 1),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0xFF165DFF),
|
||||
width: 1,
|
||||
),
|
||||
borderSide: const BorderSide(color: Color(0xFF165DFF), width: 1),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 12,
|
||||
),
|
||||
),
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
style: const TextStyle(fontSize: 14, color: Color(0xFF1D2129)),
|
||||
onSubmitted: (value) {
|
||||
// 🔥 点击键盘确定键时触发搜索
|
||||
context.read<DeviceStatusBloc>().add(DeviceStatusSearch(value));
|
||||
@@ -180,7 +178,9 @@ class DeviceStatusView extends StatelessWidget {
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
context.read<DeviceStatusBloc>().add(DeviceStatusChangeType(type));
|
||||
context.read<DeviceStatusBloc>().add(
|
||||
DeviceStatusChangeType(type),
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -190,8 +190,12 @@ class DeviceStatusView extends StatelessWidget {
|
||||
type,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: isSelected ? const Color(0xFF135BFF) : const Color(0xFF666666),
|
||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
|
||||
color: isSelected
|
||||
? const Color(0xFF135BFF)
|
||||
: const Color(0xFF666666),
|
||||
fontWeight: isSelected
|
||||
? FontWeight.w600
|
||||
: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
@@ -199,12 +203,13 @@ class DeviceStatusView extends StatelessWidget {
|
||||
width: 20,
|
||||
height: 2,
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? const Color(0xFF0D57FF) : Colors.transparent,
|
||||
color: isSelected
|
||||
? const Color(0xFF0D57FF)
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(1),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -232,9 +237,7 @@ class DeviceStatusView extends StatelessWidget {
|
||||
Widget _buildDeviceList(BuildContext context, DeviceStatusState state) {
|
||||
if (state is DeviceStatusLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Color(0xFF165DFF),
|
||||
),
|
||||
child: CircularProgressIndicator(color: Color(0xFF165DFF)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -243,23 +246,18 @@ class DeviceStatusView extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.error_outline,
|
||||
size: 48,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
const Icon(Icons.error_outline, size: 48, color: Color(0xFF86909C)),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
state.message,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF4E5969),
|
||||
),
|
||||
style: const TextStyle(fontSize: 14, color: Color(0xFF4E5969)),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.read<DeviceStatusBloc>().add(const DeviceStatusLoadData());
|
||||
context.read<DeviceStatusBloc>().add(
|
||||
const DeviceStatusLoadData(),
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF165DFF),
|
||||
@@ -284,8 +282,12 @@ class DeviceStatusView extends StatelessWidget {
|
||||
// 🔥 再根据搜索关键词过滤
|
||||
final filteredDevices = filteredByType.where((device) {
|
||||
if (state.searchKeyword.isEmpty) return true;
|
||||
return device.name.toLowerCase().contains(state.searchKeyword.toLowerCase()) ||
|
||||
device.deviceId.toLowerCase().contains(state.searchKeyword.toLowerCase());
|
||||
return device.name.toLowerCase().contains(
|
||||
state.searchKeyword.toLowerCase(),
|
||||
) ||
|
||||
device.deviceId.toLowerCase().contains(
|
||||
state.searchKeyword.toLowerCase(),
|
||||
);
|
||||
}).toList();
|
||||
|
||||
return RefreshIndicator(
|
||||
@@ -328,24 +330,17 @@ class DeviceStatusView extends StatelessWidget {
|
||||
Widget _buildDroneStationList(BuildContext context) {
|
||||
// 从全局 SiteCubit 获取选中的场站 ID
|
||||
final selectedSite = sl<SiteCubit>().state.selectedSite;
|
||||
|
||||
|
||||
if (selectedSite == null) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.location_off,
|
||||
size: 48,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
const Icon(Icons.location_off, size: 48, color: Color(0xFF86909C)),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'请先选择场站',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF4E5969),
|
||||
),
|
||||
style: TextStyle(fontSize: 14, color: Color(0xFF4E5969)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -353,14 +348,13 @@ class DeviceStatusView extends StatelessWidget {
|
||||
}
|
||||
|
||||
return BlocProvider(
|
||||
create: (_) => sl<DroneStationBloc>()..add(DroneStationLoadData(selectedSite.id)),
|
||||
create: (_) =>
|
||||
sl<DroneStationBloc>()..add(DroneStationLoadData(selectedSite.id)),
|
||||
child: BlocBuilder<DroneStationBloc, DroneStationState>(
|
||||
builder: (context, state) {
|
||||
if (state is DroneStationLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Color(0xFF165DFF),
|
||||
),
|
||||
child: CircularProgressIndicator(color: Color(0xFF165DFF)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -385,7 +379,9 @@ class DeviceStatusView extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.read<DroneStationBloc>().add(DroneStationLoadData(selectedSite.id));
|
||||
context.read<DroneStationBloc>().add(
|
||||
DroneStationLoadData(selectedSite.id),
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF165DFF),
|
||||
@@ -405,17 +401,16 @@ class DeviceStatusView extends StatelessWidget {
|
||||
return const Center(
|
||||
child: Text(
|
||||
'该场站暂无无人机机场',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF4E5969),
|
||||
),
|
||||
style: TextStyle(fontSize: 14, color: Color(0xFF4E5969)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
context.read<DroneStationBloc>().add(DroneStationRefresh(selectedSite.id));
|
||||
context.read<DroneStationBloc>().add(
|
||||
DroneStationRefresh(selectedSite.id),
|
||||
);
|
||||
},
|
||||
color: const Color(0xFF165DFF),
|
||||
child: ListView.builder(
|
||||
@@ -429,7 +424,8 @@ class DeviceStatusView extends StatelessWidget {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => DroneStationDetailPage(station: station),
|
||||
builder: (context) =>
|
||||
DroneStationDetailPage(station: station),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -468,33 +464,21 @@ class DeviceStatusView extends StatelessWidget {
|
||||
dotColor: const Color(0xFF86909C),
|
||||
textColor: const Color(0xFF86909C), // 新增字体颜色
|
||||
),
|
||||
Container(
|
||||
width: 1,
|
||||
height: 40,
|
||||
color: const Color(0xFFE5E6EB),
|
||||
),
|
||||
Container(width: 1, height: 40, color: const Color(0xFFE5E6EB)),
|
||||
_buildStatItem(
|
||||
value: state.deviceStatus.online.toString(),
|
||||
label: '在线',
|
||||
dotColor: const Color(0xFF00B42A),
|
||||
textColor: const Color(0xFF00B42A),
|
||||
),
|
||||
Container(
|
||||
width: 1,
|
||||
height: 40,
|
||||
color: const Color(0xFFE5E6EB),
|
||||
),
|
||||
Container(width: 1, height: 40, color: const Color(0xFFE5E6EB)),
|
||||
_buildStatItem(
|
||||
value: state.deviceStatus.exception.toString(),
|
||||
label: '告警',
|
||||
dotColor: const Color(0xFFFF7D00),
|
||||
textColor: const Color(0xFFFF7D00),
|
||||
),
|
||||
Container(
|
||||
width: 1,
|
||||
height: 40,
|
||||
color: const Color(0xFFE5E6EB),
|
||||
),
|
||||
Container(width: 1, height: 40, color: const Color(0xFFE5E6EB)),
|
||||
_buildStatItem(
|
||||
value: state.deviceStatus.offline.toString(),
|
||||
label: '离线',
|
||||
@@ -549,5 +533,4 @@ class DeviceStatusView extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:volc_engine_rtc/volc_engine_rtc.dart' as volc;
|
||||
import 'package:agora_rtc_engine/agora_rtc_engine.dart' as agora;
|
||||
import '../../../../../core/di/injection.dart';
|
||||
import '../../domain/entities/drone_station_entity.dart';
|
||||
import '../../domain/entities/video_stream_entity.dart';
|
||||
import '../bloc/drone_station_bloc.dart';
|
||||
import '../bloc/drone_station_event.dart';
|
||||
import '../bloc/drone_station_state.dart';
|
||||
@@ -9,6 +12,9 @@ import 'drone_video_control_page.dart';
|
||||
import 'drone_mission_control_page.dart';
|
||||
import 'drone_monitor_page.dart';
|
||||
|
||||
// SDK 类型枚举
|
||||
enum RtcSdkType { volcengine, agora }
|
||||
|
||||
class DroneStationDetailPage extends StatefulWidget {
|
||||
final DroneStationEntity station;
|
||||
|
||||
@@ -26,6 +32,21 @@ class _DroneStationDetailPageState extends State<DroneStationDetailPage> {
|
||||
bool isFloatingIndoor = true;
|
||||
Offset floatingPosition = const Offset(20, 200);
|
||||
|
||||
// 视频流状态
|
||||
VideoStreamEntity? _floatingVideoStream;
|
||||
bool _isFloatingLoading = false;
|
||||
String? _floatingErrorMessage;
|
||||
String? _floatingRemoteUserId;
|
||||
bool _isFloatingAgora = false;
|
||||
|
||||
// 火山引擎 RTC
|
||||
volc.RTCEngine? _floatingRtcEngine;
|
||||
volc.RTCRoom? _floatingRtcRoom;
|
||||
volc.RTCViewContext? _floatingRemoteRenderContext;
|
||||
|
||||
// Agora RTC
|
||||
agora.RtcEngine? _floatingAgoraEngine;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -41,9 +62,42 @@ class _DroneStationDetailPageState extends State<DroneStationDetailPage> {
|
||||
@override
|
||||
void dispose() {
|
||||
_bloc.close();
|
||||
_destroyFloatingRtcEngine();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// 销毁悬浮窗的 RTC 引擎
|
||||
void _destroyFloatingRtcEngine() async {
|
||||
// 销毁火山引擎 RTC
|
||||
if (_floatingRtcRoom != null) {
|
||||
try {
|
||||
await _floatingRtcRoom?.leaveRoom();
|
||||
} catch (_) {}
|
||||
_floatingRtcRoom = null;
|
||||
}
|
||||
if (_floatingRtcEngine != null) {
|
||||
try {
|
||||
_floatingRtcEngine?.destroy();
|
||||
} catch (_) {}
|
||||
_floatingRtcEngine = null;
|
||||
}
|
||||
|
||||
// 销毁 Agora RTC
|
||||
if (_floatingAgoraEngine != null) {
|
||||
try {
|
||||
await _floatingAgoraEngine?.leaveChannel();
|
||||
} catch (_) {}
|
||||
try {
|
||||
_floatingAgoraEngine?.release();
|
||||
} catch (_) {}
|
||||
_floatingAgoraEngine = null;
|
||||
}
|
||||
|
||||
_floatingRemoteRenderContext = null;
|
||||
_floatingRemoteUserId = null;
|
||||
_isFloatingAgora = false;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider.value(
|
||||
@@ -67,7 +121,21 @@ class _DroneStationDetailPageState extends State<DroneStationDetailPage> {
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: BlocBuilder<DroneStationBloc, DroneStationState>(
|
||||
body: BlocConsumer<DroneStationBloc, DroneStationState>(
|
||||
listener: (context, state) {
|
||||
// 监听视频流加载状态
|
||||
if (state is VideoStreamLoaded) {
|
||||
setState(() {
|
||||
_floatingVideoStream = state.videoStream;
|
||||
});
|
||||
_initFloatingRtcEngine();
|
||||
} else if (state is VideoStreamError) {
|
||||
setState(() {
|
||||
_floatingErrorMessage = state.message;
|
||||
_isFloatingLoading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is UAVDetailLoading) {
|
||||
return const Center(
|
||||
@@ -449,7 +517,14 @@ class _DroneStationDetailPageState extends State<DroneStationDetailPage> {
|
||||
icon: Icons.task,
|
||||
label: '任务下发',
|
||||
color: const Color(0xFF165DFF),
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const DroneMissionControlPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -517,7 +592,7 @@ class _DroneStationDetailPageState extends State<DroneStationDetailPage> {
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
setState(() => showFloatingMonitor = true);
|
||||
_loadFloatingVideoStream();
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -639,7 +714,10 @@ class _DroneStationDetailPageState extends State<DroneStationDetailPage> {
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => setState(() => isFloatingIndoor = false),
|
||||
onTap: () {
|
||||
setState(() => isFloatingIndoor = false);
|
||||
_loadFloatingVideoStream();
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 6,
|
||||
@@ -665,7 +743,10 @@ class _DroneStationDetailPageState extends State<DroneStationDetailPage> {
|
||||
),
|
||||
// 关闭按钮
|
||||
GestureDetector(
|
||||
onTap: () => setState(() => showFloatingMonitor = false),
|
||||
onTap: () {
|
||||
_destroyFloatingRtcEngine();
|
||||
setState(() => showFloatingMonitor = false);
|
||||
},
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(4),
|
||||
child: Icon(
|
||||
@@ -775,6 +856,321 @@ class _DroneStationDetailPageState extends State<DroneStationDetailPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// 加载悬浮视频流
|
||||
void _loadFloatingVideoStream() {
|
||||
setState(() {
|
||||
_isFloatingLoading = true;
|
||||
_floatingErrorMessage = null;
|
||||
showFloatingMonitor = true;
|
||||
});
|
||||
|
||||
_destroyFloatingRtcEngine();
|
||||
|
||||
_bloc.add(
|
||||
VideoStreamLoad(
|
||||
sn: widget.station.gatewaySn,
|
||||
cameraIndex: '165-0-7',
|
||||
cameraPosition: isFloatingIndoor ? 'indoor' : 'outdoor',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 初始化悬浮窗的 RTC 引擎
|
||||
Future<void> _initFloatingRtcEngine() async {
|
||||
if (_floatingVideoStream == null) return;
|
||||
|
||||
final appId = _floatingVideoStream!.appId;
|
||||
final roomId = _floatingVideoStream!.roomId;
|
||||
final token = _floatingVideoStream!.token;
|
||||
final userId = _floatingVideoStream!.userId.isNotEmpty
|
||||
? _floatingVideoStream!.userId
|
||||
: 'user_${DateTime.now().millisecondsSinceEpoch}';
|
||||
|
||||
if (appId.isEmpty || roomId.isEmpty || token.isEmpty) {
|
||||
setState(() {
|
||||
_floatingErrorMessage = 'RTC 参数缺失';
|
||||
_isFloatingLoading = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
debugPrint('=== 悬浮窗 RTC 初始化 ===');
|
||||
debugPrint('AppId: $appId');
|
||||
debugPrint('RoomId: $roomId');
|
||||
debugPrint('UserId: $userId');
|
||||
debugPrint('URL Type: ${_floatingVideoStream!.urlType}');
|
||||
|
||||
final sdkType = _floatingVideoStream!.urlType.toLowerCase() == 'agora'
|
||||
? RtcSdkType.agora
|
||||
: RtcSdkType.volcengine;
|
||||
|
||||
if (sdkType == RtcSdkType.agora) {
|
||||
await _initFloatingAgoraEngine(appId, roomId, token, userId);
|
||||
} else {
|
||||
await _initFloatingVolcEngine(appId, roomId, token, userId);
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化悬浮窗的 Agora 引擎
|
||||
Future<void> _initFloatingAgoraEngine(
|
||||
String appId,
|
||||
String channelId,
|
||||
String token,
|
||||
String userId,
|
||||
) async {
|
||||
try {
|
||||
debugPrint('=== Agora 悬浮窗初始化 ===');
|
||||
_floatingAgoraEngine = agora.createAgoraRtcEngine();
|
||||
await _floatingAgoraEngine!.initialize(
|
||||
agora.RtcEngineContext(appId: appId),
|
||||
);
|
||||
debugPrint('Agora 引擎初始化成功');
|
||||
|
||||
// 启用视频模块
|
||||
_floatingAgoraEngine!.enableVideo();
|
||||
debugPrint('Agora 视频模块已启用');
|
||||
|
||||
_floatingAgoraEngine!.registerEventHandler(
|
||||
agora.RtcEngineEventHandler(
|
||||
onJoinChannelSuccess: (agora.RtcConnection connection, int elapsed) {
|
||||
debugPrint('✅ 悬浮窗 Agora 加入频道成功: ${connection.channelId}');
|
||||
},
|
||||
onUserJoined: (agora.RtcConnection connection, int uid, int elapsed) {
|
||||
debugPrint('✅ 悬浮窗 Agora 用户加入: uid=$uid');
|
||||
setState(() {
|
||||
_floatingRemoteUserId = uid.toString();
|
||||
_isFloatingAgora = true;
|
||||
_isFloatingLoading = false;
|
||||
});
|
||||
},
|
||||
onUserOffline:
|
||||
(
|
||||
agora.RtcConnection connection,
|
||||
int uid,
|
||||
agora.UserOfflineReasonType reason,
|
||||
) {
|
||||
debugPrint('悬浮窗 Agora 用户离开: $uid');
|
||||
if (uid.toString() == _floatingRemoteUserId) {
|
||||
setState(() {
|
||||
_floatingRemoteUserId = null;
|
||||
});
|
||||
}
|
||||
},
|
||||
onError: (agora.ErrorCodeType err, String msg) {
|
||||
debugPrint('❌ 悬浮窗 Agora 错误: $err - $msg');
|
||||
setState(() {
|
||||
_floatingErrorMessage = 'Agora RTC 错误:$err';
|
||||
_isFloatingLoading = false;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
await _floatingAgoraEngine!.joinChannel(
|
||||
token: token,
|
||||
channelId: channelId,
|
||||
uid: int.tryParse(userId) ?? 0,
|
||||
options: agora.ChannelMediaOptions(
|
||||
channelProfile:
|
||||
agora.ChannelProfileType.channelProfileLiveBroadcasting,
|
||||
clientRoleType: agora.ClientRoleType.clientRoleAudience,
|
||||
autoSubscribeVideo: true,
|
||||
autoSubscribeAudio: false,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint('❌ 悬浮窗 Agora RTC 初始化失败: $e');
|
||||
setState(() {
|
||||
_floatingErrorMessage = 'Agora RTC 初始化失败:$e';
|
||||
_isFloatingLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化悬浮窗的火山引擎
|
||||
Future<void> _initFloatingVolcEngine(
|
||||
String appId,
|
||||
String roomId,
|
||||
String token,
|
||||
String userId,
|
||||
) async {
|
||||
try {
|
||||
debugPrint('=== 悬浮窗 VolcEngine 初始化 ===');
|
||||
final engineEventHandler = volc.IRTCEngineEventHandler(
|
||||
onWarning: (volc.WarningCode code) {
|
||||
debugPrint('Volc 悬浮窗 Warning: $code');
|
||||
},
|
||||
onError: (volc.ErrorCode code) {
|
||||
debugPrint('Volc 悬浮窗 Error: $code');
|
||||
setState(() {
|
||||
_floatingErrorMessage = 'Volc RTC 错误:$code';
|
||||
_isFloatingLoading = false;
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
_floatingRtcEngine = await volc.RTCEngine.createRTCEngine(
|
||||
volc.RTCVideoContext(appId: appId, eventHandler: engineEventHandler),
|
||||
);
|
||||
|
||||
if (_floatingRtcEngine == null) {
|
||||
debugPrint('Volc 悬浮窗引擎创建失败');
|
||||
setState(() {
|
||||
_floatingErrorMessage = 'Volc RTC 引擎创建失败';
|
||||
_isFloatingLoading = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
_floatingRtcRoom = await _floatingRtcEngine!.createRTCRoom(roomId);
|
||||
|
||||
if (_floatingRtcRoom == null) {
|
||||
debugPrint('Volc 悬浮窗房间创建失败');
|
||||
setState(() {
|
||||
_floatingErrorMessage = 'Volc RTC 房间创建失败';
|
||||
_isFloatingLoading = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
final roomEventHandler = volc.IRTCRoomEventHandler(
|
||||
onUserPublishStreamVideo:
|
||||
(String userId, volc.StreamInfo streamInfo, bool isPublish) {
|
||||
debugPrint('Volc 悬浮窗 远端用户 $userId 视频流状态: $isPublish');
|
||||
setState(() {
|
||||
if (isPublish) {
|
||||
_floatingRemoteUserId = userId;
|
||||
_isFloatingAgora = false;
|
||||
_floatingRemoteRenderContext =
|
||||
volc.RTCViewContext.remoteContext(
|
||||
roomId: roomId,
|
||||
userId: userId,
|
||||
);
|
||||
_isFloatingLoading = false;
|
||||
} else {
|
||||
if (userId == _floatingRemoteUserId) {
|
||||
_floatingRemoteRenderContext = null;
|
||||
_floatingRemoteUserId = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onUserLeave: (String userId, int reason) {
|
||||
debugPrint('Volc 悬浮窗 用户离开: $userId');
|
||||
if (userId == _floatingRemoteUserId) {
|
||||
setState(() {
|
||||
_floatingRemoteRenderContext = null;
|
||||
_floatingRemoteUserId = null;
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
await _floatingRtcRoom?.setRTCRoomEventHandler(roomEventHandler);
|
||||
|
||||
await _floatingRtcRoom?.joinRoom(
|
||||
token: token,
|
||||
userInfo: volc.UserInfo(userId: userId, extraInfo: ''),
|
||||
userVisibility: true,
|
||||
roomConfig: volc.RoomConfig(
|
||||
isPublishAudio: false,
|
||||
isPublishVideo: false,
|
||||
isAutoSubscribeAudio: false,
|
||||
isAutoSubscribeVideo: true,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint('❌ 悬浮窗 Volc RTC 初始化失败: $e');
|
||||
setState(() {
|
||||
_floatingErrorMessage = 'Volc RTC 初始化失败:$e';
|
||||
_isFloatingLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 构建悬浮窗视频内容
|
||||
Widget _buildFloatingVideoContent() {
|
||||
if (_isFloatingLoading) {
|
||||
return Container(
|
||||
height: 140,
|
||||
color: const Color(0xFF0D1117),
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (_floatingErrorMessage != null) {
|
||||
return Container(
|
||||
height: 140,
|
||||
color: const Color(0xFF0D1117),
|
||||
child: Center(
|
||||
child: Text(
|
||||
_floatingErrorMessage!,
|
||||
style: const TextStyle(color: Colors.red, fontSize: 12),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (_floatingRemoteUserId == null) {
|
||||
return Container(
|
||||
height: 140,
|
||||
color: const Color(0xFF0D1117),
|
||||
child: const Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.video_camera_front, size: 32, color: Colors.grey),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
'等待视频流...',
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (_isFloatingAgora && _floatingAgoraEngine != null) {
|
||||
return SizedBox(
|
||||
height: 140,
|
||||
child: agora.AgoraVideoView(
|
||||
controller: agora.VideoViewController.remote(
|
||||
rtcEngine: _floatingAgoraEngine!,
|
||||
canvas: agora.VideoCanvas(uid: int.parse(_floatingRemoteUserId!)),
|
||||
connection: agora.RtcConnection(
|
||||
channelId: _floatingVideoStream?.roomId ?? '',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (!_isFloatingAgora && _floatingRemoteRenderContext != null) {
|
||||
return SizedBox(
|
||||
height: 140,
|
||||
child: volc.RTCSurfaceView(
|
||||
context: _floatingRemoteRenderContext!,
|
||||
renderMode: volc.VideoRenderMode.hidden,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Container(
|
||||
height: 140,
|
||||
color: const Color(0xFF0D1117),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'视频初始化中...',
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCameraListRow(String label, List<CameraInfo> cameras) {
|
||||
String value = cameras
|
||||
.map((c) => '${c.cameraIndex}:${c.cameraPosition}')
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../../../../core/router/route_paths.dart';
|
||||
import '../widgets/robot_header_card.dart';
|
||||
import '../widgets/robot_status_bar.dart';
|
||||
import '../widgets/robot_control_panel.dart';
|
||||
@@ -81,8 +83,7 @@ class RobotControlPage extends StatelessWidget {
|
||||
Widget _buildPathPlanningCard(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
// TODO: 跳转到路径规划页面
|
||||
debugPrint('点击路径规划');
|
||||
context.push(RoutePaths.routePlan);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import '../../../../../core/di/injection.dart';
|
||||
import '../../../../../core/logging/i_logger_service.dart';
|
||||
import '../../../../devices/presentation/bloc/devices_cubit.dart';
|
||||
import '../../../../devices/domain/entities/device_entity.dart';
|
||||
import '../../../../remote_control/presentation/bloc/remote_control_cubit.dart';
|
||||
import '../../../../v2/site/presentation/cubit/site_cubit.dart';
|
||||
import '../../data/models/robot_data_model.dart';
|
||||
import '../bloc/robot_list_bloc.dart';
|
||||
@@ -478,9 +481,12 @@ class _RobotListViewState extends State<RobotListView> {
|
||||
battery: robot.battery,
|
||||
task: robot.task,
|
||||
onTap: () {
|
||||
// 1. 将当前机器人设置为全局选中设备
|
||||
// final logger = sl<ILoggerService>();
|
||||
debugPrint('📱 [选中机器人] name: ${robot.name}, id: ${robot.id}, type: ${robot.type}, status: ${robot.status}, battery: ${robot.battery}, task: ${robot.task}');
|
||||
|
||||
// 1. 将当前机器人设置为全局待控制设备(用 robot.name 作为 deviceName)
|
||||
final device = DeviceEntity(
|
||||
deviceName: robot.id,
|
||||
deviceName: robot.name, // ✅ 修正: 用 name 而不是 id
|
||||
productId: -1,
|
||||
productName: robot.type,
|
||||
tenantId: 0,
|
||||
@@ -489,7 +495,9 @@ class _RobotListViewState extends State<RobotListView> {
|
||||
onlineStatus: robot.status == '在线' ? 1 : 0,
|
||||
);
|
||||
|
||||
context.read<DevicesCubit>().selectDevice(device);
|
||||
// 🔥 使用 GetIt 直接获取 RemoteControlCubit 单例
|
||||
final remoteCubit = GetIt.I<RemoteControlCubit>();
|
||||
remoteCubit.setTargetDevice(device);
|
||||
|
||||
// 2. 跳转到机器人控制页面
|
||||
final robotMap = {
|
||||
|
||||
@@ -18,7 +18,7 @@ class RobotControlPanel extends StatelessWidget {
|
||||
onTap: () {
|
||||
debugPrint('👆 控制面板被点击');
|
||||
debugPrint('📋 robot 数据: $robot');
|
||||
|
||||
|
||||
// 1. 将当前机器人设置为全局选中设备
|
||||
final device = DeviceEntity(
|
||||
deviceName: robot['name']?.toString() ?? '',
|
||||
@@ -29,146 +29,139 @@ class RobotControlPanel extends StatelessWidget {
|
||||
status: robot['status'] == '在线' ? 1 : 0,
|
||||
onlineStatus: robot['status'] == '在线' ? 1 : 0,
|
||||
);
|
||||
|
||||
|
||||
debugPrint('✅ 设置选中设备: ${device.deviceName}');
|
||||
context.read<DevicesCubit>().selectDevice(device);
|
||||
|
||||
// 打印当前选中的设备信息
|
||||
final selectedDevice = context.read<DevicesCubit>().state.selectedDevice;
|
||||
debugPrint('📱 当前选中设备信息:');
|
||||
debugPrint(' - deviceName: ${selectedDevice?.deviceName}');
|
||||
debugPrint(' - productName: ${selectedDevice?.productName}');
|
||||
debugPrint(' - status: ${selectedDevice?.status}');
|
||||
debugPrint(' - onlineStatus: ${selectedDevice?.onlineStatus}');
|
||||
|
||||
|
||||
// 🔥 同时设置为全局待控制设备
|
||||
final remoteCubit = sl<RemoteControlCubit>();
|
||||
remoteCubit.setTargetDevice(device);
|
||||
debugPrint('🎯 已设置 targetDevice: ${device.deviceName}');
|
||||
|
||||
// 🔥 在跳转前获取 DevicesCubit,避免在 builder 内部 context 找不到
|
||||
final devicesCubit = context.read<DevicesCubit>();
|
||||
|
||||
// 2. 跳转到远程遥控页面
|
||||
debugPrint('🚀 准备跳转...');
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => BlocProvider(
|
||||
create: (_) => sl<RemoteControlCubit>()..startControlLoop(),
|
||||
builder: (newContext) => MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider.value(
|
||||
value: remoteCubit,
|
||||
), // 🔥 复用已设置 targetDevice 的单例
|
||||
BlocProvider.value(value: devicesCubit), // 🔥 同时提供 DevicesCubit
|
||||
],
|
||||
child: const RemoteControlPage(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'控制面板',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// 方向控制盘
|
||||
Center(
|
||||
child: SizedBox(
|
||||
width: 120,
|
||||
height: 120,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
// 背景圆
|
||||
Container(
|
||||
width: 120,
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF5F6F8),
|
||||
shape: BoxShape.circle,
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'控制面板',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// 方向控制盘
|
||||
Center(
|
||||
child: SizedBox(
|
||||
width: 120,
|
||||
height: 120,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
// 背景圆
|
||||
Container(
|
||||
width: 120,
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF5F6F8),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
),
|
||||
// 上
|
||||
Positioned(
|
||||
top: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_upward, () {}),
|
||||
),
|
||||
// 下
|
||||
Positioned(
|
||||
bottom: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_downward, () {}),
|
||||
),
|
||||
// 左
|
||||
Positioned(
|
||||
left: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_back, () {}),
|
||||
),
|
||||
// 右
|
||||
Positioned(
|
||||
right: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_forward, () {}),
|
||||
),
|
||||
// 中心按钮
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Color(0xFF4080FF),
|
||||
Color(0xFF165DFF),
|
||||
// 上
|
||||
Positioned(
|
||||
top: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_upward, () {}),
|
||||
),
|
||||
// 下
|
||||
Positioned(
|
||||
bottom: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_downward, () {}),
|
||||
),
|
||||
// 左
|
||||
Positioned(
|
||||
left: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_back, () {}),
|
||||
),
|
||||
// 右
|
||||
Positioned(
|
||||
right: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_forward, () {}),
|
||||
),
|
||||
// 中心按钮
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [Color(0xFF4080FF), Color(0xFF165DFF)],
|
||||
),
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0xFF165DFF).withOpacity(0.3),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0xFF165DFF).withOpacity(0.3),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// 速度档位
|
||||
const Text(
|
||||
'速度档位',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF86909C),
|
||||
const SizedBox(height: 12),
|
||||
// 速度档位
|
||||
const Text(
|
||||
'速度档位',
|
||||
style: TextStyle(fontSize: 13, color: Color(0xFF86909C)),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildSpeedButton('低速', false, () {}),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: _buildSpeedButton('中速', true, () {}),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: _buildSpeedButton('高速', false, () {}),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: _buildSpeedButton('低速', false, () {})),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: _buildSpeedButton('中速', true, () {})),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: _buildSpeedButton('高速', false, () {})),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user