- UI 系统: 新增 design_tokens / module_visuals / app_buttons / app_status_badge / app_toast / ai_content 六个共享模块; 28 个页面接入, SnackBar 全部替换为 AppToast - 趋势图: 直线折线 + 渐变填充 + 阴影; 去网格线; X 轴日+月份分隔; Y 轴整数刻度最多 4 个; 点击数据点/录入记录显示上方浮层, 选中点变实心 - 法律文档 H5: 后端 wwwroot 托管隐私政策/服务协议/关于/个人信息收集清单/第三方 SDK 清单 + 索引页; Program.cs 启用 UseDefaultFiles + UseStaticFiles - 其他: auth_provider 登录流程调整; api_client IP 适配; 主页智能体栏间距优化
274 lines
7.6 KiB
Dart
274 lines
7.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../core/app_colors.dart';
|
|
import '../core/app_design_tokens.dart';
|
|
import '../core/app_theme.dart';
|
|
|
|
class EnterpriseStat {
|
|
final String label;
|
|
final String value;
|
|
final IconData? icon;
|
|
|
|
const EnterpriseStat({required this.label, required this.value, this.icon});
|
|
}
|
|
|
|
class EnterpriseHeader extends StatelessWidget {
|
|
final String title;
|
|
final String subtitle;
|
|
final IconData icon;
|
|
final Color color;
|
|
final Color accent;
|
|
final List<EnterpriseStat> stats;
|
|
final Widget? trailing;
|
|
final bool showIcon;
|
|
|
|
const EnterpriseHeader({
|
|
super.key,
|
|
required this.title,
|
|
required this.subtitle,
|
|
required this.icon,
|
|
required this.color,
|
|
required this.accent,
|
|
this.stats = const [],
|
|
this.trailing,
|
|
this.showIcon = true,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: AppSpacing.panel,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: AppRadius.xlBorder,
|
|
border: Border.all(color: AppColors.border, width: 1.1),
|
|
boxShadow: AppShadows.soft,
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
if (showIcon) ...[
|
|
Container(
|
|
width: 46,
|
|
height: 46,
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [color, accent],
|
|
),
|
|
borderRadius: BorderRadius.circular(14),
|
|
),
|
|
child: Icon(icon, color: Colors.white, size: 25),
|
|
),
|
|
const SizedBox(width: 12),
|
|
],
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
title,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: AppTextStyles.summaryTitle,
|
|
),
|
|
const SizedBox(height: 3),
|
|
Text(
|
|
subtitle,
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: AppTextStyles.summarySubtitle,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (trailing != null) ...[const SizedBox(width: 10), trailing!],
|
|
],
|
|
),
|
|
if (stats.isNotEmpty) ...[
|
|
const SizedBox(height: 14),
|
|
Row(
|
|
children: [
|
|
for (var i = 0; i < stats.length; i++) ...[
|
|
Expanded(
|
|
child: _HeaderStat(
|
|
stat: stats[i],
|
|
color: i.isEven ? color : accent,
|
|
accent: i.isEven ? accent : color,
|
|
),
|
|
),
|
|
if (i != stats.length - 1) const SizedBox(width: 8),
|
|
],
|
|
],
|
|
),
|
|
],
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _HeaderStat extends StatelessWidget {
|
|
final EnterpriseStat stat;
|
|
final Color color;
|
|
final Color accent;
|
|
|
|
const _HeaderStat({
|
|
required this.stat,
|
|
required this.color,
|
|
required this.accent,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
constraints: const BoxConstraints(minHeight: 66),
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 11),
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [
|
|
color.withValues(alpha: 0.10),
|
|
accent.withValues(alpha: 0.06),
|
|
],
|
|
),
|
|
borderRadius: AppRadius.smBorder,
|
|
border: Border.all(color: AppColors.borderLight, width: 1.1),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
if (stat.icon != null) ...[
|
|
Icon(stat.icon, color: color, size: 19),
|
|
const SizedBox(width: 8),
|
|
],
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
stat.value,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(
|
|
color: AppColors.textPrimary,
|
|
fontSize: 17,
|
|
fontWeight: FontWeight.w900,
|
|
),
|
|
),
|
|
const SizedBox(height: 2),
|
|
Text(
|
|
stat.label,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(
|
|
color: AppColors.textSecondary,
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w800,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class EnterpriseSectionCard extends StatelessWidget {
|
|
final String? title;
|
|
final IconData? icon;
|
|
final Color color;
|
|
final Widget child;
|
|
final EdgeInsetsGeometry padding;
|
|
final Widget? trailing;
|
|
|
|
const EnterpriseSectionCard({
|
|
super.key,
|
|
this.title,
|
|
this.icon,
|
|
required this.color,
|
|
required this.child,
|
|
this.trailing,
|
|
this.padding = const EdgeInsets.all(16),
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: padding,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: Border.all(color: AppColors.border, width: 1.1),
|
|
boxShadow: [AppTheme.shadowLight],
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if (title != null) ...[
|
|
Row(
|
|
children: [
|
|
if (icon != null) ...[
|
|
Container(
|
|
width: 34,
|
|
height: 34,
|
|
decoration: BoxDecoration(
|
|
color: color.withValues(alpha: 0.10),
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: Icon(icon, size: 19, color: color),
|
|
),
|
|
const SizedBox(width: 10),
|
|
],
|
|
Expanded(
|
|
child: Text(
|
|
title!,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(
|
|
fontSize: 17,
|
|
fontWeight: FontWeight.w800,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
),
|
|
?trailing,
|
|
],
|
|
),
|
|
const SizedBox(height: 14),
|
|
],
|
|
child,
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class EnterpriseFab extends StatelessWidget {
|
|
final VoidCallback onPressed;
|
|
final IconData icon;
|
|
final Color color;
|
|
|
|
const EnterpriseFab({
|
|
super.key,
|
|
required this.onPressed,
|
|
required this.icon,
|
|
required this.color,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return FloatingActionButton(
|
|
onPressed: onPressed,
|
|
backgroundColor: color,
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
|
child: Icon(icon, size: 26, color: Colors.white),
|
|
);
|
|
}
|
|
}
|