机器状态界面UIbug修复
This commit is contained in:
@@ -18,7 +18,6 @@ class RunningStatusPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _RunningStatusPageState extends State<RunningStatusPage> {
|
||||
|
||||
final _dispatcher = sl<NetMessageDispatcher>();
|
||||
late StreamSubscription<RawPacket> _sub;
|
||||
|
||||
@@ -56,22 +55,22 @@ class _RunningStatusPageState extends State<RunningStatusPage> {
|
||||
// 至少需 16 个字段(索引 10=航向角, 13=卫星数, 14=定位质量)
|
||||
if (fields.length >= 16) {
|
||||
setState(() {
|
||||
_voltage = fields[0]; // 电压
|
||||
_leftSpeed = fields[1]; // 左轮目标速度
|
||||
_rightSpeed = fields[2]; // 右轮目标速度
|
||||
_pitch = fields[11]; // 俯仰角
|
||||
_roll = fields[12]; // 翻滚角
|
||||
_latitude = fields[16]; // 纬度
|
||||
_longitude = fields[17]; // 经度
|
||||
_voltage = fields[0]; // 电压
|
||||
_leftSpeed = fields[1]; // 左轮目标速度
|
||||
_rightSpeed = fields[2]; // 右轮目标速度
|
||||
_pitch = fields[11]; // 俯仰角
|
||||
_roll = fields[12]; // 翻滚角
|
||||
_latitude = fields[16]; // 纬度
|
||||
_longitude = fields[17]; // 经度
|
||||
_timeStamp = '${fields[16]} ${fields[17]}'; // 时间戳(合并字段)
|
||||
_knifeCuttingSpeed = fields[19]; // 割刀速度
|
||||
_controlMode = fields[20]; // 控制模式
|
||||
_workingArea = fields[21]; // 作业面积
|
||||
_battery = fields[22]; // 电量
|
||||
_obstacleFlag = fields[23]; // 障碍物标志
|
||||
_yaw = fields[10]; // 航向角
|
||||
_satelliteCnt = fields[13]; // 卫星数
|
||||
_qual = fields[14]; // 定位质量
|
||||
_controlMode = fields[20]; // 控制模式
|
||||
_workingArea = fields[21]; // 作业面积
|
||||
_battery = fields[22]; // 电量
|
||||
_obstacleFlag = fields[23]; // 障碍物标志
|
||||
_yaw = fields[10]; // 航向角
|
||||
_satelliteCnt = fields[13]; // 卫星数
|
||||
_qual = fields[14]; // 定位质量
|
||||
});
|
||||
}
|
||||
} catch (_) {
|
||||
@@ -90,13 +89,9 @@ class _RunningStatusPageState extends State<RunningStatusPage> {
|
||||
final currentDevice = deviceState.selectedDevice;
|
||||
|
||||
if (currentDevice != null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text("数据刷新成功!"), duration: Duration(seconds: 1)),
|
||||
);
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("数据刷新成功!"), duration: Duration(seconds: 1)));
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text("暂无设备,无法刷新"), duration: Duration(seconds: 1)),
|
||||
);
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("暂无设备,无法刷新"), duration: Duration(seconds: 1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,9 +101,7 @@ class _RunningStatusPageState extends State<RunningStatusPage> {
|
||||
final currentDevice = deviceState.selectedDevice;
|
||||
|
||||
if (currentDevice == null) {
|
||||
return const Scaffold(
|
||||
body: Center(child: Text("加载中...")),
|
||||
);
|
||||
return const Scaffold(body: Center(child: Text("加载中...")));
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
@@ -191,10 +184,7 @@ class _RunningStatusPageState extends State<RunningStatusPage> {
|
||||
SliverFillRemaining(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
child: _isCardView ? _buildCardContentView() : _buildChartContentView(),
|
||||
),
|
||||
),
|
||||
@@ -218,7 +208,8 @@ class _RunningStatusPageState extends State<RunningStatusPage> {
|
||||
}
|
||||
|
||||
Widget _buildCardContentView() {
|
||||
return Padding(
|
||||
return SingleChildScrollView(
|
||||
// 添加 SingleChildScrollView 使内容可滚动
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
Reference in New Issue
Block a user