feat(App): update Finlytic Flutter app UI and blocs
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../core/network/api_client.dart';
|
||||
import '../../../core/network/signalr_service.dart';
|
||||
import '../widgets/asset_discovery_bar.dart';
|
||||
import '../widgets/daily_news_snapshot.dart';
|
||||
import '../widgets/favorites_carousel.dart';
|
||||
import '../widgets/trades_stream_widget.dart';
|
||||
|
||||
/// Dashboard Tab screen assembling user favorites, discovery bar, news snapshot, and trades stream.
|
||||
class DashboardScreen extends StatelessWidget {
|
||||
final ApiClient apiClient;
|
||||
final SignalRService signalRService;
|
||||
|
||||
const DashboardScreen({
|
||||
super.key,
|
||||
required this.apiClient,
|
||||
required this.signalRService,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('Asset Entdeckung', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
|
||||
const SizedBox(height: 8),
|
||||
AssetDiscoveryBar(apiClient: apiClient),
|
||||
const SizedBox(height: 20),
|
||||
const Text('Meine Favoriten Watchlist', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
|
||||
const SizedBox(height: 8),
|
||||
FavoritesCarousel(apiClient: apiClient),
|
||||
const SizedBox(height: 24),
|
||||
TradesStreamWidget(apiClient: apiClient),
|
||||
const SizedBox(height: 24),
|
||||
DailyNewsSnapshot(apiClient: apiClient),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../core/network/api_client.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
import '../../../core/widgets/shimmer_loading.dart';
|
||||
import '../../asset_detail/views/asset_detail_screen.dart';
|
||||
import '../../discovery/cubit/discovery_cubit.dart';
|
||||
import '../../favorites/cubit/favorites_cubit.dart';
|
||||
|
||||
/// Dynamic Scrollable Discovery Bar consuming DiscoveryCubit with real-time backend recommendations.
|
||||
class AssetDiscoveryBar extends StatefulWidget {
|
||||
final ApiClient apiClient;
|
||||
|
||||
const AssetDiscoveryBar({
|
||||
super.key,
|
||||
required this.apiClient,
|
||||
});
|
||||
|
||||
@override
|
||||
State<AssetDiscoveryBar> createState() => _AssetDiscoveryBarState();
|
||||
}
|
||||
|
||||
class _AssetDiscoveryBarState extends State<AssetDiscoveryBar> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
final cubit = context.read<DiscoveryCubit>();
|
||||
if (cubit.state.assets.isEmpty) {
|
||||
cubit.loadDiscovery();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final activeTheme = AppTheme.activePreset;
|
||||
|
||||
return BlocBuilder<DiscoveryCubit, DiscoveryState>(
|
||||
builder: (context, discState) {
|
||||
if (discState.isLoading && discState.assets.isEmpty) {
|
||||
return SizedBox(
|
||||
height: 38,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: 6,
|
||||
itemBuilder: (_, __) => const Padding(
|
||||
padding: EdgeInsets.only(right: 8),
|
||||
child: ShimmerLoading(width: 130, height: 38, borderRadius: 20),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final assets = discState.assets;
|
||||
if (assets.isEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
return BlocBuilder<FavoritesCubit, FavoritesState>(
|
||||
builder: (context, favState) {
|
||||
return SizedBox(
|
||||
height: 38,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: assets.length,
|
||||
itemBuilder: (context, index) {
|
||||
final asset = assets[index];
|
||||
final identifier = asset.symbol.isNotEmpty ? asset.symbol : asset.isin;
|
||||
final isFav = favState.isFavorite(identifier) || favState.isFavorite(asset.isin);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 8),
|
||||
child: ActionChip(
|
||||
avatar: Icon(
|
||||
isFav ? Icons.star_rounded : Icons.explore_outlined,
|
||||
size: 16,
|
||||
color: isFav ? Colors.amber : activeTheme.primaryColor,
|
||||
),
|
||||
label: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
asset.name.isNotEmpty ? asset.name : asset.symbol,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: activeTheme.textPrimary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
backgroundColor: activeTheme.glassSurface,
|
||||
side: BorderSide(
|
||||
color: isFav ? Colors.amber.withValues(alpha: 0.5) : activeTheme.glassBorder,
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => AssetDetailScreen(
|
||||
symbol: identifier,
|
||||
apiClient: widget.apiClient,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../core/network/api_client.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
import '../../../core/utils/time_utils.dart';
|
||||
import '../../../core/widgets/glass_container.dart';
|
||||
import '../../../core/widgets/status_badge.dart';
|
||||
import '../../news/bloc/news_bloc.dart';
|
||||
import '../../news/bloc/news_event.dart';
|
||||
import '../../news/bloc/news_state.dart';
|
||||
import '../../news/models/news_article_model.dart';
|
||||
import '../../news/repositories/news_repository.dart';
|
||||
import '../../news/widgets/article_sentiment_dialog.dart';
|
||||
|
||||
class DailyNewsSnapshot extends StatelessWidget {
|
||||
final ApiClient apiClient;
|
||||
final String backendUrl;
|
||||
|
||||
const DailyNewsSnapshot({
|
||||
super.key,
|
||||
required this.apiClient,
|
||||
this.backendUrl = 'http://localhost:5000',
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => NewsBloc(
|
||||
repository: NewsRepository(apiClient: apiClient, backendUrl: backendUrl),
|
||||
)..add(FetchNews(date: DateTime.now().toIso8601String().substring(0, 10))),
|
||||
child: const _DailyNewsSnapshotContent(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class _DailyNewsSnapshotContent extends StatefulWidget {
|
||||
const _DailyNewsSnapshotContent();
|
||||
|
||||
@override
|
||||
State<_DailyNewsSnapshotContent> createState() => _DailyNewsSnapshotContentState();
|
||||
}
|
||||
|
||||
class _DailyNewsSnapshotContentState extends State<_DailyNewsSnapshotContent> {
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_scrollController.addListener(() {
|
||||
if (_scrollController.position.pixels >= _scrollController.position.maxScrollExtent - 80) {
|
||||
context.read<NewsBloc>().add(LoadMoreNews());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GlassContainer(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text('Tagesnachrichten', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
|
||||
const SizedBox(width: 8),
|
||||
BlocBuilder<NewsBloc, NewsState>(
|
||||
builder: (context, state) {
|
||||
if (state is NewsLoaded && state.articles.isNotEmpty) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.accentCyan.withValues(alpha: 0.15),
|
||||
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Text(
|
||||
'${state.articles.length} Artikel',
|
||||
style: TextStyle(color: AppTheme.accentCyan, fontSize: 11, fontWeight: FontWeight.bold),
|
||||
),
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.refresh, color: AppTheme.accentCyan, size: 18),
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
onPressed: () {
|
||||
context.read<NewsBloc>().add(FetchNews(isRefresh: true, date: DateTime.now().toIso8601String().substring(0, 10)));
|
||||
},
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
BlocBuilder<NewsBloc, NewsState>(
|
||||
builder: (context, state) {
|
||||
if (state is NewsInitial || (state is NewsLoading && context.read<NewsBloc>().state is! NewsLoaded)) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 32),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(color: AppTheme.primaryEmerald, strokeWidth: 2),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (state is NewsError) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||
child: Center(
|
||||
child: Text(
|
||||
state.message,
|
||||
style: TextStyle(color: AppTheme.textMuted, fontSize: 12),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (state is NewsLoaded) {
|
||||
final articles = state.articles;
|
||||
|
||||
if (articles.isEmpty) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Keine aktuellen Nachrichten verfügbar',
|
||||
style: TextStyle(color: AppTheme.textMuted, fontSize: 12),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
height: 380,
|
||||
child: ListView.builder(
|
||||
controller: _scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
itemCount: articles.length + (state.hasReachedMax ? 0 : 1),
|
||||
itemBuilder: (context, index) {
|
||||
if (index == articles.length) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(color: AppTheme.primaryEmerald, strokeWidth: 2),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final NewsArticleModel article = articles[index];
|
||||
final timeStr = TimeUtils.formatRelativeTime(article.publishedAt.toIso8601String());
|
||||
|
||||
final Widget? badgeWidget = article.sentiment.trim().isNotEmpty
|
||||
? StatusBadge.sentiment(article.sentiment, score: article.sentimentScore)
|
||||
: null;
|
||||
|
||||
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
article.title,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 13),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Text(
|
||||
'${article.author}${timeStr.isNotEmpty ? ' • $timeStr' : ''}',
|
||||
style: TextStyle(color: AppTheme.textMuted, fontSize: 11),
|
||||
),
|
||||
trailing: badgeWidget,
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => ArticleSentimentDialog(
|
||||
articleData: article,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../core/network/api_client.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
import '../../../core/widgets/asset_logo_widget.dart';
|
||||
import '../../../core/widgets/glass_container.dart';
|
||||
import '../../../shared/widgets/favorite_star_button.dart';
|
||||
import '../../asset_detail/views/asset_detail_screen.dart';
|
||||
import '../../favorites/cubit/favorites_cubit.dart';
|
||||
|
||||
/// Dynamic User Favorites Carousel widget bound to FavoritesCubit with real-time SignalR prices.
|
||||
class FavoritesCarousel extends StatelessWidget {
|
||||
final ApiClient apiClient;
|
||||
|
||||
const FavoritesCarousel({
|
||||
super.key,
|
||||
required this.apiClient,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<FavoritesCubit, FavoritesState>(
|
||||
builder: (context, state) {
|
||||
final activeTheme = AppTheme.activePreset;
|
||||
final favoritesList = state.favoriteDetails;
|
||||
|
||||
if (favoritesList.isEmpty) {
|
||||
return GlassContainer(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Keine Favoriten vorhanden. Nutze die Suche (Lupe), um Wertpapiere hinzuzufügen.',
|
||||
style: TextStyle(color: activeTheme.textMuted, fontSize: 13),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
height: 110,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: favoritesList.length,
|
||||
itemBuilder: (context, index) {
|
||||
final fav = favoritesList[index];
|
||||
final displayName = fav.name.isNotEmpty
|
||||
? fav.name
|
||||
: (fav.symbol.isNotEmpty ? fav.symbol : fav.isin);
|
||||
final isinOrSymbol = fav.isin.isNotEmpty
|
||||
? fav.isin
|
||||
: (fav.symbol.isNotEmpty ? fav.symbol : fav.name);
|
||||
|
||||
final isPositive = fav.change24h >= 0;
|
||||
|
||||
return Container(
|
||||
width: 195,
|
||||
margin: const EdgeInsets.only(right: 12),
|
||||
child: GlassContainer(
|
||||
padding: const EdgeInsets.all(12),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => AssetDetailScreen(
|
||||
symbol: isinOrSymbol,
|
||||
apiClient: apiClient,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
AssetLogoWidget(
|
||||
symbolOrName: isinOrSymbol,
|
||||
imageUrl: fav.image.isNotEmpty ? fav.image : null,
|
||||
size: 24,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
displayName,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13,
|
||||
color: activeTheme.textPrimary),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
FavoriteStarButton(
|
||||
identifier: isinOrSymbol,
|
||||
symbol: fav.symbol,
|
||||
name: fav.name,
|
||||
size: 18,
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'${fav.currentPrice > 0 ? fav.currentPrice.toStringAsFixed(2) : '--.--'} €',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12.5,
|
||||
color: activeTheme.textPrimary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${isPositive ? '+' : ''}${fav.change24h.toStringAsFixed(2)}%',
|
||||
style: TextStyle(
|
||||
color: isPositive ? AppTheme.primaryEmerald : AppTheme.accentRed,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 11.5,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../core/network/api_client.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
import '../../../core/widgets/glass_container.dart';
|
||||
import '../../../core/widgets/shimmer_loading.dart';
|
||||
import '../../trades/bloc/trade_bloc.dart';
|
||||
import '../../trades/bloc/trade_event.dart';
|
||||
import '../../trades/bloc/trade_state.dart';
|
||||
import '../../trades/repositories/trade_repository.dart';
|
||||
import '../../asset_detail/views/asset_detail_screen.dart';
|
||||
import 'dart:ui';
|
||||
|
||||
/// Premium Dashboard Widget for Auto-Screener Asset Recommendations
|
||||
class TradesStreamWidget extends StatelessWidget {
|
||||
final ApiClient apiClient;
|
||||
|
||||
const TradesStreamWidget({super.key, required this.apiClient});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => TradeBloc(
|
||||
repository: TradeRepository(apiClient: apiClient),
|
||||
)..add(const FetchTrades()),
|
||||
child: const _TradesStreamWidgetContent(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _TradesStreamWidgetContent extends StatelessWidget {
|
||||
const _TradesStreamWidgetContent();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<TradeBloc, TradeState>(
|
||||
builder: (context, state) {
|
||||
if (state is TradeLoading) {
|
||||
return const _PremiumLoadingSkeleton();
|
||||
}
|
||||
|
||||
if (state is TradeLoaded) {
|
||||
final proposals = state.trades.where((t) => t.isProposed && !t.isRejected).toList();
|
||||
|
||||
if (proposals.isEmpty) {
|
||||
return const _EmptyRecommendations();
|
||||
}
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.primaryEmerald.withValues(alpha: 0.2),
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppTheme.primaryEmerald.withValues(alpha: 0.4),
|
||||
blurRadius: 8,
|
||||
spreadRadius: 2,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Icon(Icons.bolt, color: AppTheme.primaryEmerald, size: 18),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Text(
|
||||
'KI Asset Empfehlungen',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.white, letterSpacing: 0.5),
|
||||
),
|
||||
const Spacer(),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.amber.withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: Colors.amber.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.star_rounded, size: 14, color: Colors.amber),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${proposals.length} Neu',
|
||||
style: const TextStyle(color: Colors.amber, fontWeight: FontWeight.bold, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(
|
||||
height: 160,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
itemCount: proposals.length,
|
||||
itemBuilder: (context, index) {
|
||||
final p = proposals[index];
|
||||
final isBuy = p.signalType.toUpperCase() == 'BUY' || p.signalType.toUpperCase() == 'LONG';
|
||||
final signalColor = isBuy ? AppTheme.primaryEmerald : AppTheme.accentRed;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (ctx) => AssetDetailScreen(
|
||||
symbol: p.symbol.isNotEmpty ? p.symbol : p.isin,
|
||||
apiClient: context.read<TradeBloc>().repository.apiClient,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
width: 260,
|
||||
margin: const EdgeInsets.only(right: 16),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.03),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: Colors.white.withValues(alpha: 0.1)),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
Colors.white.withValues(alpha: 0.08),
|
||||
signalColor.withValues(alpha: 0.02),
|
||||
],
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
p.symbol.isNotEmpty ? p.symbol : 'Trade',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: Colors.white),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: signalColor.withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: signalColor.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: Text(
|
||||
p.signalType,
|
||||
style: TextStyle(color: signalColor, fontWeight: FontWeight.bold, fontSize: 11),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (p.companyName.isNotEmpty) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
p.companyName,
|
||||
style: TextStyle(color: AppTheme.textMuted, fontSize: 12),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
if (p.reasoning.isNotEmpty) ...[
|
||||
Text(
|
||||
p.reasoning,
|
||||
style: const TextStyle(color: Colors.white70, fontSize: 11, fontStyle: FontStyle.italic),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'KI Score: ${(p.winRate).toStringAsFixed(0)}%',
|
||||
style: TextStyle(color: AppTheme.accentCyan, fontWeight: FontWeight.w600, fontSize: 13),
|
||||
),
|
||||
const Spacer(),
|
||||
const Icon(Icons.arrow_forward_rounded, color: Colors.white54, size: 16),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _PremiumLoadingSkeleton extends StatelessWidget {
|
||||
const _PremiumLoadingSkeleton();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const ShimmerLoading(width: 200, height: 24, borderRadius: 4),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(
|
||||
height: 160,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: 3,
|
||||
itemBuilder: (_, __) => const Padding(
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
child: ShimmerLoading(width: 260, height: 160, borderRadius: 20),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _EmptyRecommendations extends StatelessWidget {
|
||||
const _EmptyRecommendations();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GlassContainer(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.accentCyan.withValues(alpha: 0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(Icons.radar, color: AppTheme.accentCyan, size: 24),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'KI Screener läuft...',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15, color: Colors.white),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Es gibt aktuell keine neuen hoch-konfidenten Asset-Vorschläge. Die KI analysiert den Markt kontinuierlich.',
|
||||
style: TextStyle(color: AppTheme.textMuted, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user