import 'package:flutter/material.dart'; class LoadErrorView extends StatelessWidget { final String title; final String? message; final VoidCallback onRetry; final IconData icon; const LoadErrorView({ super.key, required this.title, required this.onRetry, this.message, this.icon = Icons.wifi_off_rounded, }); @override Widget build(BuildContext context) { return Center( child: Padding( padding: const EdgeInsets.all(24), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(icon, size: 64, color: Colors.deepOrange), const SizedBox(height: 16), Text( title, textAlign: TextAlign.center, style: const TextStyle(color: Colors.white70, fontSize: 16), ), if (message != null) ...[ const SizedBox(height: 8), Text( message!, textAlign: TextAlign.center, style: const TextStyle(color: Colors.white38, fontSize: 12), ), ], const SizedBox(height: 16), FilledButton.icon( onPressed: onRetry, icon: const Icon(Icons.refresh), label: const Text('Повторить'), ), ], ), ), ); } } class LoadErrorBanner extends StatelessWidget { final String title; final String? message; final VoidCallback onRetry; const LoadErrorBanner({ super.key, required this.title, required this.onRetry, this.message, }); @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.fromLTRB(12, 4, 12, 12), padding: const EdgeInsets.all(12), decoration: BoxDecoration( color: Colors.deepOrange.withValues(alpha: 0.14), borderRadius: BorderRadius.circular(8), border: Border.all(color: Colors.deepOrange.withValues(alpha: 0.35)), ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Icon( Icons.warning_amber_rounded, color: Colors.deepOrange, size: 20, ), const SizedBox(width: 10), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, style: const TextStyle( color: Colors.white70, fontWeight: FontWeight.w600, ), ), if (message != null) ...[ const SizedBox(height: 4), Text( message!, style: const TextStyle(color: Colors.white38, fontSize: 12), ), ], ], ), ), IconButton( tooltip: 'Повторить', onPressed: onRetry, icon: const Icon(Icons.refresh), ), ], ), ); } }