Files
submanager/lib/screens/splash_screen.dart
JiWoong Sul 8619e96739 Initial commit: SubManager Flutter App
주요 구현 완료 기능:
- 구독 관리 (추가/편집/삭제/카테고리 분류)
- 이벤트 할인 시스템 (기본값 자동 설정)
- SMS 자동 스캔 및 구독 정보 추출
- 알림 시스템 (타임존 처리 안정화)
- 환율 변환 지원 (KRW/USD)
- 반응형 UI 및 애니메이션
- 다국어 지원 (한국어/영어)

버그 수정:
- NotificationService tz.local 초기화 오류 해결
- MainScreenSummaryCard 레이아웃 오버플로우 수정
- 구독 추가 시 LateInitializationError 완전 해결

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 14:29:53 +09:00

372 lines
13 KiB
Dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/app_lock_provider.dart';
import '../theme/app_colors.dart';
import 'app_lock_screen.dart';
import 'main_screen.dart';
class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
@override
State<SplashScreen> createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen>
with SingleTickerProviderStateMixin {
late AnimationController _animationController;
late Animation<double> _fadeAnimation;
late Animation<double> _scaleAnimation;
late Animation<double> _slideAnimation;
late Animation<double> _rotateAnimation;
// 파티클 애니메이션을 위한 변수
final List<Map<String, dynamic>> _particles = [];
@override
void initState() {
super.initState();
// 애니메이션 컨트롤러 초기화
_animationController = AnimationController(
duration: const Duration(milliseconds: 2500),
vsync: this,
);
_fadeAnimation = CurvedAnimation(
parent: _animationController,
curve: const Interval(0.0, 0.7, curve: Curves.easeInOut),
);
_scaleAnimation = Tween<double>(
begin: 0.6,
end: 1.0,
).animate(CurvedAnimation(
parent: _animationController,
curve: Curves.elasticOut,
));
_slideAnimation = Tween<double>(
begin: 50.0,
end: 0.0,
).animate(CurvedAnimation(
parent: _animationController,
curve: const Interval(0.3, 0.8, curve: Curves.easeOutCubic),
));
_rotateAnimation = Tween<double>(
begin: 0.0,
end: 0.1,
).animate(CurvedAnimation(
parent: _animationController,
curve: const Interval(0.0, 0.5, curve: Curves.easeOutBack),
));
// 랜덤 파티클 생성
_generateParticles();
_animationController.forward();
// 애니메이션 완료 후 메인화면으로 이동
Timer(const Duration(seconds: 2), () {
navigateToNextScreen();
});
}
void _generateParticles() {
final random = DateTime.now().millisecondsSinceEpoch;
for (int i = 0; i < 20; i++) {
final size = (random % 10) / 10 * 8 + 2; // 2-10 사이의 크기
final x = (random % 100) / 100 * 300; // 랜덤 X 위치
final y = (random % 100) / 100 * 500; // 랜덤 Y 위치
final opacity = (random % 10) / 10 * 0.4 + 0.1; // 0.1-0.5 사이의 투명도
final duration = (random % 10) / 10 * 3000 + 2000; // 2-5초 사이의 지속시간
final delay = (random % 10) / 10 * 2000; // 0-2초 사이의 지연시간
int colorIndex = (random + i) % AppColors.blueGradient.length;
_particles.add({
'size': size,
'x': x,
'y': y,
'opacity': opacity,
'duration': duration,
'delay': delay,
'color': AppColors.blueGradient[colorIndex],
});
}
}
void navigateToNextScreen() {
// 앱 잠금 기능 비활성화: 항상 MainScreen으로 이동
Navigator.of(context).pushReplacement(
PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) =>
const MainScreen(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return FadeTransition(
opacity: animation,
child: child,
);
},
transitionDuration: const Duration(milliseconds: 500),
),
);
}
@override
void dispose() {
_animationController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: AppColors.blueGradient,
),
),
child: Stack(
children: [
// 배경 파티클
..._particles.map((particle) {
return AnimatedPositioned(
duration: Duration(milliseconds: particle['duration'].toInt()),
curve: Curves.easeInOut,
left: particle['x'] - 50 + (size.width * 0.1),
top: particle['y'] - 50 + (size.height * 0.1),
child: TweenAnimationBuilder<double>(
tween: Tween<double>(begin: 0.0, end: particle['opacity']),
duration:
Duration(milliseconds: particle['duration'].toInt()),
builder: (context, value, child) {
return Opacity(
opacity: value,
child: child,
);
},
child: Container(
width: particle['size'],
height: particle['size'],
decoration: BoxDecoration(
color: particle['color'],
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: particle['color'].withOpacity(0.3),
blurRadius: 10,
spreadRadius: 1,
),
],
),
),
),
);
}).toList(),
// 상단 원형 그라데이션
Positioned(
top: -size.height * 0.2,
right: -size.width * 0.2,
child: Container(
width: size.width * 0.8,
height: size.width * 0.8,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
Colors.white.withOpacity(0.1),
Colors.white.withOpacity(0.0),
],
stops: const [0.2, 1.0],
),
),
),
),
// 하단 원형 그라데이션
Positioned(
bottom: -size.height * 0.1,
left: -size.width * 0.3,
child: Container(
width: size.width * 0.9,
height: size.width * 0.9,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
Colors.white.withOpacity(0.07),
Colors.white.withOpacity(0.0),
],
stops: const [0.4, 1.0],
),
),
),
),
// 메인 콘텐츠
Column(
children: [
Expanded(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// 로고 애니메이션
AnimatedBuilder(
animation: _animationController,
builder: (context, child) {
return Transform.scale(
scale: _scaleAnimation.value,
child: Transform.rotate(
angle: _rotateAnimation.value,
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
width: 120,
height: 120,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(30),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
spreadRadius: 0,
blurRadius: 20,
offset: const Offset(0, 10),
),
],
),
child: Center(
child: AnimatedBuilder(
animation: _animationController,
builder: (context, _) {
return ShaderMask(
blendMode: BlendMode.srcIn,
shaderCallback: (bounds) =>
LinearGradient(
colors: AppColors.blueGradient,
begin: Alignment.topLeft,
end: Alignment.bottomRight,
).createShader(bounds),
child: Icon(
Icons.subscriptions_outlined,
size: 64,
color: Theme.of(context)
.primaryColor,
),
);
}),
),
),
),
);
},
),
const SizedBox(height: 40),
// 앱 이름 텍스트
AnimatedBuilder(
animation: _animationController,
builder: (context, child) {
return Opacity(
opacity: _fadeAnimation.value,
child: Transform.translate(
offset: Offset(0, _slideAnimation.value),
child: child,
),
);
},
child: const Text(
'SubManager',
style: TextStyle(
fontSize: 36,
fontWeight: FontWeight.bold,
color: Colors.white,
letterSpacing: 1.2,
),
),
),
const SizedBox(height: 16),
// 부제목 텍스트
AnimatedBuilder(
animation: _animationController,
builder: (context, child) {
return Opacity(
opacity: _fadeAnimation.value,
child: Transform.translate(
offset: Offset(0, _slideAnimation.value * 1.2),
child: child,
),
);
},
child: const Text(
'구독 서비스 관리를 더 쉽게',
style: TextStyle(
fontSize: 16,
color: Colors.white70,
letterSpacing: 0.5,
),
),
),
const SizedBox(height: 60),
// 로딩 인디케이터
FadeTransition(
opacity: _fadeAnimation,
child: Container(
width: 60,
height: 60,
padding: const EdgeInsets.all(6),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.15),
borderRadius: BorderRadius.circular(50),
),
child: const CircularProgressIndicator(
valueColor:
AlwaysStoppedAnimation<Color>(Colors.white),
strokeWidth: 3,
),
),
),
],
),
),
),
// 카피라이트 텍스트
Padding(
padding: const EdgeInsets.only(bottom: 24.0),
child: FadeTransition(
opacity: _fadeAnimation,
child: const Text(
'© 2023 CClabs. All rights reserved.',
style: TextStyle(
fontSize: 12,
color: Colors.white60,
letterSpacing: 0.5,
),
),
),
),
],
),
],
),
),
);
}
}