forked from baron/baron-sso
118 lines
4.3 KiB
Dart
118 lines
4.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
class ErrorScreen extends StatelessWidget {
|
|
final String? errorId;
|
|
final String? errorCode;
|
|
final String? description;
|
|
|
|
const ErrorScreen({
|
|
super.key,
|
|
this.errorId,
|
|
this.errorCode,
|
|
this.description,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final errorType = (errorCode == null || errorCode!.isEmpty)
|
|
? 'unknown_error'
|
|
: errorCode!;
|
|
final title = errorCode == null || errorCode!.isEmpty
|
|
? '인증 과정에서 오류가 발생했습니다'
|
|
: '오류: $errorCode';
|
|
final detail = description?.isNotEmpty == true
|
|
? description!
|
|
: '요청을 처리하는 중 문제가 발생했습니다. 잠시 후 다시 시도해 주세요.';
|
|
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xFFF7F8FA),
|
|
body: Center(
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(maxWidth: 560),
|
|
child: Card(
|
|
margin: const EdgeInsets.symmetric(horizontal: 24),
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
side: const BorderSide(color: Color(0xFFE5E7EB)),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.fromLTRB(28, 28, 28, 24),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
title,
|
|
style: theme.textTheme.titleLarge?.copyWith(
|
|
fontWeight: FontWeight.w700,
|
|
color: const Color(0xFF111827),
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
detail,
|
|
style: theme.textTheme.bodyMedium?.copyWith(
|
|
color: const Color(0xFF4B5563),
|
|
height: 1.5,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
'오류 종류: $errorType',
|
|
style: theme.textTheme.bodySmall?.copyWith(
|
|
color: const Color(0xFF6B7280),
|
|
),
|
|
),
|
|
if (errorId != null && errorId!.isNotEmpty) ...[
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
'오류 ID: $errorId',
|
|
style: theme.textTheme.bodySmall?.copyWith(
|
|
color: const Color(0xFF6B7280),
|
|
),
|
|
),
|
|
],
|
|
const SizedBox(height: 20),
|
|
Wrap(
|
|
spacing: 12,
|
|
runSpacing: 12,
|
|
children: [
|
|
ElevatedButton(
|
|
onPressed: () => context.go('/login'),
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: const Color(0xFF111827),
|
|
foregroundColor: Colors.white,
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
),
|
|
child: const Text('로그인으로 이동'),
|
|
),
|
|
OutlinedButton(
|
|
onPressed: () => context.go('/'),
|
|
style: OutlinedButton.styleFrom(
|
|
foregroundColor: const Color(0xFF111827),
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
|
side: const BorderSide(color: Color(0xFFCBD5F5)),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
),
|
|
child: const Text('홈으로 이동'),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|