import 'package:desktop_updater/desktop_updater.dart'; import 'package:desktop_updater/updater_controller.dart'; import 'package:desktop_updater/widget/update_widget.dart'; import 'package:fikoyt_sistem/apps/uyar/core/base_sol_menu.dart'; import 'package:fikoyt_sistem/main.dart'; import 'package:fikoyt_ui/fikoyt_ui.dart'; import 'package:fikoyt_ui/ui/fikoyt_card.dart'; import 'package:flutter/material.dart'; class AyarlarGuncelleme extends StatefulWidget { AyarlarGuncelleme({Key? key}) : super(key: key); @override State createState() => _AyarlarGuncellemeState(); } class _AyarlarGuncellemeState extends State { late DesktopUpdaterController _desktopUpdaterController; RxBool goster = RxBool(false); @override void initState() { super.initState(); _desktopUpdaterController = DesktopUpdaterController( appArchiveUrl: Uri.parse("https://fikoyt.com:9000/fapiv1/fikoyt.com.FikoYT.sistem.windows.guncelleme.bilgi"), localization: const DesktopUpdateLocalization( updateAvailableText: "Güncelleme Mevcut", newVersionAvailableText: "{} {} Mevcut", newVersionLongText: "Yeni Versiyon İndirilmeye Hazır, İndirme Tuşuna Basarak İndirebilirsiniz.", restartText: "Yeniden Başlat", warningTitleText: "Eminmisiniz?", restartWarningText: "Yeniden Başlatılacaktır. Yeniden baslatmak istediginizden emin misiniz?", warningCancelText: "Şimdi Değil", warningConfirmText: "Başlat", downloadText: "İndir", skipThisVersionText: "Bu Versiyonu Atla", ), ); } @override Widget build(BuildContext context) { return Column( children: [ Center( child: ConstrainedBox( constraints: const BoxConstraints(maxWidth: 740), child: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ // SizedBox(height: 22), FittedBox( child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: [ ColorFiltered( colorFilter: const ColorFilter.mode(Colors.white, BlendMode.modulate), child: Image.asset("assets/uyar/guncelleme.png", height: 256), ), /** */ Center( child: FikoYTButton(text: "Güncelleme", tema: FikoYTButtonTheme(fontSize: 24)), ), // Column( // crossAxisAlignment: CrossAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start, // spacing: 5, // children: [ // FikoYTButton( // text: "🟢 Sisteminiz Güncel", // tema: FikoYTButtonTheme(fontSize: 12, fontWeight: FontWeight.normal), // ), // SizedBox(height: 10), // ], // ), ], ), ), // Align( // alignment: Alignment.centerLeft, // child: FikoYTButton(text: "Öneriler", tema: FikoYTButtonTheme(fontSize: 18)), // ), SizedBox(height: 20), Obx( () => Visibility( visible: !goster.value, child: // FikoYTCard( // theme: FikoYTCardTheme(elevation: 0), // children: [ Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ FikoYTButton( text: "💡 Güncellemeleri Kontrol Et", tema: FikoYTButtonTheme( fontSize: 12, fontWeight: FontWeight.w600, backgroundColor: Colors.green, textColor: Colors.white, edgePadding: const EdgeInsets.all(10), ), onPressed: () async { try { await DesktopUpdater() .versionCheck( appArchiveUrl: 'https://fikoyt.com:9000/fapiv1/fikoyt.com.FikoYT.sistem.windows.guncelleme.bilgi/', ) .then((value) { goster.value = value != null; }); } catch (e) { print('Güncelleme kontrolü sırasında bir hata oluştu: '); // Kullanıcıya hata mesajı gösterebilirsiniz. } }, ), ], ), // UpdateDialogListener(controller: _desktopUpdaterController), // ], // ), ), ), Obx( () => Visibility( visible: goster.value, child: Theme( data: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue).copyWith( onSurface: Theme.of(context).colorScheme.onSurface, onSurfaceVariant: Theme.of(context).colorScheme.onSurfaceVariant, primary: Theme.of(context).colorScheme.primary, surfaceContainerLowest: Theme.of(context).colorScheme.surfaceContainerLowest, surfaceContainerLow: Theme.of(context).colorScheme.surfaceContainerLow, surfaceContainerHighest: Theme.of(context).colorScheme.surfaceContainerHighest, ), ), child: DesktopUpdateDirectCard( controller: _desktopUpdaterController, child: const Text("This is a child widget"), ), ), ), ), ], ), ), ), ), ), ], ); } }