import 'package:flutter/material.dart'; import 'package:marco/helpers/utils/mixins/ui_mixin.dart'; import 'package:marco/images.dart'; class OfflineScreen extends StatefulWidget { const OfflineScreen({super.key}); @override State createState() => _OfflineScreenState(); } class _OfflineScreenState extends State with SingleTickerProviderStateMixin, UIMixin { late AnimationController _controller; late Animation _logoAnimation; @override void initState() { super.initState(); _controller = AnimationController( vsync: this, duration: const Duration(milliseconds: 800), ); _logoAnimation = CurvedAnimation( parent: _controller, curve: Curves.easeOutBack, ); _controller.forward(); } @override void dispose() { _controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( body: Stack( children: [ _RedWaveBackground(brandRed: contentTheme.brandRed), SafeArea( child: Center( child: Padding( padding: const EdgeInsets.symmetric( horizontal: 12.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ ScaleTransition( scale: _logoAnimation, child: Container( width: 100, height: 100, decoration: BoxDecoration( color: Colors.white, shape: BoxShape.circle, boxShadow: const [ BoxShadow( color: Colors.black12, blurRadius: 10, offset: Offset(0, 10), ), ], ), padding: const EdgeInsets.all(20), child: Image.asset(Images.logoDark), ), ), // Increased spacing here const SizedBox(height: 120), const Icon(Icons.wifi_off, size: 100, color: Colors.redAccent), const SizedBox(height: 20), const Text( "No Internet Connection", style: TextStyle( fontSize: 26, fontWeight: FontWeight.bold, color: Colors.black87, ), textAlign: TextAlign.center, ), const SizedBox(height: 15), const Text( "It seems you're currently offline. Please check your network settings or Wi-Fi connection.", textAlign: TextAlign.center, style: TextStyle(fontSize: 16, color: Colors.grey), ), ], ), ), ), ), ], ), ); } } class _RedWaveBackground extends StatelessWidget { final Color brandRed; const _RedWaveBackground({required this.brandRed}); @override Widget build(BuildContext context) { return CustomPaint( painter: _WavePainter(brandRed), size: Size.infinite, ); } } class _WavePainter extends CustomPainter { final Color brandRed; _WavePainter(this.brandRed); @override void paint(Canvas canvas, Size size) { final paint1 = Paint() ..shader = LinearGradient( colors: [brandRed, const Color.fromARGB(255, 97, 22, 22)], begin: Alignment.topLeft, end: Alignment.bottomRight, ).createShader(Rect.fromLTWH(0, 0, size.width, size.height)); final path1 = Path() ..moveTo(0, size.height * 0.2) ..quadraticBezierTo(size.width * 0.25, size.height * 0.05, size.width * 0.5, size.height * 0.15) ..quadraticBezierTo( size.width * 0.75, size.height * 0.25, size.width, size.height * 0.1) ..lineTo(size.width, 0) ..lineTo(0, 0) ..close(); canvas.drawPath(path1, paint1); final paint2 = Paint()..color = Colors.redAccent.withOpacity(0.15); final path2 = Path() ..moveTo(0, size.height * 0.25) ..quadraticBezierTo( size.width * 0.4, size.height * 0.1, size.width, size.height * 0.2) ..lineTo(size.width, 0) ..lineTo(0, 0) ..close(); canvas.drawPath(path2, paint2); } @override bool shouldRepaint(CustomPainter oldDelegate) => false; }