多语言支持
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/encouragement_service.dart';
|
||||
@@ -37,6 +38,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.background,
|
||||
body: SafeArea(
|
||||
@@ -47,7 +50,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
children: [
|
||||
// App Title
|
||||
Text(
|
||||
'FocusBuddy',
|
||||
l10n.appTitle,
|
||||
style: AppTextStyles.appTitle,
|
||||
),
|
||||
|
||||
@@ -64,7 +67,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Text(
|
||||
'$_defaultDuration minutes',
|
||||
l10n.minutesValue(_defaultDuration, l10n.minutes(_defaultDuration)),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 28,
|
||||
@@ -98,7 +101,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text('Start Focusing'),
|
||||
Text(l10n.startFocusing),
|
||||
const SizedBox(width: 8),
|
||||
Icon(
|
||||
Icons.play_arrow,
|
||||
@@ -113,7 +116,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
|
||||
// Helper Text
|
||||
Text(
|
||||
"Tap 'I got distracted'\nanytime — no guilt.",
|
||||
l10n.tapDistractionAnytime,
|
||||
style: AppTextStyles.helperText,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -134,7 +137,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.bar_chart),
|
||||
label: const Text('History'),
|
||||
label: Text(l10n.history),
|
||||
),
|
||||
TextButton.icon(
|
||||
onPressed: () async {
|
||||
@@ -148,7 +151,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
_loadDefaultDuration();
|
||||
},
|
||||
icon: const Icon(Icons.settings),
|
||||
label: const Text('Settings'),
|
||||
label: Text(l10n.settings),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user