How to DeepSeek write APP for CUI ER Corrosion rate monitoring by Flutter
import 'package:flutter/material.dart';
void main() => runApp(CorrosionRateApp());
class CorrosionRateApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: '腐蚀率监测',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: CorrosionRatePage(),
);
}
}
class CorrosionRatePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('腐蚀率详情'),
backgroundColor: Colors.blue[800],
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildLocationSection(),
const SizedBox(height: 20),
_buildProbeInfoSection(),
const SizedBox(height: 20),
_buildCorrosionRateSection(),
const SizedBox(height: 20),
_buildGraphSection(),
],
),
),
);
}
Widget _buildLocationSection() {
return Card(
elevation: 4,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('设备位置', style: _sectionTitleStyle()),
const SizedBox(height: 10),
Text('浙江 » 温州 » 瓯海 » 新桥111 » X棣楼', style: _contentStyle()),
Text('燃油燃烧装置', style: _contentStyle().copyWith(color: Colors.grey[600])),
const SizedBox(height: 10),
Text('003片区 » 弯头004', style: _contentStyle()),
],
),
),
);
}
Widget _buildProbeInfoSection() {
return Card(
elevation: 4,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('探头信息', style: _sectionTitleStyle()),
const SizedBox(height: 10),
_buildInfoRow('探头ID', '12'),
_buildInfoRow('探头类型', 'Cylindrical Probe'),
_buildInfoRow('探头寿命', '10 mils'),
],
),
),
);
}
Widget _buildCorrosionRateSection() {
return Card(
elevation: 4,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('腐蚀率详情', style: _sectionTitleStyle()),
const SizedBox(height: 10),
_buildInfoRow('金属损失', '2.5 mils'),
_buildInfoRow('当前腐蚀率', '2.43 mpy'),
_buildInfoRow('累计腐蚀率', '8.23 m'),
],
),
),
);
}
Widget _buildGraphSection() {
return Card(
elevation: 4,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('腐蚀率趋势', style: _sectionTitleStyle()),
const SizedBox(height: 10),
Container(
height: 200,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
child: Center(
child: Text('图表区域', style: _contentStyle()),
),
),
],
),
),
);
}
// Helper widgets
Widget _buildInfoRow(String title, String value) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(title, style: _contentStyle()),
Text(value, style: _contentStyle().copyWith(fontWeight: FontWeight.bold)),
],
),
);
}
// Text styles
TextStyle _sectionTitleStyle() {
return const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black87,
);
}
TextStyle _contentStyle() {
return const TextStyle(
fontSize: 16,
color: Colors.black54,
);
}
}