多语言支持
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
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';
|
||||
@@ -21,6 +22,7 @@ class CompleteScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final storageService = StorageService();
|
||||
final todayTotal = storageService.getTodayTotalMinutes();
|
||||
final todayDistractions = storageService.getTodayDistractionCount();
|
||||
@@ -44,12 +46,12 @@ class CompleteScreen extends StatelessWidget {
|
||||
|
||||
// You focused for X minutes
|
||||
Text(
|
||||
'You focused for',
|
||||
l10n.youFocusedFor,
|
||||
style: AppTextStyles.headline,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'$focusedMinutes ${focusedMinutes == 1 ? 'minute' : 'minutes'}',
|
||||
l10n.minutesValue(focusedMinutes, l10n.minutes(focusedMinutes)),
|
||||
style: AppTextStyles.largeNumber,
|
||||
),
|
||||
|
||||
@@ -67,12 +69,12 @@ class CompleteScreen extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Total Today: $todayTotal mins',
|
||||
l10n.totalToday(todayTotal),
|
||||
style: AppTextStyles.bodyText,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'Distractions: $todayDistractions ${todayDistractions == 1 ? 'time' : 'times'}',
|
||||
l10n.distractionsCount(todayDistractions, l10n.times(todayDistractions)),
|
||||
style: AppTextStyles.bodyText,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
@@ -101,7 +103,7 @@ class CompleteScreen extends StatelessWidget {
|
||||
(route) => false,
|
||||
);
|
||||
},
|
||||
child: const Text('Start Another'),
|
||||
child: Text(l10n.startAnother),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -118,7 +120,7 @@ class CompleteScreen extends StatelessWidget {
|
||||
(route) => route.isFirst, // Keep only the home screen in stack
|
||||
);
|
||||
},
|
||||
child: const Text('View History'),
|
||||
child: Text(l10n.viewHistory),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user