import 'package:flutter/material.dart'; import '../l10n/app_localizations.dart'; import '../theme/app_colors.dart'; import '../theme/app_text_styles.dart'; import '../services/storage_service.dart'; import '../services/encouragement_service.dart'; import 'home_screen.dart'; import 'history_screen.dart'; /// Complete Screen - Shows after focus session ends class CompleteScreen extends StatelessWidget { final int focusedMinutes; final int distractionCount; final EncouragementService encouragementService; const CompleteScreen({ super.key, required this.focusedMinutes, required this.distractionCount, required this.encouragementService, }); @override Widget build(BuildContext context) { final l10n = AppLocalizations.of(context)!; final storageService = StorageService(); final todayTotal = storageService.getTodayTotalMinutes(); final todayDistractions = storageService.getTodayDistractionCount(); final encouragement = encouragementService.getRandomMessage(); return Scaffold( backgroundColor: AppColors.background, body: SafeArea( child: Padding( padding: const EdgeInsets.all(24.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ // Success Icon const Text( '✨', style: TextStyle(fontSize: 64), ), const SizedBox(height: 32), // You focused for X minutes Text( l10n.youFocusedFor, style: AppTextStyles.headline, ), const SizedBox(height: 8), Text( l10n.minutesValue(focusedMinutes, l10n.minutes(focusedMinutes)), style: AppTextStyles.largeNumber, ), const SizedBox(height: 40), // Stats Card Container( width: double.infinity, padding: const EdgeInsets.all(24), decoration: BoxDecoration( color: AppColors.white, borderRadius: BorderRadius.circular(16), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( l10n.totalToday(todayTotal), style: AppTextStyles.bodyText, ), const SizedBox(height: 12), Text( l10n.distractionsCount(todayDistractions, l10n.times(todayDistractions)), style: AppTextStyles.bodyText, ), const SizedBox(height: 20), Text( '"$encouragement"', style: AppTextStyles.encouragementQuote, ), ], ), ), const SizedBox(height: 40), // Start Another Button SizedBox( width: double.infinity, child: ElevatedButton( onPressed: () { Navigator.pushAndRemoveUntil( context, MaterialPageRoute( builder: (context) => HomeScreen( encouragementService: encouragementService, ), ), (route) => false, ); }, child: Text(l10n.startAnother), ), ), const SizedBox(height: 16), // View Full Report - Navigate to History TextButton( onPressed: () { Navigator.pushAndRemoveUntil( context, MaterialPageRoute( builder: (context) => const HistoryScreen(), ), (route) => route.isFirst, // Keep only the home screen in stack ); }, child: Text(l10n.viewHistory), ), ], ), ), ), ); } }