gcx/frontend/admin-app/lib/shared/widgets/ai_suggestion_card.dart

79 lines
2.6 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/material.dart';
import '../../app/theme/app_colors.dart';
import '../../app/i18n/app_localizations.dart';
/// 通用AI建议卡片发行方专用
///
/// 场景:发券建议、定价优化、信用提升、销售分析、额度规划
class AiSuggestionCard extends StatelessWidget {
final String content;
final bool actionable;
final VoidCallback? onAccept;
final VoidCallback? onDismiss;
const AiSuggestionCard({
super.key,
required this.content,
this.actionable = true,
this.onAccept,
this.onDismiss,
});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
color: AppColors.primarySurface,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: AppColors.primary.withValues(alpha: 0.15)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 28,
height: 28,
decoration: BoxDecoration(
gradient: AppColors.primaryGradient,
borderRadius: BorderRadius.circular(7),
),
child: const Icon(Icons.auto_awesome_rounded, color: Colors.white, size: 14),
),
const SizedBox(width: 8),
Text(context.t('ai_suggestion_label'), style: const TextStyle(fontSize: 13, color: AppColors.primary, fontWeight: FontWeight.w600)),
],
),
const SizedBox(height: 10),
Text(
content,
style: const TextStyle(fontSize: 13, color: AppColors.textSecondary, height: 1.5),
),
if (actionable) ...[
const SizedBox(height: 12),
Row(
children: [
TextButton(
onPressed: onDismiss,
child: Text(context.t('ai_suggestion_dismiss'), style: const TextStyle(fontSize: 13)),
),
const SizedBox(width: 8),
ElevatedButton(
onPressed: onAccept,
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
minimumSize: Size.zero,
),
child: Text(context.t('ai_suggestion_accept'), style: const TextStyle(fontSize: 13)),
),
],
),
],
],
),
);
}
}