基本完成APP的所有页面中的语言切换支持的开发和设计
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/core/router/route_paths.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
@@ -68,7 +69,7 @@ class _DjPageState extends State<DjPage> {
|
||||
context.go(RoutePaths.home);
|
||||
},
|
||||
),
|
||||
title: const Text("路径规划", style: TextStyle(color: Colors.white)),
|
||||
title: Text(AppLocalizations.of(context).translate('route_planning.title'), style: const TextStyle(color: Colors.white)),
|
||||
backgroundColor: const Color(0xFF1677FF),
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:maibu_satabot_v2/core/app/app_user_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/core/consts/tcp_consts.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/core/network/tcp/tcp_client.dart';
|
||||
import 'package:maibu_satabot_v2/features/devices/presentation/bloc/devices_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/features/devices/presentation/bloc/devices_state.dart'; // 👈 必须加
|
||||
@@ -94,7 +95,13 @@ class _HomePageState extends State<HomePage> {
|
||||
// 🔥 现在取的设备 = 100% 最新加载完成的
|
||||
final currentDevice = deviceState.selectedDevice;
|
||||
|
||||
final defaultDevice = DeviceEntity(deviceName: '暂未绑定设备', productId: 00000, productName: '', tenantId: 00000, tenantName: '');
|
||||
final defaultDevice = DeviceEntity(
|
||||
deviceName: AppLocalizations.of(context).translate('home.no_device_bound'),
|
||||
productId: 00000,
|
||||
productName: '',
|
||||
tenantId: 00000,
|
||||
tenantName: '',
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF7F7F7),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
|
||||
class ManualPage extends StatefulWidget {
|
||||
const ManualPage({super.key});
|
||||
@@ -13,49 +14,69 @@ class _ManualPageState extends State<ManualPage> {
|
||||
bool showMenu = true;
|
||||
String currentType = '';
|
||||
|
||||
final List<String> menuTitles = const ['安全警示及使用注意事项', '机器使用说明', '保养与维修', '故障处置', '本商品搬运的要领', '关于三包与售后服务'];
|
||||
|
||||
final List<List<Map<String, dynamic>>> subMenus = [
|
||||
[
|
||||
{'title': '特别警告', 'type': 'alert'},
|
||||
{'title': '关于本产品的警告标签说明', 'type': 'alertinstruction'},
|
||||
{'title': '安全操作须知', 'type': 'safety'},
|
||||
{'title': '安全驾驶·安全作业须知', 'type': 'safetywork'},
|
||||
],
|
||||
[
|
||||
{'title': '发动前的准备', 'type': 'prepare'},
|
||||
{'title': '启动方法', 'type': 'startmethod'},
|
||||
{'title': '割草方法', 'type': 'work'},
|
||||
{'title': '停车方法', 'type': 'stop'},
|
||||
{'title': '遥控器使用', 'type': 'controluse'},
|
||||
],
|
||||
[
|
||||
{'title': '定期检查表', 'type': 'check1'},
|
||||
{'title': '行走部分及割草部分的检查', 'type': 'check2'},
|
||||
{'title': '加油、加水以及上润滑脂、润滑油一览表', 'type': 'supply'},
|
||||
{'title': '消耗零件(更换零件)一览表', 'type': 'check4'},
|
||||
{'title': '发动机', 'type': 'check5'},
|
||||
{'title': '行走装置', 'type': 'check6'},
|
||||
{'title': '使用后的维修', 'type': 'check7'},
|
||||
],
|
||||
[
|
||||
{'title': '问题诊断表', 'type': 'breakdown1'},
|
||||
],
|
||||
[
|
||||
{'title': '搬运要领', 'type': 'starpoint'},
|
||||
],
|
||||
[
|
||||
{'title': '关于三包', 'type': 'about1'},
|
||||
{'title': '关于售后服务', 'type': 'about2'},
|
||||
{'title': '关于零件的补给年限(期间)', 'type': 'supplyyear'},
|
||||
],
|
||||
];
|
||||
late List<String> menuTitles;
|
||||
late List<List<Map<String, dynamic>>> subMenus;
|
||||
|
||||
void _initLocalizedMenus() {
|
||||
final loc = AppLocalizations.of(context);
|
||||
menuTitles = [
|
||||
loc.translate('manual.menu_titles.0'),
|
||||
loc.translate('manual.menu_titles.1'),
|
||||
loc.translate('manual.menu_titles.2'),
|
||||
loc.translate('manual.menu_titles.3'),
|
||||
loc.translate('manual.menu_titles.4'),
|
||||
loc.translate('manual.menu_titles.5'),
|
||||
];
|
||||
|
||||
subMenus = [
|
||||
[
|
||||
{'title': loc.translate('manual.submenus.alert'), 'type': 'alert'},
|
||||
{'title': loc.translate('manual.submenus.alertinstruction'), 'type': 'alertinstruction'},
|
||||
{'title': loc.translate('manual.submenus.safety'), 'type': 'safety'},
|
||||
{'title': loc.translate('manual.submenus.safetywork'), 'type': 'safetywork'},
|
||||
],
|
||||
[
|
||||
{'title': loc.translate('manual.submenus.prepare'), 'type': 'prepare'},
|
||||
{'title': loc.translate('manual.submenus.startmethod'), 'type': 'startmethod'},
|
||||
{'title': loc.translate('manual.submenus.work'), 'type': 'work'},
|
||||
{'title': loc.translate('manual.submenus.stop'), 'type': 'stop'},
|
||||
{'title': loc.translate('manual.submenus.controluse'), 'type': 'controluse'},
|
||||
],
|
||||
[
|
||||
{'title': loc.translate('manual.submenus.check1'), 'type': 'check1'},
|
||||
{'title': loc.translate('manual.submenus.check2'), 'type': 'check2'},
|
||||
{'title': loc.translate('manual.submenus.supply'), 'type': 'supply'},
|
||||
{'title': loc.translate('manual.submenus.check4'), 'type': 'check4'},
|
||||
{'title': loc.translate('manual.submenus.check5'), 'type': 'check5'},
|
||||
{'title': loc.translate('manual.submenus.check6'), 'type': 'check6'},
|
||||
{'title': loc.translate('manual.submenus.check7'), 'type': 'check7'},
|
||||
],
|
||||
[
|
||||
{'title': loc.translate('manual.submenus.breakdown1'), 'type': 'breakdown1'},
|
||||
],
|
||||
[
|
||||
{'title': loc.translate('manual.submenus.starpoint'), 'type': 'starpoint'},
|
||||
],
|
||||
[
|
||||
{'title': loc.translate('manual.submenus.about1'), 'type': 'about1'},
|
||||
{'title': loc.translate('manual.submenus.about2'), 'type': 'about2'},
|
||||
{'title': loc.translate('manual.submenus.supplyyear'), 'type': 'supplyyear'},
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
late List<bool> expandedList;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// menuTitles 和 subMenus 在 build 时初始化
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
_initLocalizedMenus();
|
||||
expandedList = List.filled(menuTitles.length, false);
|
||||
}
|
||||
|
||||
@@ -83,6 +104,7 @@ class _ManualPageState extends State<ManualPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_initLocalizedMenus(); // 确保每次build时更新语言
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF7F8FA),
|
||||
appBar: AppBar(
|
||||
@@ -90,7 +112,7 @@ class _ManualPageState extends State<ManualPage> {
|
||||
elevation: 1,
|
||||
centerTitle: true,
|
||||
title: Text(
|
||||
showMenu ? '使用说明' : _getCurrentTitle(),
|
||||
showMenu ? AppLocalizations.of(context).translate('manual.title') : _getCurrentTitle(),
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Color(0xFF2A3A55)),
|
||||
),
|
||||
leading: IconButton(
|
||||
@@ -188,10 +210,11 @@ class _ManualPageState extends State<ManualPage> {
|
||||
}
|
||||
|
||||
Widget _buildContent() {
|
||||
return SingleChildScrollView(padding: const EdgeInsets.all(16), physics: const BouncingScrollPhysics(), child: _getContentWidget());
|
||||
final loc = AppLocalizations.of(context);
|
||||
return SingleChildScrollView(padding: const EdgeInsets.all(16), physics: const BouncingScrollPhysics(), child: _getContentWidget(loc));
|
||||
}
|
||||
|
||||
Widget _getContentWidget() {
|
||||
Widget _getContentWidget(AppLocalizations loc) {
|
||||
if (currentType == 'supply') {
|
||||
return _buildSupplyTable();
|
||||
} else if (currentType == 'breakdown1') {
|
||||
@@ -211,23 +234,23 @@ class _ManualPageState extends State<ManualPage> {
|
||||
const SizedBox(height: 16),
|
||||
_buildDiagnosticTable1(),
|
||||
const SizedBox(height: 24),
|
||||
const Text(
|
||||
"发电机",
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold, color: Color(0xFF2A3A55)),
|
||||
Text(
|
||||
loc.translate('manual.tables.generator'),
|
||||
style: const TextStyle(fontSize: 17, fontWeight: FontWeight.bold, color: Color(0xFF2A3A55)),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildDiagnosticTable2(),
|
||||
const SizedBox(height: 24),
|
||||
const Text(
|
||||
"行走装置",
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold, color: Color(0xFF2A3A55)),
|
||||
Text(
|
||||
loc.translate('manual.tables.walking_device'),
|
||||
style: const TextStyle(fontSize: 17, fontWeight: FontWeight.bold, color: Color(0xFF2A3A55)),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildDiagnosticTable3(),
|
||||
const SizedBox(height: 24),
|
||||
const Text(
|
||||
"割草装置",
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold, color: Color(0xFF2A3A55)),
|
||||
Text(
|
||||
loc.translate('manual.tables.mowing_device'),
|
||||
style: const TextStyle(fontSize: 17, fontWeight: FontWeight.bold, color: Color(0xFF2A3A55)),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildDiagnosticTable4(),
|
||||
@@ -239,7 +262,10 @@ class _ManualPageState extends State<ManualPage> {
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)),
|
||||
child: const Text('本商品单个零件的提供年限为停止生产后三年。', style: TextStyle(fontSize: 16, color: Color(0xFF333333))),
|
||||
child: Text(loc.translate('manual.submenus.supplyyear') == '关于零件的补给年限(期间)'
|
||||
? '本商品单个零件的提供年限为停止生产后三年。'
|
||||
: 'The supply period for individual parts of this product is three years after production cessation.',
|
||||
style: const TextStyle(fontSize: 16, color: Color(0xFF333333))),
|
||||
);
|
||||
} else if (markdownMap.containsKey(currentType)) {
|
||||
return Container(
|
||||
@@ -269,7 +295,7 @@ class _ManualPageState extends State<ManualPage> {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)),
|
||||
child: const Text("暂无内容", style: TextStyle(fontSize: 16, color: Color(0xFF8A98AC))),
|
||||
child: Text(AppLocalizations.of(context).translate('manual.no_content'), style: const TextStyle(fontSize: 16, color: Color(0xFF8A98AC))),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -283,19 +309,20 @@ class _ManualPageState extends State<ManualPage> {
|
||||
}
|
||||
}
|
||||
}
|
||||
return '详情';
|
||||
return AppLocalizations.of(context).translate('manual.detail');
|
||||
}
|
||||
|
||||
Widget _buildSupplyTable() {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'加油、加水以及上润滑脂、润滑油一览表',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF2A3A55)),
|
||||
Text(
|
||||
loc.translate('manual.tables.supply_title'),
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF2A3A55)),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
SingleChildScrollView(
|
||||
@@ -307,10 +334,10 @@ class _ManualPageState extends State<ManualPage> {
|
||||
TableRow(
|
||||
decoration: const BoxDecoration(color: Color(0xFFF7F8FA)),
|
||||
children: [
|
||||
TableCell(child: _tableCellText('项目', isHeader: true)),
|
||||
TableCell(child: _tableCellText('补给(交换)的时期', isHeader: true)),
|
||||
TableCell(child: _tableCellText('推荐品种', isHeader: true)),
|
||||
TableCell(child: _tableCellText('容量', isHeader: true)),
|
||||
TableCell(child: _tableCellText(loc.translate('manual.tables.item'), isHeader: true)),
|
||||
TableCell(child: _tableCellText(loc.translate('manual.tables.period'), isHeader: true)),
|
||||
TableCell(child: _tableCellText(loc.translate('manual.tables.recommend'), isHeader: true)),
|
||||
TableCell(child: _tableCellText(loc.translate('manual.tables.capacity'), isHeader: true)),
|
||||
],
|
||||
),
|
||||
_tableRowSimple(['燃料', '随时', '汽车用91号以上无铅汽油或乙醇含量不超过10%的无铅汽油(E10)', '10L']),
|
||||
@@ -443,9 +470,14 @@ class _ManualPageState extends State<ManualPage> {
|
||||
}
|
||||
|
||||
TableRow _tableHeader() {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return TableRow(
|
||||
decoration: const BoxDecoration(color: Color(0xFFF7F8FA)),
|
||||
children: [_tableCellText("问题现象说明", isHeader: true), _tableCellText("原因", isHeader: true), _tableCellText("处理", isHeader: true)],
|
||||
children: [
|
||||
_tableCellText(loc.translate('manual.tables.problem'), isHeader: true),
|
||||
_tableCellText(loc.translate('manual.tables.reason'), isHeader: true),
|
||||
_tableCellText(loc.translate('manual.tables.solution'), isHeader: true)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'dart:math' as math;
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/features/home/presentation/widgets/common/commonFn.dart';
|
||||
import 'package:syncfusion_flutter_gauges/gauges.dart';
|
||||
import 'package:flutter/animation.dart';
|
||||
@@ -135,14 +136,14 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
final currentDevice = deviceState.selectedDevice;
|
||||
|
||||
if (currentDevice != null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("数据刷新成功!"), duration: Duration(seconds: 1)));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(AppLocalizations.of(context).translate('running_status.data_refresh_success')), duration: const Duration(seconds: 1)));
|
||||
// 刷新后重置超时状态
|
||||
if (_isDataTimeout) {
|
||||
setState(() => _isDataTimeout = false);
|
||||
}
|
||||
_startDataTimeoutTimer();
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("暂无设备,无法刷新"), duration: Duration(seconds: 1)));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(AppLocalizations.of(context).translate('running_status.no_device')), duration: const Duration(seconds: 1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,7 +274,7 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
children: [
|
||||
Icon(Icons.inbox_outlined, color: Colors.grey, size: 48),
|
||||
SizedBox(height: 16),
|
||||
Text('暂无数据', style: TextStyle(color: Colors.grey, fontSize: 16)),
|
||||
Text(AppLocalizations.of(context).translate('running_status.no_data'), style: TextStyle(color: Colors.grey, fontSize: 16)),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -314,9 +315,9 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
_legendItem(color: const Color(0xFF3F51B5), label: "左轮"),
|
||||
_legendItem(color: const Color(0xFF3F51B5), label: AppLocalizations.of(context).translate('running_status.left_wheel')),
|
||||
const SizedBox(width: 24),
|
||||
_legendItem(color: const Color(0xFF8BC34A), label: "右轮"),
|
||||
_legendItem(color: const Color(0xFF8BC34A), label: AppLocalizations.of(context).translate('running_status.right_wheel')),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -472,7 +473,7 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
child: Column(
|
||||
children: [
|
||||
_chartCard(
|
||||
title: "电压 (V)",
|
||||
title: AppLocalizations.of(context).translate('running_status.voltage') + " (V)",
|
||||
isGaugeMode: _voltageGaugeMode,
|
||||
onGaugeTap: () => setState(() => _voltageGaugeMode = true),
|
||||
onChartTap: () => setState(() => _voltageGaugeMode = false),
|
||||
@@ -481,7 +482,7 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
: SizedBox(
|
||||
height: 180,
|
||||
child: _styledLineChart(
|
||||
title: "电压",
|
||||
title: AppLocalizations.of(context).translate('running_status.voltage'),
|
||||
lines: [_lineData(_voltageHistory, const Color(0xFF4CAF50))],
|
||||
yAxisMax: 250,
|
||||
yAxisMin: 0,
|
||||
@@ -492,7 +493,7 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
_gap(),
|
||||
|
||||
_chartCard(
|
||||
title: "芯片温度 (°C)",
|
||||
title: AppLocalizations.of(context).translate('running_status.chip_temp') + " (°C)",
|
||||
isGaugeMode: _chipTempGaugeMode,
|
||||
onGaugeTap: () => setState(() => _chipTempGaugeMode = true),
|
||||
onChartTap: () => setState(() => _chipTempGaugeMode = false),
|
||||
@@ -501,7 +502,7 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
: SizedBox(
|
||||
height: 180,
|
||||
child: _styledLineChart(
|
||||
title: "芯片温度",
|
||||
title: AppLocalizations.of(context).translate('running_status.chip_temp'),
|
||||
lines: [_lineData(_chipTempHistory, const Color(0xFF4CAF50))],
|
||||
yAxisMax: 100,
|
||||
yAxisMin: 0,
|
||||
@@ -512,7 +513,7 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
_gap(),
|
||||
|
||||
_chartCard(
|
||||
title: "割刀速度 (rpm)",
|
||||
title: AppLocalizations.of(context).translate('running_status.knife_speed') + " (rpm)",
|
||||
isGaugeMode: _knifeSpeedGaugeMode,
|
||||
onGaugeTap: () => setState(() => _knifeSpeedGaugeMode = true),
|
||||
onChartTap: () => setState(() => _knifeSpeedGaugeMode = false),
|
||||
@@ -526,7 +527,7 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
: SizedBox(
|
||||
height: 180,
|
||||
child: _styledLineChart(
|
||||
title: "割刀速度",
|
||||
title: AppLocalizations.of(context).translate('running_status.knife_speed'),
|
||||
lines: [_lineData(_knifeHistory, const Color(0xFF4CAF50))],
|
||||
yAxisMax: 3000,
|
||||
yAxisMin: -3000,
|
||||
@@ -547,14 +548,14 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"左右轮测量速度对比 (rpm)",
|
||||
AppLocalizations.of(context).translate('running_status.left_right_measure_speed') + " (rpm)",
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF1677FF)),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(
|
||||
height: 180,
|
||||
child: _styledLineChart(
|
||||
title: "左右轮测量速度对比",
|
||||
title: AppLocalizations.of(context).translate('running_status.left_right_measure_speed'),
|
||||
lines: [_lineData(_leftMeasureHistory, const Color(0xFF3F51B5)), _lineData(_rightMeasureHistory, const Color(0xFF8BC34A))],
|
||||
yAxisMax: 3000,
|
||||
yAxisMin: -3000,
|
||||
@@ -577,14 +578,14 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"左右轮目标速度对比 (rpm)",
|
||||
AppLocalizations.of(context).translate('running_status.left_right_target_speed') + " (rpm)",
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF1677FF)),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(
|
||||
height: 180,
|
||||
child: _styledLineChart(
|
||||
title: "左右轮目标速度对比",
|
||||
title: AppLocalizations.of(context).translate('running_status.left_right_target_speed'),
|
||||
lines: [_lineData(_leftTargetHistory, const Color(0xFF3F51B5)), _lineData(_rightTargetHistory, const Color(0xFF8BC34A))],
|
||||
yAxisMax: 3000,
|
||||
yAxisMin: -3000,
|
||||
@@ -607,14 +608,14 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"电流对比 (A)",
|
||||
AppLocalizations.of(context).translate('running_status.current_compare') + " (A)",
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF1677FF)),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(
|
||||
height: 180,
|
||||
child: _styledLineChart(
|
||||
title: "电流对比",
|
||||
title: AppLocalizations.of(context).translate('running_status.current_compare'),
|
||||
lines: [_lineData(_leftCurrentHistory, const Color(0xFF3F51B5)), _lineData(_rightCurrentHistory, const Color(0xFF8BC34A))],
|
||||
yAxisMax: 100,
|
||||
yAxisMin: 0,
|
||||
@@ -637,14 +638,14 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"电机温度对比 (°C)",
|
||||
AppLocalizations.of(context).translate('running_status.motor_temp_compare') + " (°C)",
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF1677FF)),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(
|
||||
height: 180,
|
||||
child: _styledLineChart(
|
||||
title: "电机温度对比",
|
||||
title: AppLocalizations.of(context).translate('running_status.motor_temp_compare'),
|
||||
lines: [_lineData(_leftTempHistory, const Color(0xFF3F51B5)), _lineData(_rightTempHistory, const Color(0xFF8BC34A))],
|
||||
yAxisMax: 100,
|
||||
yAxisMin: 0,
|
||||
@@ -667,7 +668,7 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"航向角 (°)",
|
||||
AppLocalizations.of(context).translate('running_status.heading_angle_chart') + " (°)",
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF1677FF)),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
@@ -705,9 +706,9 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
child: Text("电机参数", style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Text(AppLocalizations.of(context).translate('running_status.motor_params'), style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
Table(
|
||||
border: TableBorder.all(color: const Color(0xFFE5E5E5)),
|
||||
@@ -715,32 +716,32 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
children: [
|
||||
TableRow(
|
||||
decoration: const BoxDecoration(color: Color(0xFFF5F5F5)),
|
||||
children: [const SizedBox(), _buildTableCell("左轮", isHeader: true), _buildTableCell("右轮", isHeader: true)],
|
||||
children: [const SizedBox(), _buildTableCell(AppLocalizations.of(context).translate('running_status.left_wheel'), isHeader: true), _buildTableCell(AppLocalizations.of(context).translate('running_status.right_wheel'), isHeader: true)],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
_buildTableCell("目标速度\n(rpm)"),
|
||||
_buildTableCell(AppLocalizations.of(context).translate('running_status.target_speed') + "\n(rpm)"),
|
||||
_buildTableCell(status.leftTargetSpeed.toStringAsFixed(2)),
|
||||
_buildTableCell(status.rightTargetSpeed.toStringAsFixed(2)),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
_buildTableCell("测量速度\n(rpm)"),
|
||||
_buildTableCell(AppLocalizations.of(context).translate('running_status.measure_speed') + "\n(rpm)"),
|
||||
_buildTableCell(status.leftMeasureSpeed.toStringAsFixed(2)),
|
||||
_buildTableCell(status.rightMeasureSpeed.toStringAsFixed(2)),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
_buildTableCell("电流(A)"),
|
||||
_buildTableCell(AppLocalizations.of(context).translate('running_status.current') + "(A)"),
|
||||
_buildTableCell(status.leftCurrent.toStringAsFixed(2)),
|
||||
_buildTableCell(status.rightCurrent.toStringAsFixed(2)),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
_buildTableCell("电机温度(°C)"),
|
||||
_buildTableCell(AppLocalizations.of(context).translate('running_status.motor_temp') + "(°C)"),
|
||||
_buildTableCell(status.leftMotorTemp.toStringAsFixed(2)),
|
||||
_buildTableCell(status.rightMotorTemp.toStringAsFixed(2)),
|
||||
],
|
||||
@@ -756,9 +757,9 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
child: Text("其他参数", style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Text(AppLocalizations.of(context).translate('running_status.other_params'), style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
Table(
|
||||
border: TableBorder.all(color: const Color(0xFFE5E5E5)),
|
||||
@@ -766,17 +767,17 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
children: [
|
||||
TableRow(
|
||||
decoration: const BoxDecoration(color: Color(0xFFF5F5F5)),
|
||||
children: [_buildTableCell("名称", isHeader: true), _buildTableCell("数值", isHeader: true)],
|
||||
children: [_buildTableCell(AppLocalizations.of(context).translate('running_status.name'), isHeader: true), _buildTableCell(AppLocalizations.of(context).translate('running_status.value'), isHeader: true)],
|
||||
),
|
||||
TableRow(children: [_buildTableCell("俯仰角(°)"), _buildTableCell(status.pitch.toStringAsFixed(2))]),
|
||||
TableRow(children: [_buildTableCell("翻滚角(°)"), _buildTableCell(status.roll.toStringAsFixed(2))]),
|
||||
TableRow(children: [_buildTableCell("航向角(°)"), _buildTableCell(status.yaw.toStringAsFixed(2))]),
|
||||
TableRow(children: [_buildTableCell("电量(%)"), _buildTableCell(status.battery)]),
|
||||
TableRow(children: [_buildTableCell("芯片温度(°C)"), _buildTableCell(status.chipTemp.toStringAsFixed(2))]),
|
||||
TableRow(children: [_buildTableCell("割刀速度(rpm)"), _buildTableCell(status.knifeCuttingSpeed)]),
|
||||
TableRow(children: [_buildTableCell("控制模式"), _buildTableCell(LocationUtils.parseControlMode(int.parse(status.controlMode)))]),
|
||||
TableRow(children: [_buildTableCell("经度(°)"), _buildTableCell(status.longitude.toStringAsFixed(6))]),
|
||||
TableRow(children: [_buildTableCell("纬度(°)"), _buildTableCell(status.latitude.toStringAsFixed(6))]),
|
||||
TableRow(children: [_buildTableCell(AppLocalizations.of(context).translate('running_status.pitch_angle') + "(°)"), _buildTableCell(status.pitch.toStringAsFixed(2))]),
|
||||
TableRow(children: [_buildTableCell(AppLocalizations.of(context).translate('running_status.roll_angle') + "(°)"), _buildTableCell(status.roll.toStringAsFixed(2))]),
|
||||
TableRow(children: [_buildTableCell(AppLocalizations.of(context).translate('running_status.heading_angle') + "(°)"), _buildTableCell(status.yaw.toStringAsFixed(2))]),
|
||||
TableRow(children: [_buildTableCell(AppLocalizations.of(context).translate('running_status.battery') + "(%)"), _buildTableCell(status.battery)]),
|
||||
TableRow(children: [_buildTableCell(AppLocalizations.of(context).translate('running_status.chip_temp') + "(°C)"), _buildTableCell(status.chipTemp.toStringAsFixed(2))]),
|
||||
TableRow(children: [_buildTableCell(AppLocalizations.of(context).translate('running_status.knife_speed') + "(rpm)"), _buildTableCell(status.knifeCuttingSpeed)]),
|
||||
TableRow(children: [_buildTableCell(AppLocalizations.of(context).translate('running_status.control_mode')), _buildTableCell(AppLocalizations.of(context).translate(_getControlModeKey(int.parse(status.controlMode))))]),
|
||||
TableRow(children: [_buildTableCell(AppLocalizations.of(context).translate('running_status.longitude') + "(°)"), _buildTableCell(status.longitude.toStringAsFixed(6))]),
|
||||
TableRow(children: [_buildTableCell(AppLocalizations.of(context).translate('running_status.latitude') + "(°)"), _buildTableCell(status.latitude.toStringAsFixed(6))]),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -823,6 +824,34 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
);
|
||||
}
|
||||
|
||||
// 辅助方法:根据定位质量值返回翻译键
|
||||
String _getLocationQualityKey(int qualValue) {
|
||||
switch (qualValue) {
|
||||
case 0:
|
||||
return 'running_status.invalid';
|
||||
case 1:
|
||||
return 'common.unknown'; // GPS单点定位 - 使用通用未知
|
||||
case 2:
|
||||
return 'common.unknown'; // DGPS - 使用通用未知
|
||||
case 4:
|
||||
return 'running_status.valid'; // RTK固定解 - 视为有效
|
||||
case 5:
|
||||
return 'running_status.valid'; // RTK浮点解 - 视为有效
|
||||
default:
|
||||
return 'common.unknown';
|
||||
}
|
||||
}
|
||||
|
||||
// 辅助方法:根据控制模式值返回翻译键
|
||||
String _getControlModeKey(int modeValue) {
|
||||
switch (modeValue) {
|
||||
case 3:
|
||||
return 'running_status.remote_control';
|
||||
default:
|
||||
return 'running_status.local_control';
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final deviceState = context.read<DevicesCubit>().state;
|
||||
@@ -851,14 +880,14 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
String headingStatus = _isDataTimeout ? "--" : "--";
|
||||
|
||||
if (!_isDataTimeout && state is DeviceStatusUpdated) {
|
||||
headingStatus = state.status.headingStatus == 0 ? '未初始化' : '已初始化';
|
||||
headingStatus = state.status.headingStatus == 0 ? AppLocalizations.of(context).translate('running_status.not_initialized') : AppLocalizations.of(context).translate('running_status.initialized');
|
||||
int qualValue = 0;
|
||||
try {
|
||||
qualValue = int.parse(state.status.qual.toString());
|
||||
} catch (e) {
|
||||
qualValue = 0;
|
||||
}
|
||||
qual = LocationUtils.parseLocationQuality(qualValue);
|
||||
qual = AppLocalizations.of(context).translate(_getLocationQualityKey(qualValue));
|
||||
satelliteCnt = state.status.satelliteCnt.toString();
|
||||
|
||||
// 收到新数据,重置超时计时器和状态
|
||||
@@ -881,12 +910,12 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text("航向角状态:$headingStatus", style: const TextStyle(fontSize: 12), maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
child: Text(AppLocalizations.of(context).translate('running_status.heading_status') + ":$headingStatus", style: const TextStyle(fontSize: 12), maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
"定位质量:$qual",
|
||||
AppLocalizations.of(context).translate('running_status.position_quality') + ":$qual",
|
||||
style: const TextStyle(fontSize: 12),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -896,7 +925,7 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
"卫星数:$satelliteCnt",
|
||||
AppLocalizations.of(context).translate('running_status.satellite_count') + ":$satelliteCnt",
|
||||
style: const TextStyle(fontSize: 12),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -922,12 +951,12 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => setState(() => _isCardView = true),
|
||||
child: _buildTab("卡片", isActive: _isCardView),
|
||||
child: _buildTab(AppLocalizations.of(context).translate('running_status.card'), isActive: _isCardView),
|
||||
),
|
||||
const SizedBox(width: 24),
|
||||
GestureDetector(
|
||||
onTap: () => setState(() => _isCardView = false),
|
||||
child: _buildTab("图表", isActive: !_isCardView),
|
||||
child: _buildTab(AppLocalizations.of(context).translate('running_status.chart'), isActive: !_isCardView),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -988,9 +1017,9 @@ class _RunningStatusPageState extends State<RunningStatusPage> with WidgetsBindi
|
||||
backgroundColor: const Color(0xFF1677FF),
|
||||
elevation: 4, // 增加阴影,提升层次感
|
||||
centerTitle: true,
|
||||
title: const Text(
|
||||
"设备数据监控",
|
||||
style: TextStyle(
|
||||
title: Text(
|
||||
AppLocalizations.of(context).translate('running_status.title'),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
|
||||
class ProductPage extends StatefulWidget {
|
||||
const ProductPage({super.key});
|
||||
@@ -24,25 +25,36 @@ class _ProductPageState extends State<ProductPage> {
|
||||
'整机三色灯显示机器各种状态,包括油量预警、电量预警、直行保持、电控箱温度预警和安全倾角预警等;遥控实现整机操控,包括发动机一键启停、行走操控、速度操控、割盘升降和割刀转速等;遥控显示屏实时显示作业状态,包括作业时间、保养提醒、驱动器情况、作业模式、行驶模式、安全倾角检测、障碍物检测车灯状态、信号强度和遥控器电量等。',
|
||||
];
|
||||
|
||||
// 产品亮点
|
||||
final List<Map<String, String>> starPoints = const [
|
||||
{'title': '整机设计', 'content': '承载式车身、高效大功率行走系统、坦克履型、油电混动、防溜坡系统、主被动溜坡浮动式刀盘、空气辅助式提升机构、自适应割草装置'},
|
||||
{'title': '控制系统', 'content': '车规级控制和电气系统、工业级防干扰遥控系统、车速控制和检测系统、牵引力控制系统、手动和自动行驶操作模式、整机状态液晶显示。'},
|
||||
{'title': '动力系统', 'content': '自适应增程系统、本田顶级发动机、大功率交直流放电功能。'},
|
||||
{'title': '安全配置', 'content': '车身稳定系统、ABS刹车装置、电子防翻滚功能、倾斜保护功能、急速、坠落和翻滚停机功能、无操作自动关机。'},
|
||||
{'title': '智能功能', 'content': '直行保持功能、防碰撞功能、碰撞停机功能。'},
|
||||
{'title': '扩展功能', 'content': '路径规划、巡检探测、物联控制。'},
|
||||
];
|
||||
|
||||
// 应用场景
|
||||
final List<Map<String, String>> sceneList = const [
|
||||
{'img': 'assets/images/scene4.png', 'title': '果园林业'},
|
||||
{'img': 'assets/images/scene1.png', 'title': '光伏储能'},
|
||||
{'img': 'assets/images/scene2.png', 'title': '公路路政'},
|
||||
{'img': 'assets/images/scene3.png', 'title': '农业生产'},
|
||||
{'img': 'assets/images/scene5.png', 'title': '市政河堤'},
|
||||
{'img': 'assets/images/scene6.png', 'title': '机场场所'},
|
||||
];
|
||||
Widget _buildScene() {
|
||||
final loc = AppLocalizations.of(context);
|
||||
final sceneListLocalized = [
|
||||
{'img': 'assets/images/scene4.png', 'title': loc.translate('product.scenes.orchard')},
|
||||
{'img': 'assets/images/scene1.png', 'title': loc.translate('product.scenes.photovoltaic')},
|
||||
{'img': 'assets/images/scene2.png', 'title': loc.translate('product.scenes.highway')},
|
||||
{'img': 'assets/images/scene3.png', 'title': loc.translate('product.scenes.agriculture')},
|
||||
{'img': 'assets/images/scene5.png', 'title': loc.translate('product.scenes.municipal')},
|
||||
{'img': 'assets/images/scene6.png', 'title': loc.translate('product.scenes.airport')},
|
||||
];
|
||||
|
||||
return GridView.builder(
|
||||
padding: const EdgeInsets.all(16),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 12, mainAxisSpacing: 12, childAspectRatio: 0.85),
|
||||
itemCount: sceneListLocalized.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = sceneListLocalized[index];
|
||||
return Container(
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12), boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 4)]),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(child: ClipRRect(borderRadius: const BorderRadius.vertical(top: Radius.circular(12)), child: Image.asset(item['img']!, fit: BoxFit.cover, width: double.infinity))),
|
||||
Padding(padding: const EdgeInsets.all(8), child: Text(item['title']!, textAlign: TextAlign.center, style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500))),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 产品参数 markdown
|
||||
final String productParamMd = '''
|
||||
@@ -107,11 +119,12 @@ class _ProductPageState extends State<ProductPage> {
|
||||
}
|
||||
|
||||
Widget _buildHeader() {
|
||||
String title = '产品介绍';
|
||||
if (currentPage == 1) title = '产品亮点';
|
||||
if (currentPage == 2) title = '功能介绍';
|
||||
if (currentPage == 3) title = '产品参数';
|
||||
if (currentPage == 4) title = '应用场景';
|
||||
final loc = AppLocalizations.of(context);
|
||||
String title = loc.translate('product.intro');
|
||||
if (currentPage == 1) title = loc.translate('product.highlights');
|
||||
if (currentPage == 2) title = loc.translate('product.functions');
|
||||
if (currentPage == 3) title = loc.translate('product.parameters');
|
||||
if (currentPage == 4) title = loc.translate('product.scenes');
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top + 8, bottom: 12, left: 4, right: 4),
|
||||
@@ -161,13 +174,14 @@ class _ProductPageState extends State<ProductPage> {
|
||||
|
||||
// 主菜单(卡片样式)
|
||||
Widget _buildMainMenu() {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
children: [
|
||||
_menuItem('产品亮点', Icons.highlight_outlined, 1),
|
||||
_menuItem('功能介绍', Icons.widgets_outlined, 2),
|
||||
_menuItem('产品参数', Icons.table_chart_outlined, 3),
|
||||
_menuItem('应用场景', Icons.place_outlined, 4),
|
||||
_menuItem(loc.translate('product.highlights'), Icons.highlight_outlined, 1),
|
||||
_menuItem(loc.translate('product.functions'), Icons.widgets_outlined, 2),
|
||||
_menuItem(loc.translate('product.parameters'), Icons.table_chart_outlined, 3),
|
||||
_menuItem(loc.translate('product.scenes'), Icons.place_outlined, 4),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -201,10 +215,20 @@ class _ProductPageState extends State<ProductPage> {
|
||||
|
||||
// 产品亮点(卡片+主题色)
|
||||
Widget _buildStarPoint() {
|
||||
final loc = AppLocalizations.of(context);
|
||||
final starPointsLocalized = [
|
||||
{'title': loc.translate('product.star_points.design.title'), 'content': loc.translate('product.star_points.design.content')},
|
||||
{'title': loc.translate('product.star_points.control.title'), 'content': loc.translate('product.star_points.control.content')},
|
||||
{'title': loc.translate('product.star_points.power.title'), 'content': loc.translate('product.star_points.power.content')},
|
||||
{'title': loc.translate('product.star_points.safety.title'), 'content': loc.translate('product.star_points.safety.content')},
|
||||
{'title': loc.translate('product.star_points.smart.title'), 'content': loc.translate('product.star_points.smart.content')},
|
||||
{'title': loc.translate('product.star_points.expand.title'), 'content': loc.translate('product.star_points.expand.content')},
|
||||
];
|
||||
|
||||
return ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
children: [
|
||||
...starPoints.map((item) {
|
||||
...starPointsLocalized.map((item) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -421,34 +445,4 @@ class _ProductPageState extends State<ProductPage> {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 应用场景(卡片网格)
|
||||
Widget _buildScene() {
|
||||
return GridView.builder(
|
||||
padding: const EdgeInsets.all(12),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, mainAxisSpacing: 10, crossAxisSpacing: 10, childAspectRatio: 0.9),
|
||||
itemCount: sceneList.length,
|
||||
itemBuilder: (ctx, index) {
|
||||
final item = sceneList[index];
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 4)],
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Image.asset(item['img']!, height: 100, fit: BoxFit.cover),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(item['title']!, style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w500)),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user