所有一级页面和不分二级页面
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/waring_center/presentation/constants/alarm_constants.dart';
|
||||
|
||||
/// AI 诊断建议卡片
|
||||
class AiDiagnosisCard extends StatelessWidget {
|
||||
const AiDiagnosisCard({
|
||||
super.key,
|
||||
required this.content,
|
||||
this.onViewDetails,
|
||||
});
|
||||
|
||||
final String content;
|
||||
final VoidCallback? onViewDetails;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(AlarmDimensions.horizontalPadding),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AlarmColors.aiCardBg,
|
||||
borderRadius: BorderRadius.circular(AlarmDimensions.borderRadius),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
decoration: const BoxDecoration(
|
||||
color: AlarmColors.primary,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.auto_awesome,
|
||||
color: Colors.white,
|
||||
size: 14,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Text(
|
||||
'AI诊断建议',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AlarmColors.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
content,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: AlarmColors.textSecondary,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: GestureDetector(
|
||||
onTap: onViewDetails,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text(
|
||||
'查看详情',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AlarmColors.primary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 12,
|
||||
color: AlarmColors.primary,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/waring_center/domain/entities/alarm_count_entity.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/waring_center/presentation/constants/alarm_constants.dart';
|
||||
|
||||
/// 告警统计卡片
|
||||
class AlarmCountCard extends StatelessWidget {
|
||||
const AlarmCountCard({
|
||||
super.key,
|
||||
required this.count,
|
||||
});
|
||||
|
||||
final AlarmCountEntity count;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: AlarmDimensions.horizontalPadding),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AlarmColors.background,
|
||||
borderRadius: BorderRadius.circular(AlarmDimensions.borderRadius),
|
||||
boxShadow: [AlarmDimensions.cardShadow],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildCountItem(
|
||||
label: '未处理',
|
||||
value: count.unprocessed,
|
||||
color: AlarmColors.danger,
|
||||
bgColor: AlarmColors.unprocessedBg,
|
||||
labelColor: AlarmColors.danger,
|
||||
),
|
||||
),
|
||||
_buildDivider(),
|
||||
Expanded(
|
||||
child: _buildCountItem(
|
||||
label: '处理中',
|
||||
value: count.processing,
|
||||
color: AlarmColors.textPrimary,
|
||||
),
|
||||
),
|
||||
_buildDivider(),
|
||||
Expanded(
|
||||
child: _buildCountItem(
|
||||
label: '已确认',
|
||||
value: count.confirmed,
|
||||
color: const Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
_buildDivider(),
|
||||
Expanded(
|
||||
child: _buildCountItem(
|
||||
label: '今日新增',
|
||||
value: count.todayNew,
|
||||
color: const Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCountItem({
|
||||
required String label,
|
||||
required int value,
|
||||
required Color color,
|
||||
Color? bgColor,
|
||||
Color? labelColor,
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: labelColor ?? AlarmColors.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
value.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDivider() {
|
||||
return Container(
|
||||
width: 1,
|
||||
height: 50,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 8),
|
||||
color: const Color(0xFFE5E6EB),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/waring_center/domain/entities/alarm_entity.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/waring_center/presentation/constants/alarm_constants.dart';
|
||||
|
||||
/// 告警项卡片
|
||||
class AlarmItemCard extends StatelessWidget {
|
||||
const AlarmItemCard({
|
||||
super.key,
|
||||
required this.alarm,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
final AlarmEntity alarm;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: AlarmDimensions.horizontalPadding,
|
||||
vertical: 6,
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AlarmColors.background,
|
||||
borderRadius: BorderRadius.circular(AlarmDimensions.borderRadius),
|
||||
boxShadow: [AlarmDimensions.cardShadow],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 第一行:图标 + 标题 + 等级标签
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
alarm.level.icon,
|
||||
color: alarm.level.color,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
alarm.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AlarmColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: alarm.level.color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
alarm.level.label,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: alarm.level.color,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// 第二行:区域和设备
|
||||
Text(
|
||||
'区域:${alarm.area} / 设备:${alarm.device}',
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: AlarmColors.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// 第三行:时间和状态
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
alarm.time,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: AlarmColors.textTertiary,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
alarm.status.label,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: alarm.status == AlarmStatus.unconfirmed
|
||||
? AlarmColors.warning
|
||||
: AlarmColors.textTertiary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 12,
|
||||
color: alarm.status == AlarmStatus.unconfirmed
|
||||
? AlarmColors.warning
|
||||
: AlarmColors.textTertiary,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/waring_center/presentation/constants/alarm_constants.dart';
|
||||
|
||||
/// 告警筛选标签栏
|
||||
class AlarmTabBar extends StatelessWidget {
|
||||
const AlarmTabBar({
|
||||
super.key,
|
||||
required this.selectedFilter,
|
||||
required this.onFilterChanged,
|
||||
this.backgroundColor = Colors.transparent,
|
||||
});
|
||||
|
||||
final AlarmFilterTab selectedFilter;
|
||||
final ValueChanged<AlarmFilterTab> onFilterChanged;
|
||||
final Color backgroundColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 44,
|
||||
color: backgroundColor,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: EdgeInsets.zero,
|
||||
itemCount: AlarmFilterTab.values.length,
|
||||
itemBuilder: (context, index) {
|
||||
final filter = AlarmFilterTab.values[index];
|
||||
final isSelected = selectedFilter == filter;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => onFilterChanged(filter),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
filter.label,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
||||
color: isSelected ? AlarmColors.primary : AlarmColors.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Container(
|
||||
height: 2,
|
||||
width: 20,
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? AlarmColors.primary : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(1),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user