34 lines
918 B
Dart
34 lines
918 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class ErrorView extends StatelessWidget {
|
|
const ErrorView({required this.message, this.onRetry, super.key});
|
|
|
|
final String message;
|
|
final VoidCallback? onRetry;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const Icon(Icons.error_outline_rounded, size: 42),
|
|
const SizedBox(height: 12),
|
|
Text(message, textAlign: TextAlign.center),
|
|
if (onRetry != null) ...[
|
|
const SizedBox(height: 16),
|
|
FilledButton.icon(
|
|
onPressed: onRetry,
|
|
icon: const Icon(Icons.refresh_rounded),
|
|
label: const Text('Retry'),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|