| 123456789101112131415161718192021222324252627282930313233343536 |
- import 'package:flutter/material.dart';
-
- /// 错误重试组件
- class ErrorRetry extends StatelessWidget {
- final String message;
- final VoidCallback onRetry;
-
- const ErrorRetry({
- super.key,
- required this.message,
- required this.onRetry,
- });
-
- @override
- Widget build(BuildContext context) {
- return Center(
- child: Padding(
- padding: const EdgeInsets.all(32),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(Icons.error_outline, size: 64, color: Colors.red.shade300),
- const SizedBox(height: 16),
- Text(message, style: TextStyle(fontSize: 15, color: Colors.grey.shade700)),
- const SizedBox(height: 16),
- FilledButton.icon(
- onPressed: onRetry,
- icon: const Icon(Icons.refresh),
- label: const Text('重试'),
- ),
- ],
- ),
- ),
- );
- }
- }
|