refactor(home): 优化运行状态监控界面布局和参数显示

- 将程序名文本包装在Flexible组件中并添加省略号处理
- 为步骤信息添加Flexible组件以改善布局
- 使用ScrollableVIew包装内容以支持滚动
- 重构步骤参数显示为三列布局
- 移除硬编码的温度和磁力时间参数
- 更新速度、持续时间和样品体积的单位显示
- 从状态栏移除设备名称显示
- 从设置菜单移除USB导入功能选项
This commit is contained in:
Developer
2026-06-04 17:47:12 +08:00
parent 736c36a98e
commit 87c4b669a0
3 changed files with 87 additions and 130 deletions

View File

@@ -25,6 +25,7 @@ class RunStatusMonitor extends ConsumerWidget {
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppTheme.borderSubtle, width: 1), border: Border.all(color: AppTheme.borderSubtle, width: 1),
), ),
child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@@ -40,14 +41,18 @@ class RunStatusMonitor extends ConsumerWidget {
), ),
), ),
const Spacer(), const Spacer(),
Text( Flexible(
child: Text(
runState.currentProgram?.name ?? '', runState.currentProgram?.name ?? '',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle( style: const TextStyle(
color: AppTheme.accentPrimary, color: AppTheme.accentPrimary,
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
),
], ],
), ),
@@ -64,12 +69,14 @@ class RunStatusMonitor extends ConsumerWidget {
), ),
const SizedBox(width: 20), const SizedBox(width: 20),
// 当前步骤 // 当前步骤
_buildInfoBlock( Flexible(
child: _buildInfoBlock(
label: l10n?.currentStep ?? '当前步骤', label: l10n?.currentStep ?? '当前步骤',
value: '${l10n?.stepNo ?? '步骤'} ${runState.currentStepIndex + 1}', value: '${l10n?.stepNo ?? '步骤'} ${runState.currentStepIndex + 1}',
subValue: runState.currentStep?.name ?? '--', subValue: runState.currentStep?.name ?? '--',
valueColor: AppTheme.accentInfo, valueColor: AppTheme.accentInfo,
), ),
),
const SizedBox(width: 20), const SizedBox(width: 20),
// 剩余时间 // 剩余时间
_buildInfoBlock( _buildInfoBlock(
@@ -93,6 +100,7 @@ class RunStatusMonitor extends ConsumerWidget {
_buildStepParams(l10n, runState.currentStep!), _buildStepParams(l10n, runState.currentStep!),
], ],
), ),
),
); );
} }
@@ -190,53 +198,26 @@ class RunStatusMonitor extends ConsumerWidget {
fontSize: 11, fontSize: 11,
), ),
), ),
const SizedBox(height: 2), const SizedBox(height: 8),
if (step.mixTime > 0) Row(
_buildParamRow(
l10n?.speed ?? '转速',
'${step.speed}',
),
if (step.magnetTime > 0)
_buildParamRow(
l10n?.temperature ?? '温度',
'65.0 °C',
),
_buildParamRow(
l10n?.duration ?? '持续时间',
step.mixTime > 0 ? '${step.mixTime} min' : '--',
),
_buildParamRow(
l10n?.sampleVolume ?? '样品体积',
'10.0 mL',
),
],
);
}
/// 参数行
Widget _buildParamRow(String label, String value) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
children: [ children: [
Text( _buildInfoBlock(
label, label: l10n?.speed ?? '速度',
style: const TextStyle( value: '${step.speed} ${l10n?.speedLevel ?? ''}',
color: AppTheme.textTertiary,
fontSize: 11,
), ),
const SizedBox(width: 20),
_buildInfoBlock(
label: l10n?.duration ?? '持续时间',
value: '${step.mixTime} s',
), ),
const Spacer(), const SizedBox(width: 20),
Text( _buildInfoBlock(
value, label: l10n?.sampleVolume ?? '样品体积',
style: const TextStyle( value: '${step.volume} μL',
color: AppTheme.textPrimary,
fontSize: 11,
fontFamily: 'monospace',
),
), ),
], ],
), ),
],
); );
} }
} }

View File

@@ -94,22 +94,8 @@ class _StatusBarState extends ConsumerState<StatusBar> {
], ],
), ),
child: Row( child: Row(
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: [ children: [
const Icon(Icons.precision_manufacturing, color: Colors.white, size: 22), const Icon(Icons.precision_manufacturing, color: Colors.white, size: 22),
const SizedBox(width: 10),
Text(
l10n?.deviceName ?? '污水毒品前处理一体机',
style: const TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w700,
),
),
],
),
if (widget.tabs.isNotEmpty) ...[ if (widget.tabs.isNotEmpty) ...[
const SizedBox(width: 32), const SizedBox(width: 32),
_buildNavTabs(), _buildNavTabs(),

View File

@@ -5,10 +5,9 @@ import '../../../core/theme/app_theme.dart';
import '../../../shared/widgets/common_button.dart'; import '../../../shared/widgets/common_button.dart';
import '../widgets/language_panel.dart'; import '../widgets/language_panel.dart';
import '../widgets/password_panel.dart'; import '../widgets/password_panel.dart';
import '../widgets/usb_import_panel.dart';
/// 设置页菜单 /// 设置页菜单
enum _SettingsMenu { upgrade, language, password, usbImport } enum _SettingsMenu { upgrade, language, password }
/// 系统设置页面 /// 系统设置页面
class SettingsPage extends ConsumerStatefulWidget { class SettingsPage extends ConsumerStatefulWidget {
@@ -85,14 +84,6 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
onTap: () => setState( onTap: () => setState(
() => _currentMenu = _SettingsMenu.password), () => _currentMenu = _SettingsMenu.password),
), ),
// U盘导入
_buildMenuItem(
icon: Icons.usb,
title: l10n?.usbImport ?? 'U盘导入',
selected: _currentMenu == _SettingsMenu.usbImport,
onTap: () => setState(
() => _currentMenu = _SettingsMenu.usbImport),
),
], ],
), ),
), ),
@@ -120,7 +111,6 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
return switch (_currentMenu) { return switch (_currentMenu) {
_SettingsMenu.language => const LanguagePanel(), _SettingsMenu.language => const LanguagePanel(),
_SettingsMenu.password => const PasswordPanel(), _SettingsMenu.password => const PasswordPanel(),
_SettingsMenu.usbImport => const UsbImportPanel(),
_SettingsMenu.upgrade => _buildUpgradeContent(), _SettingsMenu.upgrade => _buildUpgradeContent(),
}; };
} }