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