git-subtree-dir: app git-subtree-mainline:6ebd902c6bgit-subtree-split:a11a668869
34 lines
987 B
Dart
34 lines
987 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// 错误态 + 重试
|
|
class ErrorView extends StatelessWidget {
|
|
final String message;
|
|
final VoidCallback? onRetry;
|
|
|
|
const ErrorView({super.key, required this.message, this.onRetry});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Center(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(Icons.error_outline, size: 48, color: Colors.grey.shade400),
|
|
const SizedBox(height: 12),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 32),
|
|
child: Text(message,
|
|
textAlign: TextAlign.center,
|
|
style: const TextStyle(color: Colors.grey)),
|
|
),
|
|
if (onRetry != null) ...[
|
|
const SizedBox(height: 16),
|
|
OutlinedButton.icon(
|
|
onPressed: onRetry, icon: const Icon(Icons.refresh), label: const Text('重试')),
|
|
],
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|