a10a2db27a
- 新增 visual_design_language.md 设计规范文档 - 新增 auth 设计 tokens (authBackground, authCard, authInput, feedback 系列等) - 重构登录/注册/验证码/重置密码页面为新设计系统 - 新增 AuthHeroHeader, AuthSurfaceCard, AuthSection, AuthField, PasswordField 组件 - 重构 AppBanner 和 Toast 支持多类型配置 (info/success/warning/error) - 后端 AgentScope: 重整 schemas/prompts/tools 作用域, 新增协议文档 - 更新 AGENTS.md 集成视觉设计语言约束
224 lines
6.5 KiB
Dart
224 lines
6.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../../core/theme/design_tokens.dart';
|
|
import '../../../../shared/widgets/app_button.dart';
|
|
import '../../data/inbox_api.dart';
|
|
|
|
class CalendarInviteCard extends StatelessWidget {
|
|
final InboxMessageResponse message;
|
|
final VoidCallback onAccept;
|
|
final VoidCallback onReject;
|
|
|
|
const CalendarInviteCard({
|
|
super.key,
|
|
required this.message,
|
|
required this.onAccept,
|
|
required this.onReject,
|
|
});
|
|
|
|
String? get eventTitle {
|
|
final data = message.content;
|
|
return data?['title'] as String?;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: const EdgeInsets.symmetric(
|
|
horizontal: AppSpacing.md,
|
|
vertical: AppSpacing.xs,
|
|
),
|
|
padding: const EdgeInsets.all(AppSpacing.md),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.white,
|
|
borderRadius: BorderRadius.circular(AppRadius.md),
|
|
border: Border.all(color: AppColors.border),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.blue100,
|
|
borderRadius: BorderRadius.circular(AppRadius.sm),
|
|
),
|
|
child: const Icon(
|
|
Icons.calendar_today,
|
|
color: AppColors.blue600,
|
|
size: 20,
|
|
),
|
|
),
|
|
const SizedBox(width: AppSpacing.sm),
|
|
const Expanded(
|
|
child: Text(
|
|
'日历邀请',
|
|
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: AppSpacing.sm),
|
|
Text(
|
|
eventTitle != null ? '邀请你访问 "$eventTitle"' : '邀请你访问日历',
|
|
style: const TextStyle(fontSize: 14, color: AppColors.slate700),
|
|
),
|
|
const SizedBox(height: AppSpacing.md),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: AppButton(
|
|
text: '拒绝',
|
|
isOutlined: true,
|
|
onPressed: onReject,
|
|
),
|
|
),
|
|
const SizedBox(width: AppSpacing.sm),
|
|
Expanded(
|
|
child: AppButton(text: '接受', onPressed: onAccept),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class CalendarUpdateCard extends StatelessWidget {
|
|
final InboxMessageResponse message;
|
|
final VoidCallback? onTap;
|
|
|
|
const CalendarUpdateCard({super.key, required this.message, this.onTap});
|
|
|
|
String? get eventTitle {
|
|
final data = message.content;
|
|
return data?['title'] as String?;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
child: Container(
|
|
margin: const EdgeInsets.symmetric(
|
|
horizontal: AppSpacing.md,
|
|
vertical: AppSpacing.xs,
|
|
),
|
|
padding: const EdgeInsets.all(AppSpacing.md),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.white,
|
|
borderRadius: BorderRadius.circular(AppRadius.md),
|
|
border: Border.all(color: AppColors.border),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.blue100,
|
|
borderRadius: BorderRadius.circular(AppRadius.sm),
|
|
),
|
|
child: const Icon(
|
|
Icons.calendar_today,
|
|
color: AppColors.blue600,
|
|
size: 20,
|
|
),
|
|
),
|
|
const SizedBox(width: AppSpacing.sm),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
eventTitle != null ? '$eventTitle 已更新' : '日历事件已更新',
|
|
style: const TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
const SizedBox(height: 2),
|
|
Text(
|
|
_formatTime(message.createdAt),
|
|
style: const TextStyle(
|
|
fontSize: 12,
|
|
color: AppColors.slate500,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const Icon(Icons.chevron_right, color: AppColors.slate400),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
String _formatTime(DateTime time) {
|
|
final now = DateTime.now();
|
|
final diff = now.difference(time);
|
|
if (diff.inMinutes < 60) {
|
|
return '${diff.inMinutes}分钟前';
|
|
} else if (diff.inHours < 24) {
|
|
return '${diff.inHours}小时前';
|
|
} else if (diff.inDays < 7) {
|
|
return '${diff.inDays}天前';
|
|
} else {
|
|
return '${time.month}月${time.day}日';
|
|
}
|
|
}
|
|
}
|
|
|
|
class CalendarDeleteCard extends StatelessWidget {
|
|
final InboxMessageResponse message;
|
|
|
|
const CalendarDeleteCard({super.key, required this.message});
|
|
|
|
String? get eventTitle {
|
|
final data = message.content;
|
|
return data?['title'] as String?;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: const EdgeInsets.symmetric(
|
|
horizontal: AppSpacing.md,
|
|
vertical: AppSpacing.xs,
|
|
),
|
|
padding: const EdgeInsets.all(AppSpacing.md),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.slate50,
|
|
borderRadius: BorderRadius.circular(AppRadius.md),
|
|
border: Border.all(color: AppColors.slate200),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.slate200,
|
|
borderRadius: BorderRadius.circular(AppRadius.sm),
|
|
),
|
|
child: const Icon(
|
|
Icons.calendar_today,
|
|
color: AppColors.slate500,
|
|
size: 20,
|
|
),
|
|
),
|
|
const SizedBox(width: AppSpacing.sm),
|
|
Expanded(
|
|
child: Text(
|
|
eventTitle != null ? '$eventTitle 已删除' : '日历事件已删除',
|
|
style: const TextStyle(fontSize: 14, color: AppColors.slate500),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|