import 'package:flutter/material.dart'; import 'package:upgrader/upgrader.dart'; import '../utils/translations.dart'; class CustomUpgradeAlert extends StatefulWidget { final Widget child; final String language; const CustomUpgradeAlert({ super.key, required this.child, required this.language, }); @override State createState() => _CustomUpgradeAlertState(); } class _CustomUpgradeAlertState extends State { @override Widget build(BuildContext context) { return UpgradeAlert( child: widget.child, upgrader: Upgrader( debugDisplayAlways: true, ), dialogStyle: UpgradeDialogStyle.material, shouldPopScope: () => true, ); } } class CustomUpdateDialog extends StatelessWidget { final String title; final String message; final String updateButtonText; final String laterButtonText; final VoidCallback onUpdate; final VoidCallback onLater; const CustomUpdateDialog({ super.key, required this.title, required this.message, required this.updateButtonText, required this.laterButtonText, required this.onUpdate, required this.onLater, }); @override Widget build(BuildContext context) { return Dialog( backgroundColor: Colors.grey[900], shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), child: Padding( padding: const EdgeInsets.all(24), child: Column( mainAxisSize: MainAxisSize.min, children: [ // App Icon Container( width: 80, height: 80, decoration: BoxDecoration( color: Colors.blue, borderRadius: BorderRadius.circular(16), ), child: const Icon( Icons.update, color: Colors.white, size: 40, ), ), const SizedBox(height: 24), // Title Text( title, style: const TextStyle( fontSize: 20, fontWeight: FontWeight.bold, color: Colors.white, ), textAlign: TextAlign.center, ), const SizedBox(height: 16), // Message Text( message, style: TextStyle( fontSize: 16, color: Colors.grey[300], height: 1.5, ), textAlign: TextAlign.center, ), const SizedBox(height: 32), // Buttons Row( children: [ // Later Button Expanded( child: GestureDetector( onTap: onLater, child: Container( padding: const EdgeInsets.symmetric(vertical: 12), decoration: BoxDecoration( color: Colors.grey[800], borderRadius: BorderRadius.circular(8), ), child: Center( child: Text( laterButtonText, style: const TextStyle( fontSize: 14, fontWeight: FontWeight.w600, color: Colors.grey, ), ), ), ), ), ), const SizedBox(width: 12), // Update Button Expanded( child: GestureDetector( onTap: onUpdate, child: Container( padding: const EdgeInsets.symmetric(vertical: 12), decoration: BoxDecoration( color: Colors.blue, borderRadius: BorderRadius.circular(8), ), child: Center( child: Text( updateButtonText, style: const TextStyle( fontSize: 14, fontWeight: FontWeight.w600, color: Colors.white, ), ), ), ), ), ), ], ), ], ), ), ); } }