import 'package:flutter/material.dart'; import 'package:terepi_seged/services/version_gate_service.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:app_settings/app_settings.dart'; /// Blokkoló "frissítés szükséges" képernyő — ez az EGYETLEN dolog, amit /// az app mutat, ha a build a minimum alatt van. A rendes appot (GetX /// service-ek, routing, shell) ilyenkor a main.dart el sem indítja. class UpdateRequiredView extends StatelessWidget { final VersionGateResult result; const UpdateRequiredView({super.key, required this.result}); @override Widget build(BuildContext context) { return Scaffold( body: SafeArea( child: Center( child: Padding( padding: const EdgeInsets.all(28), child: Column( mainAxisSize: MainAxisSize.min, children: [ const Icon(Icons.system_update_alt, size: 72, color: Colors.orange), const SizedBox(height: 20), Text( 'Frissítés szükséges', style: Theme.of(context).textTheme.headlineSmall, textAlign: TextAlign.center, ), const SizedBox(height: 12), Text( result.message, textAlign: TextAlign.center, style: const TextStyle(fontSize: 15), ), const SizedBox(height: 28), if (result.updateUrl.isNotEmpty) FilledButton.icon( icon: const Icon(Icons.download), label: const Text('Frissítés'), onPressed: () => launchUrl( Uri.parse(result.updateUrl), mode: LaunchMode.externalApplication, ), ), const SizedBox(height: 12), TextButton.icon( icon: const Icon(Icons.settings_outlined, size: 18), label: const Text('Alkalmazás beállításainak megnyitása'), onPressed: () => AppSettings.openAppSettings( type: AppSettingsType.settings), ), const SizedBox(height: 4), Text( '(ha belső tesztelőként a Play Áruház link még nem elérhető)', textAlign: TextAlign.center, style: TextStyle(fontSize: 11, color: Colors.grey.shade600), ), ], ), ), ), ), ); } }