feat: add localisation
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../l10n/app_localizations.dart';
|
||||
|
||||
class ErrorScreenView extends StatelessWidget {
|
||||
const ErrorScreenView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -14,7 +17,7 @@ class ErrorScreenView extends StatelessWidget {
|
||||
onPressed: () => context.pop(),
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
),
|
||||
title: const Text('Error Screen'),
|
||||
title: Text(l10n.errorScreen),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: Center(
|
||||
@@ -37,24 +40,24 @@ class ErrorScreenView extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
'Something went wrong',
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||
color: scheme.error,
|
||||
),
|
||||
l10n.somethingWentWrong,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.headlineMedium?.copyWith(color: scheme.error),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'An unexpected error occurred.\nPlease try restarting the app.',
|
||||
l10n.unexpectedError,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: scheme.onSurface.withValues(alpha: 0.6),
|
||||
),
|
||||
color: scheme.onSurface.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
FilledButton.icon(
|
||||
onPressed: () => context.go('/bar'),
|
||||
icon: const Icon(Icons.home_rounded),
|
||||
label: const Text('Go to bar screen'),
|
||||
label: Text(l10n.goToBarScreen),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -62,4 +65,4 @@ class ErrorScreenView extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user