Files
flutterApp/lib/features/home/presentation/pages/usage.dart

449 lines
19 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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});
@override
State<ProductPage> createState() => _ProductPageState();
}
class _ProductPageState extends State<ProductPage> {
// 当前显示内容:0=主菜单 1=产品亮点 2=功能介绍 3=产品参数 4=应用场景
int currentPage = 0;
// 功能介绍列表
final List<String> funcList = const [
'两轮驱动履带式行走系统,超强地形适应能力,无极变速,轻松爬坡越障,履带爬坡角度≤35°,履带前仰角40°,垂直越障≤15cm。',
'3kW闭环无刷电机独立驱动行走系统,高速传动装置效率达到95%以上,整机扭矩达到175N·m,轻松爬坡越障。闭环车速控制和检测系统,0-4km/h无级变速。',
'坦克履型设计,接近角达到45°,超强地形适应能力,爬坡角度≤40°,垂直越障≤15cm;复合材料履带,抗拉强度高、抗切能力好,抗磨损;接地比压小,轻松通过烂泥沼泽地。',
'方向速度手动操作模式(MT)和方向速度自动操作模式(AT)满足不同操作者使用习惯和场景使用方式。',
'自主研发自适应增程系统,根据负载变化调整输出功率,节省能耗,尖峰抑制稳流系统,实现稳定电力输出配备大功率风冷发电机和过滤系统,可实现大功率交直流放电,满足长时间使用要求。',
'户外等级控制箱,操作面板集中布置,防护等级IP55,操作、故障排査信息和注意事项醒目张贴,方便操作和检修。',
'工业级遥控器,防护等级IP65,有跌落防误碰保护;标准433MHz波段,无需无线电备案,直接使用;遥控信号绕障和穿越能力强,抗干扰能力强,同一空间至少支持100台机器同时作业,遥控距离达到500m;锂离子充电电池,可充可换,满足各种需要。',
'整机三色灯显示机器各种状态,包括油量预警、电量预警、直行保持、电控箱温度预警和安全倾角预警等;遥控实现整机操控,包括发动机一键启停、行走操控、速度操控、割盘升降和割刀转速等;遥控显示屏实时显示作业状态,包括作业时间、保养提醒、驱动器情况、作业模式、行驶模式、安全倾角检测、障碍物检测车灯状态、信号强度和遥控器电量等。',
];
// 应用场景
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 = '''
# 整车信息
| 项目 | 单位 | MC700 |
| ---- | ---- | ---- |
| 外形尺寸(长×宽×高) | mm | 1429×1090×650 |
| 车体重量 | kg | 320 |
| 工作效率 | m²/h | 2500¹ |
| 最低离地高度 | mm | 90 |
| 续航能力(纯电) | h | 0.5 |
| 水平运动额定负载 | kg | 500 |
| 动力源 | | 混合动力 |
| 整机显示信息 | | 电量、电压、温度 |
| 遥控器显示信息 | | 电量、失联报警 |
| 电池品牌 | | 理士 |
| 电芯成分 | | SLA(密封铅酸可充电电池) |
| 电池容量(20小时率) | Ah/hr | 23 |
| 低电量报警 | | 显示屏和三色灯 |
| 增程器 | | 自适应 |
| 发电机保护 | | 过滤网 |
| 外放电源 | V/W | 24/480(直流) |
| 外放电源接口 | | 点烟器 |
| 按钮 | | 304不锈钢带灯 |
| 箱内电气 | | 防震端子 |
| 箱外电气 | | 车规级线束 |
| 防护等级 | | IP55 |
# 控制系统
| 项目 | 单位 | MC700 |
| ---- | ---- | ---- |
| 控制器 | | ECU |
| 遥控器 | | 工业级数显屏 |
| 遥控距离 | m | ≤500 |
| 遥控信号 | MHz | 433 |
| 通信频率 | Hz | 10 |
| 发动机维护提醒 | | 屏幕图标提醒 |
| 自动驻车 | kg | 有 |
| 坡道辅助起步 | | 有 |
| 车身倾斜检测| | 有 |
| 车速检测系统 | | 有 |
| ABS刹车系统 | | 有 |
| 电子防御滚系统 | | 有 |
| 牵引力控制系统| | 有 |
| 车身稳定系统| | 有 |
| 抗干扰 || 百台设备互不干扰 |
| 传感器安装预留 | |LIDAR/CPS/RIDAR |
| 防护等级| |车规级ip65 |
''';
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF7F8FA), // 全局背景色
body: Column(
children: [
_buildHeader(),
Expanded(child: _buildContent()),
],
),
);
}
Widget _buildHeader() {
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),
decoration: const BoxDecoration(
color: Colors.white,
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 4, offset: Offset(0, 2))],
),
child: Row(
children: [
if (currentPage != 0)
IconButton(
onPressed: () => setState(() => currentPage = 0),
icon: const Icon(Icons.arrow_back_ios, size: 18, color: Color(0xFF333333)),
),
if (currentPage == 0)
IconButton(
onPressed: () => context.pop(),
icon: const Icon(Icons.arrow_back_ios, size: 18, color: Color(0xFF333333)),
),
Expanded(
child: Text(
title,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Color(0xFF333333)),
),
),
if (currentPage != 0) const SizedBox(width: 48),
],
),
);
}
Widget _buildContent() {
switch (currentPage) {
case 1:
return _buildStarPoint();
case 2:
return _buildFunction();
case 3:
return _buildParam();
case 4:
return _buildScene();
default:
return _buildMainMenu();
}
}
// 主菜单(卡片样式)
Widget _buildMainMenu() {
final loc = AppLocalizations.of(context);
return ListView(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
children: [
_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),
],
);
}
Widget _menuItem(String title, IconData icon, int page) {
return Container(
margin: const EdgeInsets.only(bottom: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 6, offset: const Offset(0, 2))],
),
child: InkWell(
borderRadius: BorderRadius.circular(12),
onTap: () => setState(() => currentPage = page),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: Row(
children: [
Icon(icon, size: 24, color: const Color(0xFF4A90E2)),
const SizedBox(width: 12),
Text(title, style: const TextStyle(fontSize: 16, color: Color(0xFF333333))),
const Spacer(),
const Icon(Icons.arrow_forward_ios, size: 14, color: Colors.grey),
],
),
),
),
);
}
// 产品亮点(卡片+主题色)
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: [
...starPointsLocalized.map((item) {
return Container(
margin: const EdgeInsets.only(bottom: 10),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 4)],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
const Icon(Icons.star_rounded, color: Color(0xFF4A90E2), size: 20),
const SizedBox(width: 6),
Text(item['title']!, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
],
),
const SizedBox(height: 6),
Text(item['content']!, style: const TextStyle(color: Color(0xFF666666), height: 1.4)),
],
),
);
}),
const SizedBox(height: 16),
ClipRRect(borderRadius: BorderRadius.circular(12), child: Image.asset('assets/images/startpoint.png')),
const SizedBox(height: 20),
],
);
}
// 功能介绍(卡片+项目符号)
Widget _buildFunction() {
return ListView(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
children: [
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 4)],
),
child: Column(
children: [
...funcList.map((text) {
return Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text('• ', style: TextStyle(color: Color(0xFF4A90E2), fontSize: 16)),
Expanded(
child: Text(text, style: const TextStyle(color: Color(0xFF444444), height: 1.45)),
),
],
),
);
}),
],
),
),
const SizedBox(height: 20),
],
);
}
// 产品参数(优化表格样式)
Widget _buildParam() {
return SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
' 整车信息',
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w600, color: Color(0xFF333333)),
),
const SizedBox(height: 8),
_buildVehicleInfoTable(),
const SizedBox(height: 20),
const Text(
' 控制系统',
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w600, color: Color(0xFF333333)),
),
const SizedBox(height: 8),
_buildControlSystemTable(),
const SizedBox(height: 30),
],
),
);
}
Widget _buildVehicleInfoTable() {
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 4)],
),
child: Table(
border: TableBorder.all(color: Colors.grey.shade200, width: 1),
columnWidths: const {0: FixedColumnWidth(200), 1: FixedColumnWidth(80), 2: FixedColumnWidth(160)},
children: [
TableRow(
decoration: BoxDecoration(color: Colors.grey.shade50),
children: const [
Padding(
padding: EdgeInsets.all(10),
child: Text('项目', style: TextStyle(fontWeight: FontWeight.w600)),
),
Padding(
padding: EdgeInsets.all(10),
child: Text('单位', style: TextStyle(fontWeight: FontWeight.w600)),
),
Padding(
padding: EdgeInsets.all(10),
child: Text('MC700', style: TextStyle(fontWeight: FontWeight.w600)),
),
],
),
...[
_buildTableRow('外形尺寸(长×宽×高)', 'mm', '1429×1090×650'),
_buildTableRow('车体重量', 'kg', '320'),
_buildTableRow('工作效率', 'm²/h', '2500¹'),
_buildTableRow('最低离地高度', 'mm', '90'),
_buildTableRow('续航能力(纯电)', 'h', '0.5'),
_buildTableRow('水平运动额定负载', 'kg', '500'),
_buildTableRow('动力源', '', '混合动力'),
_buildTableRow('整机显示信息', '', '电量、电压、温度'),
_buildTableRow('遥控器显示信息', '', '电量、失联报警'),
_buildTableRow('电池品牌', '', '理士'),
_buildTableRow('电芯成分', '', 'SLA(密封铅酸可充电电池)'),
_buildTableRow('电池容量(20小时率)', 'Ah/hr', '23'),
_buildTableRow('低电量报警', '', '显示屏和三色灯'),
_buildTableRow('增程器', '', '自适应'),
_buildTableRow('发电机保护', '', '过滤网'),
_buildTableRow('外放电源', 'V/W', '24/480(直流)'),
_buildTableRow('外放电源接口', '', '点烟器'),
_buildTableRow('按钮', '', '304不锈钢带灯'),
_buildTableRow('箱内电气', '', '防震端子'),
_buildTableRow('箱外电气', '', '车规级线束'),
_buildTableRow('防护等级', '', 'IP55'),
],
],
),
),
);
}
Widget _buildControlSystemTable() {
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 4)],
),
child: Table(
border: TableBorder.all(color: Colors.grey.shade200, width: 1),
columnWidths: const {0: FixedColumnWidth(200), 1: FixedColumnWidth(80), 2: FixedColumnWidth(160)},
children: [
TableRow(
decoration: BoxDecoration(color: Colors.grey.shade50),
children: const [
Padding(
padding: EdgeInsets.all(10),
child: Text('项目', style: TextStyle(fontWeight: FontWeight.w600)),
),
Padding(
padding: EdgeInsets.all(10),
child: Text('单位', style: TextStyle(fontWeight: FontWeight.w600)),
),
Padding(
padding: EdgeInsets.all(10),
child: Text('MC700', style: TextStyle(fontWeight: FontWeight.w600)),
),
],
),
...[
_buildTableRow('控制器', '', 'ECU'),
_buildTableRow('遥控器', '', '工业级数显屏'),
_buildTableRow('遥控距离', 'm', '≤500'),
_buildTableRow('遥控信号', 'MHz', '433'),
_buildTableRow('通信频率', 'Hz', '10'),
_buildTableRow('发动机维护提醒', '', '屏幕图标提醒'),
_buildTableRow('自动驻车', 'kg', '有'),
_buildTableRow('坡道辅助起步', '', '有'),
_buildTableRow('车身倾斜检测', '', '有'),
_buildTableRow('车速检测系统', '', '有'),
_buildTableRow('ABS刹车系统', '', '有'),
_buildTableRow('电子防御滚系统', '', '有'),
_buildTableRow('牵引力控制系统', '', '有'),
_buildTableRow('车身稳定系统', '', '有'),
_buildTableRow('抗干扰', '', '百台设备互不干扰'),
_buildTableRow('传感器安装预留', '', 'LIDAR/CPS/RIDAR'),
_buildTableRow('防护等级', '', '车规级ip65'),
],
],
),
),
);
}
TableRow _buildTableRow(String item, String unit, String value) {
return TableRow(
children: [
Padding(padding: const EdgeInsets.all(10), child: Text(item)),
Padding(padding: const EdgeInsets.all(10), child: Text(unit)),
Padding(padding: const EdgeInsets.all(10), child: Text(value)),
],
);
}
}