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[300]), const SizedBox(height: 16), Text( message, textAlign: TextAlign.center, style: TextStyle(fontSize: 16, color: Colors.grey[700]), ), const SizedBox(height: 16), ElevatedButton.icon( onPressed: onRetry, icon: const Icon(Icons.refresh), label: const Text('重试'), ), ], ), ), ); } }