Files
kooltab/lib/views/error_screen_view.dart
T

70 lines
2.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../l10n/app_localizations.dart';
import '../utils/navigation.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(
leading: IconButton(
onPressed: () => context.popOrGo('/bar'),
icon: const Icon(Icons.arrow_back),
),
title: Text(l10n.errorScreen),
centerTitle: true,
),
body: Center(
child: Padding(
padding: const EdgeInsets.all(32),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: scheme.error.withValues(alpha: 0.12),
),
child: Icon(
Icons.error_outline_rounded,
size: 64,
color: scheme.error,
),
),
const SizedBox(height: 24),
Text(
l10n.somethingWentWrong,
style: Theme.of(
context,
).textTheme.headlineMedium?.copyWith(color: scheme.error),
),
const SizedBox(height: 12),
Text(
l10n.unexpectedError,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
color: scheme.onSurface.withValues(alpha: 0.6),
),
),
const SizedBox(height: 32),
FilledButton.icon(
onPressed: () => context.go('/bar'),
icon: const Icon(Icons.home_rounded),
label: Text(l10n.goToBarScreen),
),
],
),
),
),
);
}
}