- Implemented new navigation system with NavigationProvider and route management - Added adaptive theme system with ThemeProvider for better theme handling - Introduced glassmorphism design elements (app bars, scaffolds, cards) - Added advanced animations (spring animations, page transitions, staggered lists) - Implemented performance optimizations (memory manager, lazy loading) - Refactored Analysis screen into modular components - Added floating navigation bar with haptic feedback - Improved subscription cards with swipe actions - Enhanced skeleton loading with better animations - Added cached network image support - Improved overall app architecture and code organization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
272 lines
14 KiB
Dart
272 lines
14 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../../providers/subscription_provider.dart';
|
|
import '../../services/currency_util.dart';
|
|
import '../glassmorphism_card.dart';
|
|
import '../themed_text.dart';
|
|
|
|
/// 이벤트 할인 현황을 보여주는 카드 위젯
|
|
class EventAnalysisCard extends StatelessWidget {
|
|
final AnimationController animationController;
|
|
|
|
const EventAnalysisCard({
|
|
super.key,
|
|
required this.animationController,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SliverToBoxAdapter(
|
|
child: Consumer<SubscriptionProvider>(
|
|
builder: (context, provider, child) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: provider.activeEventSubscriptions.isNotEmpty
|
|
? FadeTransition(
|
|
opacity: CurvedAnimation(
|
|
parent: animationController,
|
|
curve: const Interval(0.6, 1.0, curve: Curves.easeOut),
|
|
),
|
|
child: SlideTransition(
|
|
position: Tween<Offset>(
|
|
begin: const Offset(0, 0.2),
|
|
end: Offset.zero,
|
|
).animate(CurvedAnimation(
|
|
parent: animationController,
|
|
curve: const Interval(0.6, 1.0, curve: Curves.easeOut),
|
|
)),
|
|
child: GlassmorphismCard(
|
|
blur: 10,
|
|
opacity: 0.1,
|
|
borderRadius: 16,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
ThemedText.headline(
|
|
text: '이벤트 할인 현황',
|
|
style: const TextStyle(
|
|
fontSize: 18,
|
|
),
|
|
),
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 8,
|
|
vertical: 4,
|
|
),
|
|
decoration: BoxDecoration(
|
|
gradient: const LinearGradient(
|
|
colors: [
|
|
Color(0xFFFF6B6B),
|
|
Color(0xFFFE7E7E),
|
|
],
|
|
),
|
|
borderRadius: BorderRadius.circular(4),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
const FaIcon(
|
|
FontAwesomeIcons.fire,
|
|
size: 12,
|
|
color: Colors.white,
|
|
),
|
|
const SizedBox(width: 4),
|
|
Text(
|
|
'${provider.activeEventSubscriptions.length}개 진행중',
|
|
style: const TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 16),
|
|
Container(
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
colors: [
|
|
const Color(0xFFFF6B6B).withValues(alpha: 0.1),
|
|
const Color(0xFFFF8787).withValues(alpha: 0.1),
|
|
],
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
),
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: Border.all(
|
|
color: const Color(0xFFFF6B6B).withValues(alpha: 0.3),
|
|
),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
const Icon(
|
|
Icons.savings,
|
|
color: Color(0xFFFF6B6B),
|
|
size: 32,
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const ThemedText(
|
|
'월간 절약 금액',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
ThemedText(
|
|
CurrencyUtil.formatTotalAmount(
|
|
provider.calculateTotalSavings(),
|
|
),
|
|
style: const TextStyle(
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.bold,
|
|
color: Color(0xFFFF6B6B),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
const ThemedText(
|
|
'진행중인 이벤트',
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
...provider.activeEventSubscriptions.map((sub) {
|
|
final savings = sub.originalPrice - (sub.eventPrice ?? sub.originalPrice);
|
|
final discountRate =
|
|
((savings / sub.originalPrice) * 100).round();
|
|
return Container(
|
|
margin: const EdgeInsets.only(bottom: 8),
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withValues(alpha: 0.05),
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: Border.all(
|
|
color: Colors.white.withValues(alpha: 0.1),
|
|
),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
ThemedText(
|
|
sub.serviceName,
|
|
style: const TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
Row(
|
|
children: [
|
|
FutureBuilder<String>(
|
|
future: CurrencyUtil
|
|
.formatAmount(
|
|
sub.originalPrice,
|
|
sub.currency),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.hasData) {
|
|
return ThemedText(
|
|
snapshot.data!,
|
|
style: const TextStyle(
|
|
fontSize: 12,
|
|
decoration: TextDecoration
|
|
.lineThrough,
|
|
color: Colors.grey,
|
|
),
|
|
);
|
|
}
|
|
return const SizedBox();
|
|
},
|
|
),
|
|
const SizedBox(width: 8),
|
|
const Icon(
|
|
Icons.arrow_forward,
|
|
size: 12,
|
|
color: Colors.grey,
|
|
),
|
|
const SizedBox(width: 8),
|
|
FutureBuilder<String>(
|
|
future: CurrencyUtil
|
|
.formatAmount(
|
|
sub.eventPrice ?? sub.originalPrice,
|
|
sub.currency),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.hasData) {
|
|
return ThemedText(
|
|
snapshot.data!,
|
|
style: const TextStyle(
|
|
fontSize: 12,
|
|
fontWeight:
|
|
FontWeight.bold,
|
|
color:
|
|
Color(0xFF10B981),
|
|
),
|
|
);
|
|
}
|
|
return const SizedBox();
|
|
},
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 8,
|
|
vertical: 4,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFFF6B6B)
|
|
.withValues(alpha: 0.2),
|
|
borderRadius: BorderRadius.circular(4),
|
|
),
|
|
child: Text(
|
|
'$discountRate% 할인',
|
|
style: const TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.bold,
|
|
color: Color(0xFFFF6B6B),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}).toList(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
)
|
|
: const SizedBox.shrink(),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
} |