Files
Finlytic/FinlyticApp/lib/features/trades/widgets/proposed_auto_trades_card.dart
T

291 lines
12 KiB
Dart

import 'package:flutter/material.dart';
import 'dart:ui';
import '../../../core/theme/app_theme.dart';
import '../../../core/widgets/glass_container.dart';
import '../models/trade_model.dart';
import 'trade_detail_modal.dart';
/// Premium Design for the AI Auto Screener Recommendations in the Live Trades Feed.
class ProposedAutoTradesCard extends StatelessWidget {
final List<TradeModel> proposals;
final Function(TradeModel) onAcceptProposal;
const ProposedAutoTradesCard({
super.key,
required this.proposals,
required this.onAcceptProposal,
});
@override
Widget build(BuildContext context) {
if (proposals.isEmpty) {
return GlassContainer(
margin: const EdgeInsets.only(bottom: 20),
padding: const EdgeInsets.all(18),
child: Row(
children: [
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: AppTheme.primaryEmerald.withValues(alpha: 0.15),
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: AppTheme.primaryEmerald.withValues(alpha: 0.3),
blurRadius: 10,
spreadRadius: 1,
),
],
),
child: Icon(Icons.auto_awesome, color: AppTheme.primaryEmerald, size: 24),
),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'KI Screener Aktiv',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, color: Colors.white),
),
const SizedBox(height: 4),
Text(
'Die KI durchsucht den Markt kontinuierlich nach hoch-profitablen Mustern. Aktuell keine neuen Empfehlungen.',
style: TextStyle(color: AppTheme.textMuted, fontSize: 13),
),
],
),
),
],
),
);
}
// Top proposal
final topProposal = proposals.first;
final isBuy = topProposal.direction.isLong;
final signalColor = isBuy ? AppTheme.primaryEmerald : AppTheme.accentRed;
return Container(
margin: const EdgeInsets.only(bottom: 24),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
boxShadow: [
BoxShadow(
color: signalColor.withValues(alpha: 0.15),
blurRadius: 30,
spreadRadius: -5,
offset: const Offset(0, 10),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(24),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 12, sigmaY: 12),
child: Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.4),
borderRadius: BorderRadius.circular(24),
border: Border.all(
color: Colors.white.withValues(alpha: 0.1),
width: 1.5,
),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withValues(alpha: 0.08),
signalColor.withValues(alpha: 0.05),
],
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Premium Header
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [AppTheme.primaryEmerald, AppTheme.accentCyan],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
shape: BoxShape.circle,
boxShadow: [
BoxShadow(color: AppTheme.accentCyan.withValues(alpha: 0.4), blurRadius: 12, spreadRadius: 2),
],
),
child: const Icon(Icons.bolt, color: Colors.white, size: 20),
),
const SizedBox(width: 12),
const Text(
'KI Asset Empfehlung',
style: TextStyle(fontWeight: FontWeight.w900, fontSize: 16, color: Colors.white, letterSpacing: 0.5),
),
],
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: Colors.amber.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(20),
border: Border.all(color: Colors.amber.withValues(alpha: 0.5)),
boxShadow: [
BoxShadow(color: Colors.amber.withValues(alpha: 0.2), blurRadius: 8),
],
),
child: Row(
children: [
const Icon(Icons.auto_awesome, size: 14, color: Colors.amber),
const SizedBox(width: 6),
Text(
topProposal.instrumentType.label,
style: const TextStyle(color: Colors.amber, fontWeight: FontWeight.bold, fontSize: 12),
),
],
),
),
],
),
const SizedBox(height: 24),
// Asset Details with Modern Typography
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
color: signalColor.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: signalColor.withValues(alpha: 0.5)),
),
child: Text(
topProposal.direction.label,
style: TextStyle(color: signalColor, fontWeight: FontWeight.w900, fontSize: 14, letterSpacing: 1),
),
),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
topProposal.symbol.isNotEmpty ? topProposal.symbol : topProposal.underlyingIsin,
style: const TextStyle(fontWeight: FontWeight.w900, fontSize: 24, color: Colors.white, height: 1.1),
),
Text(
topProposal.underlyingIsin,
style: TextStyle(color: AppTheme.textMuted, fontSize: 13),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
],
),
const SizedBox(height: 20),
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.25),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.white.withValues(alpha: 0.05)),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.lightbulb_outline, size: 18, color: AppTheme.accentCyan.withValues(alpha: 0.8)),
const SizedBox(width: 12),
Expanded(
child: Text(
'Einstieg €${topProposal.averageBuyIn.toStringAsFixed(2)} • Stop-Loss €${topProposal.currentStopLoss.toStringAsFixed(2)}'
'${topProposal.primaryTakeProfit != null ? ' • Take-Profit €${topProposal.primaryTakeProfit!.toStringAsFixed(2)}' : ''}',
style: const TextStyle(color: Colors.white70, fontSize: 13, height: 1.4),
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
),
],
),
),
const SizedBox(height: 24),
// Premium Action Buttons
Row(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: AppTheme.accentCyan.withValues(alpha: 0.5)),
color: AppTheme.accentCyan.withValues(alpha: 0.1),
),
child: IconButton(
onPressed: () => TradeDetailModal.show(
context,
trade: topProposal,
onAccept: () => onAcceptProposal(topProposal),
),
icon: Icon(Icons.analytics_outlined, color: AppTheme.accentCyan, size: 22),
tooltip: 'KI-Analyse & Details',
),
),
const SizedBox(width: 16),
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: AppTheme.primaryEmerald.withValues(alpha: 0.3),
blurRadius: 12,
offset: const Offset(0, 4),
),
],
),
child: ElevatedButton(
onPressed: () => onAcceptProposal(topProposal),
style: ElevatedButton.styleFrom(
backgroundColor: AppTheme.primaryEmerald,
foregroundColor: Colors.black,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
elevation: 0,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.insights, size: 20, color: Colors.black87),
const SizedBox(width: 8),
Text(
'Trade Setup Erstellen',
style: const TextStyle(fontWeight: FontWeight.w900, fontSize: 15, letterSpacing: 0.2),
),
],
),
),
),
),
],
),
],
),
),
),
),
);
}
}