34 lines
921 B
Dart
34 lines
921 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class ErrorDisplay extends StatelessWidget {
|
|
final String message;
|
|
final VoidCallback? onRetry;
|
|
|
|
const ErrorDisplay({super.key, required this.message, this.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, size: 48, color: Colors.red),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
message,
|
|
style: const TextStyle(fontSize: 16),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
if (onRetry != null) ...[
|
|
const SizedBox(height: 16),
|
|
ElevatedButton(onPressed: onRetry, child: const Text('Retry')),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|