退出登录+机器状态+切换设备+历史作业记录+设备信息
This commit is contained in:
@@ -0,0 +1,249 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MachineDetailsPage extends StatelessWidget {
|
||||
const MachineDetailsPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 移除 MaterialApp,直接返回 Scaffold
|
||||
return const DeviceDetailPage();
|
||||
}
|
||||
}
|
||||
|
||||
class DeviceDetailPage extends StatelessWidget {
|
||||
const DeviceDetailPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF5F5F5),
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: const Text(
|
||||
'设备详情',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios),
|
||||
onPressed: () => Navigator.pop(context), // 正确返回上一页
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildDeviceStatusCard(),
|
||||
const SizedBox(height: 16),
|
||||
_buildBasicInfoCard(),
|
||||
const SizedBox(height: 16),
|
||||
_buildResourceCenterCard(),
|
||||
const SizedBox(height: 24),
|
||||
_buildUnbindButton(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 设备状态卡片
|
||||
Widget _buildDeviceStatusCard() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/car.png',
|
||||
width: 380,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const Text(
|
||||
'离线',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF999999),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 基本信息卡片
|
||||
Widget _buildBasicInfoCard() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(bottom: 16),
|
||||
child: Text(
|
||||
'基本信息',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF999999),
|
||||
),
|
||||
),
|
||||
),
|
||||
_buildInfoRow(
|
||||
icon: Icons.info_outline,
|
||||
label: '设备名称',
|
||||
trailing: Row(
|
||||
children: const [
|
||||
Text(''),
|
||||
SizedBox(width: 8),
|
||||
Icon(Icons.edit, size: 16, color: Color(0xFF007AFF)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 32, color: Color(0xFFF0F0F0)),
|
||||
_buildInfoRow(
|
||||
icon: Icons.shield_outlined,
|
||||
label: '设备ID',
|
||||
trailing: Row(
|
||||
children: const [
|
||||
Text('undefined'),
|
||||
SizedBox(width: 8),
|
||||
Icon(Icons.copy, size: 16, color: Color(0xFF999999)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 32, color: Color(0xFFF0F0F0)),
|
||||
_buildInfoRow(
|
||||
icon: Icons.date_range_outlined,
|
||||
label: '激活时间',
|
||||
trailing: const Text(''),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 资源中心卡片
|
||||
Widget _buildResourceCenterCard() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(bottom: 16),
|
||||
child: Text(
|
||||
'资源中心',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF999999),
|
||||
),
|
||||
),
|
||||
),
|
||||
_buildResourceItem('使用说明', Icons.description_outlined),
|
||||
const Divider(height: 32, color: Color(0xFFF0F0F0)),
|
||||
_buildResourceItem('产品手册', Icons.book_outlined),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 信息行组件
|
||||
Widget _buildInfoRow({
|
||||
required IconData icon,
|
||||
required String label,
|
||||
required Widget trailing,
|
||||
}) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(icon, size: 18, color: const Color(0xFF999999)),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(fontSize: 16),
|
||||
),
|
||||
const Spacer(),
|
||||
trailing,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 资源项组件
|
||||
Widget _buildResourceItem(String title, IconData icon) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(icon, size: 18, color: const Color(0xFF007AFF)),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(fontSize: 16),
|
||||
),
|
||||
const Spacer(),
|
||||
const Icon(Icons.arrow_forward_ios, size: 16, color: Color(0xFF999999)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 解绑设备按钮
|
||||
Widget _buildUnbindButton(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 48,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: const Color(0xFFFF3B30),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
// 实现解绑逻辑
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('确认解绑'),
|
||||
content: const Text('确定要解绑该设备吗?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
// 执行解绑操作
|
||||
},
|
||||
child: const Text('确认'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.unarchive_outlined, size: 18),
|
||||
SizedBox(width: 12),
|
||||
Text(
|
||||
'解绑设备',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user