2026-04-26 10:15:34 +02:00
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/foundation.dart';
|
2026-04-04 14:43:29 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2026-04-04 19:25:55 +02:00
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2026-04-12 19:21:54 +02:00
|
|
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
2026-05-19 18:53:24 +02:00
|
|
|
import 'package:flux/core/utils/version_check_service.dart';
|
2026-05-04 15:36:42 +02:00
|
|
|
import 'package:flux/features/attachments/data/attachments_repository.dart';
|
2026-04-22 11:06:02 +02:00
|
|
|
import 'package:flux/features/auth/bloc/auth_cubit.dart';
|
2026-05-08 18:51:28 +02:00
|
|
|
import 'package:flux/features/company/data/company_repository.dart';
|
2026-05-21 14:43:47 +02:00
|
|
|
import 'package:flux/features/notes/blocs/notes_bloc.dart';
|
|
|
|
|
import 'package:flux/features/notes/data/notes_repository.dart';
|
2026-05-18 12:00:07 +02:00
|
|
|
import 'package:flux/features/tickets/data/tickets_shipping_repository.dart';
|
2026-05-15 10:12:05 +02:00
|
|
|
import 'package:flux/features/master_data/providers/blocs/provider_list_cubit.dart';
|
2026-05-08 12:28:14 +02:00
|
|
|
import 'package:flux/features/operations/blocs/operation_list_cubit.dart';
|
2026-05-04 15:36:42 +02:00
|
|
|
import 'package:flux/features/operations/data/operations_repository.dart';
|
2026-05-13 12:41:07 +02:00
|
|
|
import 'package:flux/features/settings/blocs/settings_cubit.dart';
|
2026-05-10 14:09:57 +02:00
|
|
|
import 'package:flux/features/settings/document_sequence/data/document_sequence_repository.dart';
|
2026-05-14 12:07:05 +02:00
|
|
|
import 'package:flux/features/tickets/blocs/ticket_list_cubit.dart';
|
2026-05-07 16:28:01 +02:00
|
|
|
import 'package:flux/features/tickets/data/ticket_repository.dart';
|
2026-05-14 15:59:46 +02:00
|
|
|
import 'package:flux/features/tracking/blocs/tracking_cubit.dart';
|
2026-05-13 12:41:07 +02:00
|
|
|
import 'package:flux/features/tracking/data/tracking_repository.dart';
|
2026-05-04 15:36:42 +02:00
|
|
|
import 'package:flux/l10n/app_localizations.dart';
|
2026-04-22 11:06:02 +02:00
|
|
|
import 'package:get_it/get_it.dart';
|
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
import 'package:supabase_flutter/supabase_flutter.dart';
|
|
|
|
|
import 'package:flux/core/blocs/session/session_cubit.dart';
|
|
|
|
|
import 'package:flux/core/data/core_repository.dart';
|
2026-04-09 18:17:48 +02:00
|
|
|
import 'package:flux/core/routes/app_router.dart';
|
2026-04-07 11:30:22 +02:00
|
|
|
import 'package:flux/core/theme/theme.dart';
|
|
|
|
|
import 'package:flux/core/theme/bloc/theme_bloc.dart';
|
2026-05-19 10:32:01 +02:00
|
|
|
import 'package:flux/features/customers/blocs/customers_list_cubit.dart';
|
2026-04-10 10:47:56 +02:00
|
|
|
import 'package:flux/features/customers/data/customer_repository.dart';
|
2026-04-14 11:29:49 +02:00
|
|
|
import 'package:flux/features/master_data/products/blocs/product_cubit.dart';
|
|
|
|
|
import 'package:flux/features/master_data/products/data/product_repository.dart';
|
2026-04-17 10:34:23 +02:00
|
|
|
import 'package:flux/features/master_data/providers/data/provider_repository.dart';
|
2026-04-14 11:29:49 +02:00
|
|
|
import 'package:flux/features/master_data/staff/blocs/staff_cubit.dart';
|
|
|
|
|
import 'package:flux/features/master_data/staff/data/staff_repository.dart';
|
2026-04-15 10:05:07 +02:00
|
|
|
import 'package:flux/features/master_data/store/bloc/store_cubit.dart';
|
2026-04-14 11:29:49 +02:00
|
|
|
import 'package:flux/features/master_data/store/data/store_repository.dart';
|
2026-04-09 11:30:57 +02:00
|
|
|
import 'package:flux/features/settings/settings.dart';
|
2026-05-07 18:37:25 +02:00
|
|
|
import 'package:flutter_web_plugins/url_strategy.dart';
|
2026-05-19 18:53:24 +02:00
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
2026-04-04 14:43:29 +02:00
|
|
|
|
2026-04-04 19:25:55 +02:00
|
|
|
void main() async {
|
|
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
2026-04-12 19:21:54 +02:00
|
|
|
await dotenv.load(fileName: ".env");
|
2026-04-22 11:06:02 +02:00
|
|
|
|
|
|
|
|
// Inizializza le dipendenze PRIMA di lanciare l'app
|
2026-04-09 11:30:57 +02:00
|
|
|
await setupLocator();
|
2026-05-07 18:37:25 +02:00
|
|
|
// RIMUOVE IL CARATTERE # DAGLI URL WEB!
|
|
|
|
|
usePathUrlStrategy();
|
2026-04-05 10:06:26 +02:00
|
|
|
runApp(
|
2026-04-06 10:55:56 +02:00
|
|
|
MultiBlocProvider(
|
|
|
|
|
providers: [
|
2026-04-22 11:06:02 +02:00
|
|
|
BlocProvider<AuthCubit>(create: (context) => AuthCubit()),
|
2026-04-07 11:55:01 +02:00
|
|
|
BlocProvider<ThemeBloc>(
|
|
|
|
|
create: (context) => ThemeBloc()..add(LoadThemeEvent()),
|
|
|
|
|
),
|
2026-04-22 11:06:02 +02:00
|
|
|
// Il Vigile Urbano viene inizializzato!
|
|
|
|
|
BlocProvider<SessionCubit>(create: (_) => GetIt.I<SessionCubit>()),
|
|
|
|
|
|
|
|
|
|
// Cubit delle feature
|
|
|
|
|
BlocProvider<StoreCubit>(create: (_) => StoreCubit()),
|
2026-05-19 10:32:01 +02:00
|
|
|
BlocProvider<CustomersListCubit>(create: (_) => CustomersListCubit()),
|
2026-05-04 15:36:42 +02:00
|
|
|
BlocProvider<ProductsCubit>(create: (_) => ProductsCubit()),
|
2026-05-13 12:41:07 +02:00
|
|
|
BlocProvider<StaffCubit>(
|
|
|
|
|
create: (_) => StaffCubit()
|
|
|
|
|
..loadStaffForStore(
|
|
|
|
|
GetIt.I.get<SessionCubit>().state.currentStore!.id!,
|
|
|
|
|
),
|
|
|
|
|
),
|
2026-05-08 12:28:14 +02:00
|
|
|
BlocProvider<OperationListCubit>(create: (_) => OperationListCubit()),
|
2026-05-15 10:12:05 +02:00
|
|
|
BlocProvider<ProviderListCubit>(create: (_) => ProviderListCubit()),
|
2026-05-13 12:41:07 +02:00
|
|
|
BlocProvider<SettingsCubit>(create: (_) => SettingsCubit()),
|
2026-05-14 12:07:05 +02:00
|
|
|
BlocProvider<TicketListCubit>(create: (_) => TicketListCubit()),
|
|
|
|
|
BlocProvider<OperationListCubit>(create: (_) => OperationListCubit()),
|
2026-05-14 15:59:46 +02:00
|
|
|
BlocProvider<TrackingCubit>(create: (_) => TrackingCubit()),
|
2026-05-21 14:43:47 +02:00
|
|
|
BlocProvider<NotesBloc>(create: (_) => NotesBloc()),
|
2026-04-06 10:55:56 +02:00
|
|
|
],
|
2026-04-05 10:06:26 +02:00
|
|
|
child: const FluxApp(),
|
|
|
|
|
),
|
|
|
|
|
);
|
2026-04-04 14:43:29 +02:00
|
|
|
}
|
|
|
|
|
|
2026-04-09 11:30:57 +02:00
|
|
|
Future<void> setupLocator() async {
|
|
|
|
|
final GetIt getIt = GetIt.instance;
|
2026-04-22 11:06:02 +02:00
|
|
|
|
2026-04-09 11:30:57 +02:00
|
|
|
getIt.registerSingleton<SharedPreferences>(
|
|
|
|
|
await SharedPreferences.getInstance(),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await Supabase.initialize(
|
2026-04-12 19:21:54 +02:00
|
|
|
url: dotenv.env['SUPABASE_URL'] ?? '',
|
|
|
|
|
anonKey: dotenv.env['SUPABASE_ANON_KEY'] ?? '',
|
2026-04-09 11:30:57 +02:00
|
|
|
);
|
2026-04-22 11:06:02 +02:00
|
|
|
//await Supabase.instance.client.auth.signOut();
|
2026-04-09 11:30:57 +02:00
|
|
|
getIt.registerSingleton<SupabaseClient>(Supabase.instance.client);
|
2026-04-22 11:06:02 +02:00
|
|
|
|
|
|
|
|
// Settings
|
2026-04-09 11:30:57 +02:00
|
|
|
getIt.registerLazySingleton<AppSettings>(() => AppSettings());
|
2026-04-22 11:06:02 +02:00
|
|
|
|
|
|
|
|
// Repositories
|
|
|
|
|
getIt.registerLazySingleton<CoreRepository>(
|
|
|
|
|
() => CoreRepository(),
|
|
|
|
|
); // <-- NUOVO
|
2026-04-09 11:30:57 +02:00
|
|
|
getIt.registerLazySingleton<StoreRepository>(() => StoreRepository());
|
2026-04-10 10:47:56 +02:00
|
|
|
getIt.registerLazySingleton<CustomerRepository>(() => CustomerRepository());
|
2026-04-12 19:21:54 +02:00
|
|
|
getIt.registerLazySingleton<ProductRepository>(() => ProductRepository());
|
2026-04-13 15:18:37 +02:00
|
|
|
getIt.registerLazySingleton<StaffRepository>(() => StaffRepository());
|
2026-05-04 15:36:42 +02:00
|
|
|
getIt.registerLazySingleton<OperationsRepository>(
|
|
|
|
|
() => OperationsRepository(),
|
|
|
|
|
);
|
2026-04-17 10:34:23 +02:00
|
|
|
getIt.registerLazySingleton<ProviderRepository>(() => ProviderRepository());
|
2026-05-04 15:36:42 +02:00
|
|
|
getIt.registerLazySingleton<AttachmentsRepository>(
|
|
|
|
|
() => AttachmentsRepository(),
|
|
|
|
|
);
|
2026-05-07 16:28:01 +02:00
|
|
|
getIt.registerLazySingleton<TicketRepository>(() => TicketRepository());
|
2026-05-10 14:09:57 +02:00
|
|
|
getIt.registerLazySingleton<DocumentSequenceRepository>(
|
|
|
|
|
() => DocumentSequenceRepository(),
|
|
|
|
|
);
|
2026-04-22 11:06:02 +02:00
|
|
|
|
|
|
|
|
// NOTA: CompanyRepository l'ho tolto perché la logica della Company
|
|
|
|
|
// ora è gestita dal CoreRepository durante l'Onboarding.
|
|
|
|
|
// Se ti serve per altro, rimettilo pure!
|
|
|
|
|
|
|
|
|
|
// Inizializziamo il SessionCubit (che prende CoreRepository e SharedPreferences)
|
|
|
|
|
// Usiamo registerSingleton così viene creato subito e inizia ad ascoltare Supabase Auth.
|
|
|
|
|
getIt.registerSingleton<SessionCubit>(
|
|
|
|
|
SessionCubit(getIt<CoreRepository>(), getIt<SharedPreferences>()),
|
|
|
|
|
);
|
2026-05-08 18:51:28 +02:00
|
|
|
getIt.registerLazySingleton<CompanyRepository>(() => CompanyRepository());
|
2026-05-13 12:41:07 +02:00
|
|
|
getIt.registerLazySingleton<TrackingRepository>(() => TrackingRepository());
|
2026-05-18 12:00:07 +02:00
|
|
|
getIt.registerLazySingleton<TicketsShippingRepository>(
|
|
|
|
|
() => TicketsShippingRepository(),
|
2026-05-16 11:51:26 +02:00
|
|
|
);
|
2026-05-21 14:43:47 +02:00
|
|
|
getIt.registerLazySingleton<NotesRepository>(() => NotesRepository());
|
2026-04-09 11:30:57 +02:00
|
|
|
}
|
|
|
|
|
|
2026-04-12 19:21:54 +02:00
|
|
|
class FluxApp extends StatefulWidget {
|
2026-04-05 10:06:26 +02:00
|
|
|
const FluxApp({super.key});
|
2026-04-04 14:43:29 +02:00
|
|
|
|
|
|
|
|
@override
|
2026-04-12 19:21:54 +02:00
|
|
|
State<FluxApp> createState() => _FluxAppState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _FluxAppState extends State<FluxApp> {
|
|
|
|
|
late final GoRouter _router;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
2026-04-22 11:06:02 +02:00
|
|
|
// Creiamo il router passandogli il Cubit per i redirect
|
|
|
|
|
_router = AppRouter.createRouter(context.read<SessionCubit>());
|
2026-04-26 10:15:34 +02:00
|
|
|
GetIt.I.get<SessionCubit>().setIsMobileDevice(isMobileDevice(context));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isMobileDevice(BuildContext context) {
|
|
|
|
|
if (kIsWeb) {
|
|
|
|
|
return false; // Il web non lo consideriamo "mobile nativo" per i deep link
|
|
|
|
|
}
|
|
|
|
|
return Platform.isAndroid || Platform.isIOS;
|
2026-04-12 19:21:54 +02:00
|
|
|
}
|
2026-04-06 10:55:56 +02:00
|
|
|
|
2026-04-12 19:21:54 +02:00
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2026-04-26 10:15:34 +02:00
|
|
|
return BlocConsumer<SessionCubit, SessionState>(
|
|
|
|
|
listenWhen: (previous, current) =>
|
|
|
|
|
previous.status != SessionStatus.authenticated &&
|
|
|
|
|
current.status == SessionStatus.authenticated,
|
|
|
|
|
listener: (context, state) {
|
|
|
|
|
context.read<StoreCubit>().loadStores();
|
|
|
|
|
context.read<StaffCubit>().loadAllStaff();
|
|
|
|
|
},
|
2026-04-22 11:06:02 +02:00
|
|
|
builder: (context, sessionState) {
|
|
|
|
|
if (sessionState.status == SessionStatus.initial) {
|
2026-04-20 16:52:20 +02:00
|
|
|
return _buildLoadingScreen();
|
|
|
|
|
}
|
2026-04-22 11:06:02 +02:00
|
|
|
|
2026-04-20 16:52:20 +02:00
|
|
|
return BlocBuilder<ThemeBloc, ThemeState>(
|
2026-04-22 11:06:02 +02:00
|
|
|
builder: (context, themeState) {
|
2026-04-20 16:52:20 +02:00
|
|
|
return MaterialApp.router(
|
|
|
|
|
title: 'FLUX Gestionale',
|
|
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
|
theme: fluxLightTheme,
|
|
|
|
|
darkTheme: fluxDarkTheme,
|
2026-04-22 11:06:02 +02:00
|
|
|
themeMode: themeState.currentTheme.themeMode,
|
|
|
|
|
routerConfig: _router,
|
2026-05-04 15:36:42 +02:00
|
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
|
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
|
|
|
locale: const Locale('it'),
|
2026-05-19 18:53:24 +02:00
|
|
|
|
|
|
|
|
// 🥷 ECCO LA MAGIA: Avvolgiamo tutta l'app nel nostro checker!
|
|
|
|
|
builder: (context, child) {
|
|
|
|
|
return GlobalUpdateChecker(child: child!);
|
|
|
|
|
},
|
2026-04-20 16:52:20 +02:00
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildLoadingScreen() {
|
|
|
|
|
return MaterialApp(
|
|
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
|
home: Scaffold(
|
|
|
|
|
body: Center(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
const Icon(Icons.bolt, size: 64, color: Colors.blue),
|
|
|
|
|
const SizedBox(height: 24),
|
|
|
|
|
const CircularProgressIndicator(),
|
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
|
const Text(
|
|
|
|
|
"Inizializzazione sessione...",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2026-04-17 10:34:23 +02:00
|
|
|
),
|
2026-04-12 19:21:54 +02:00
|
|
|
),
|
2026-04-06 10:55:56 +02:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-05-19 18:53:24 +02:00
|
|
|
|
|
|
|
|
// --- IL WIDGET GUARDIANO DEGLI AGGIORNAMENTI ---
|
|
|
|
|
class GlobalUpdateChecker extends StatefulWidget {
|
|
|
|
|
final Widget child;
|
|
|
|
|
const GlobalUpdateChecker({super.key, required this.child});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<GlobalUpdateChecker> createState() => _GlobalUpdateCheckerState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _GlobalUpdateCheckerState extends State<GlobalUpdateChecker> {
|
|
|
|
|
bool _mustUpdate = false;
|
|
|
|
|
String? _updateUrl;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
_checkVersionAndBlock();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> _checkVersionAndBlock() async {
|
|
|
|
|
final updateUrl = await VersionCheckService().checkForceUpdate();
|
|
|
|
|
|
|
|
|
|
if (updateUrl != null && mounted) {
|
|
|
|
|
// Invece di aprire un dialog, cambiamo lo stato e attiviamo lo "Scudo"
|
|
|
|
|
setState(() {
|
|
|
|
|
_mustUpdate = true;
|
|
|
|
|
_updateUrl = updateUrl;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
// 1. Se l'app è aggiornata, mostriamo solo l'app normale
|
|
|
|
|
if (!_mustUpdate) return widget.child;
|
|
|
|
|
|
|
|
|
|
// 2. Se l'app è vecchia, sovrapponiamo il blocco con uno Stack
|
|
|
|
|
return Stack(
|
|
|
|
|
children: [
|
|
|
|
|
// L'app sotto continua ad esistere, ma è inaccessibile
|
|
|
|
|
widget.child,
|
|
|
|
|
|
|
|
|
|
// IL BLOCCO INVALICABILE SOPRA A TUTTO
|
|
|
|
|
Positioned.fill(
|
|
|
|
|
child: Container(
|
|
|
|
|
color: Colors.black.withValues(alpha: 0.85), // Sfondo oscurante
|
|
|
|
|
child: Center(
|
|
|
|
|
// Usiamo Material per ereditare correttamente temi, font e colori
|
|
|
|
|
child: Material(
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: const EdgeInsets.all(24),
|
|
|
|
|
padding: const EdgeInsets.all(24),
|
|
|
|
|
constraints: const BoxConstraints(maxWidth: 400),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
borderRadius: BorderRadius.circular(16),
|
|
|
|
|
boxShadow: const [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Colors.black54,
|
|
|
|
|
blurRadius: 20,
|
|
|
|
|
offset: Offset(0, 10),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Icon(
|
|
|
|
|
kIsWeb ? Icons.cached : Icons.system_update,
|
|
|
|
|
color: Colors.orange,
|
|
|
|
|
size: 32,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
Text(
|
|
|
|
|
kIsWeb
|
|
|
|
|
? "Aggiornamento"
|
|
|
|
|
: "Aggiornamento Obbligatorio",
|
|
|
|
|
style: Theme.of(context).textTheme.titleLarge
|
|
|
|
|
?.copyWith(fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
|
Text(
|
|
|
|
|
kIsWeb
|
|
|
|
|
? "È stata rilasciata una nuova versione dell'applicazione. Ricarica la pagina per continuare."
|
|
|
|
|
: "Per continuare ad utilizzare l'applicazione è necessario scaricare e installare l'ultimo aggiornamento.",
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: const TextStyle(fontSize: 16),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 24),
|
|
|
|
|
if (kIsWeb)
|
|
|
|
|
FilledButton.icon(
|
|
|
|
|
icon: const Icon(Icons.refresh),
|
|
|
|
|
label: const Text("RICARICA ORA"),
|
|
|
|
|
style: FilledButton.styleFrom(
|
|
|
|
|
minimumSize: const Size(double.infinity, 50),
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
// Trick cross-platform per fare il reload
|
|
|
|
|
await launchUrl(
|
|
|
|
|
Uri.parse(Uri.base.toString()),
|
|
|
|
|
webOnlyWindowName: '_self',
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
FilledButton.icon(
|
|
|
|
|
icon: const Icon(Icons.download),
|
|
|
|
|
|
|
|
|
|
label: const Text("SCARICA AGGIORNAMENTO"),
|
|
|
|
|
style: FilledButton.styleFrom(
|
|
|
|
|
minimumSize: const Size(double.infinity, 50),
|
|
|
|
|
backgroundColor: Colors.blue,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (_updateUrl != null) {
|
|
|
|
|
final url = Uri.parse(_updateUrl!);
|
|
|
|
|
if (await canLaunchUrl(url)) {
|
|
|
|
|
await launchUrl(
|
|
|
|
|
url,
|
|
|
|
|
mode: LaunchMode.externalApplication,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|