// ignore_for_file: library_private_types_in_public_api import 'dart:convert'; import 'dart:io'; import 'package:fikoyt_mesaici/apps/mesaici/model/ayarlar/model_ayarlar.dart'; import 'package:fikoyt_mesaici/apps/mesaici/widgets/mesaici_navigasyon/mesaici_navigasyon.dart'; import 'package:fikoyt_mesaici/core/fikoyt.service.dart'; import 'package:fikoyt_ui/ui/fiko_serit_ana.dart'; import 'package:fikoyt_ui/ui/ui.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:get/get.dart'; import 'package:vrouter/vrouter.dart'; import '../../../../core/widgets/base_page/base_page_view.dart'; import '../../../../core/widgets/fikoyt_elastic/fikoyt_elastic.dart'; import '../../base_page_mesaici_view.dart'; import '../../widgets/uygulama_baslik/uygulama_baslik.dart'; class PageMesaiciSettingsLogic extends GetxController {} class PageMesaiciSettings extends StatefulWidget { const PageMesaiciSettings({super.key}); @override _PageMesaiciSettingsState createState() => _PageMesaiciSettingsState(); } class _PageMesaiciSettingsState extends State { PageMesaiciSettingsLogic logic = Get.put(PageMesaiciSettingsLogic()); BasePageLogic basePageLogic = Get.put(BasePageLogic()); BasePageMesaiciLogic basePageMesaiciLogic = Get.put(BasePageMesaiciLogic()); //---> // final FikoYTMesaiciService FikoYTService.servisMesaici = Get.put(FikoYTMesaiciService()); @override Widget build(BuildContext context) { SchedulerBinding.instance.addPostFrameCallback((_) { basePageLogic.subTitle.value = "⚙️ Ayarlar"; }); ScreenSizeTypes screenType = FikoYTElastic.getScreenSizeType(context); [ // ScreenSizeTypes.small, ScreenSizeTypes.mini, ScreenSizeTypes.extraMini ].contains(screenType); return FikoSeritAna( leading: const UygulamaBaslikSol(), title: UygulamaBaslikOrta(), actions: const [ UygulamaBaslikSag(), ], headerWidget: PageView( children: [ Container( color: Colors.transparent, //Colors.orange, height: 300 - kToolbarHeight - 10, margin: const EdgeInsets.only(top: kToolbarHeight, bottom: 10, right: 10, left: 10), child: Column( children: [ Center( child: CircleAvatar( backgroundColor: Colors.blueAccent.shade700, radius: 64, child: CircleAvatar( backgroundColor: Colors.grey.shade50, radius: 54, child: const CircleAvatar( radius: 54, child: Text( "⚙️", style: TextStyle( fontSize: 54, ), ), ), ), ), ), FikoButton( text: "Ayarlar", tema: FikoButtonTema( boyutYazi: 24, yaziSinirRengi: Colors.blue, ), ), SizedBox( height: 24.0, child: ListView( shrinkWrap: true, scrollDirection: Axis.horizontal, children: [ SizedBox( width: 33, child: MaterialButton( elevation: 0, minWidth: 0, shape: RoundedRectangleBorder( borderRadius: const BorderRadius.all(Radius.circular(5)), side: BorderSide(width: 1, color: Colors.blue.withOpacity(0.5), style: BorderStyle.solid), ), padding: const EdgeInsets.all(0), child: const Text("🏠"), // const Icon(Icons.home, // color: Colors.lightBlue, size: 14), // color: Colors.white, onPressed: () async { // Scaffold.of(context).openEndDrawer(); context.vRouter.to("/mesaici"); }, ), ), const SizedBox(width: 3), SizedBox( width: 33, child: MaterialButton( elevation: 0, minWidth: 0, shape: RoundedRectangleBorder( borderRadius: const BorderRadius.all(Radius.circular(5)), side: BorderSide(width: 1, color: Colors.blue.withOpacity(0.5), style: BorderStyle.solid), ), padding: const EdgeInsets.all(0), // color: Colors.white, onPressed: () async { // Scaffold.of(context).openEndDrawer(); context.vRouter.to("/mesaici/bildirimler"); }, child: const Text("🛎️"), // const Icon(Icons.notifications, // color: Colors.lightBlue, size: 14), ), ), // const SizedBox(width: 3), // SizedBox( // width: 33, // child: MaterialButton( // elevation: 0, // minWidth: 0, // shape: RoundedRectangleBorder( // borderRadius: // const BorderRadius.all(Radius.circular(5)), // side: BorderSide( // width: 1, // color: Colors.blue.withOpacity(0.5), // style: BorderStyle.solid), // ), // padding: const EdgeInsets.all(0), // child: const Text("👨‍👩‍👦‍👦"), // // const Icon(Icons.people, // // color: Colors.lightBlue, size: 14), // // color: Colors.white, // onPressed: () async { // context.vRouter.to("/mesaici/arkadaslar"); // // Scaffold.of(context).openEndDrawer(); // // context.vRouter.to("/uye/arkadaslar"); // }, // ), // ), // const SizedBox(width: 3), // SizedBox( // width: 33, // child: MaterialButton( // elevation: 0, // minWidth: 0, // shape: RoundedRectangleBorder( // borderRadius: // const BorderRadius.all(Radius.circular(5)), // side: BorderSide( // width: 1, // color: Colors.blue.withOpacity(0.5), // style: BorderStyle.solid), // ), // padding: const EdgeInsets.all(0), // // color: Colors.white, // onPressed: () { // if (kDebugMode) { // context.vRouter.to("/mesaici/mesajlar"); // // Scaffold.of(context).openEndDrawer(); // // print('clicked'); // } // }, // child: const Text("✉️"), // // const Icon(Icons.mail, // // color: Colors.lightBlue, size: 14), // ), // ), const SizedBox(width: 3), SizedBox( width: 33, child: MaterialButton( elevation: 0, minWidth: 0, shape: RoundedRectangleBorder( borderRadius: const BorderRadius.all(Radius.circular(5)), side: BorderSide(width: 1, color: Colors.blue.withOpacity(0.5), style: BorderStyle.solid), ), padding: const EdgeInsets.all(0), child: const Text("⚙️"), // const Icon(Icons.settings, // color: Colors.lightBlue, size: 14), // color: Colors.white, onPressed: () { // if (kDebugMode) { context.vRouter.to("/mesaici/ayarlar"); // Scaffold.of(context).openEndDrawer(); if (kDebugMode) { print('clicked'); } // } }, ), ), ], ), ), Center( child: Text( "FikoYT Mesaicinin Tüm Ayarlarına Bu Sayfadan Ulaşabilirsiniz", style: TextStyle(color: Colors.grey.shade800, fontSize: 10), ), ), const MesaiciNavigasyon(), ], ), ), ], ), body: [ /** */ Obx( () => AnimatedSwitcher( duration: const Duration(seconds: 1), child: true.obs.value ? Container( alignment: Alignment.centerLeft, padding: const EdgeInsets.all(1), margin: const EdgeInsets.symmetric(vertical: 5), decoration: BoxDecoration( border: Border.all(color: Colors.grey.shade300), borderRadius: BorderRadius.circular(15), color: Theme.of(context).extension()?.kartArkaPlanRenk, ), child: SizedBox( height: 18.0, child: ShaderMask( shaderCallback: (Rect rect) { return const LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [Colors.purple, Colors.transparent, Colors.transparent, Colors.purple], stops: [0.0, 0.1, 0.9, 1.0], // 10% purple, 80% transparent, 10% purple ).createShader(rect); }, blendMode: BlendMode.dstOut, child: SingleChildScrollView( scrollDirection: Axis.horizontal, physics: const BouncingScrollPhysics(), child: Row( children: [ FikoButton( text: "🧬 Panoya Kopyala", tema: FikoButtonTema( boyutYazi: 10, textAlign: TextAlign.start, edgePadding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5), boyutYaziSinir: 0, yaziRengi: Theme.of(context).extension()?.yaziRengi, yaziSinirRengi: Colors.transparent, ), onPressed: () { String data = json.encode(FikoYTService.servisMesaici.ayarlarModel?.value); Clipboard.setData(ClipboardData(text: data)); SnackBar snck = const SnackBar( // behavior: SnackBarBehavior.floating, // margin: EdgeInsets.symmetric(vertical: 50.0, horizontal: 30), dismissDirection: DismissDirection.down, showCloseIcon: true, content: Text('Ayarlar Panoya Kopyalandı'), duration: Duration(seconds: 2), // SnackBar'ın ekranda kalma süresi ); ScaffoldMessenger.of(context).showSnackBar(snck); }, ), FikoButton( text: "📋 Panodan Çek", tema: FikoButtonTema( boyutYazi: 10, textAlign: TextAlign.start, edgePadding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5), boyutYaziSinir: 0, Theme.of(context).extension()?.yaziRengi, yaziSinirRengi: Colors.transparent, ), onPressed: () async { try { dynamic panoData = json.decode((await Clipboard.getData(Clipboard.kTextPlain))?.text ?? "{}"); FikoYTService.servisMesaici.ayarlarModel?.value = ModelAyarlar.fromJson(panoData); ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text('Ayarlar Panodan Kopyalandı'), duration: Duration(seconds: 2), // SnackBar'ın ekranda kalma süresi ), ); } catch (e) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: const Text( 'Veri Hatası', style: TextStyle(color: Colors.white), ), backgroundColor: Colors.red, action: SnackBarAction( label: 'Tamam', onPressed: () { // Action butonuna tıklanınca yapılacak işlemler }, ), duration: const Duration(seconds: 2), // SnackBar'ın ekranda kalma süresi ), ); } }, ), FikoButton( text: "💾 Dosyaya Aktar", tema: FikoButtonTema( boyutYazi: 10, textAlign: TextAlign.start, edgePadding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5), boyutYaziSinir: 0, Theme.of(context).extension()?.yaziRengi, yaziSinirRengi: Colors.transparent, ), onPressed: () async { try { String data = json.encode(FikoYTService.servisMesaici.ayarlarModel?.value); // JSON verisini oluştur String jsonString = data; // Dosya kaydetme yerini sor String? outputPath = await FilePicker.platform.saveFile( dialogTitle: 'Kayıt dosyası nereye kaydedilsin?', fileName: 'Tum_Ayarlar.FikoAyar', bytes: Uint8List.fromList(utf8.encode(data)), ); if (outputPath != null) { if (Platform.isAndroid == false && Platform.isIOS == false) { // Dosyayı yaz File file = File(outputPath); await file.writeAsString(jsonString); } SnackBar snck = const SnackBar( content: Text('Dosya Kaydedildi'), duration: Duration(seconds: 2), // SnackBar'ın ekranda kalma süresi ); ScaffoldMessenger.of(context).showSnackBar(snck); } else { SnackBar snck = const SnackBar( content: Text('Dosya Kaydedilmesi İptal Edildi.'), backgroundColor: Colors.red, duration: Duration(seconds: 2), // SnackBar'ın ekranda kalma süresi ); ScaffoldMessenger.of(context).showSnackBar(snck); } } catch (e) { SnackBar snck = const SnackBar( content: Text('Bir Hata Oluştu'), backgroundColor: Colors.red, duration: Duration(seconds: 2), // SnackBar'ın ekranda kalma süresi ); ScaffoldMessenger.of(context).showSnackBar(snck); } }, ), FikoButton( text: "📂 Dosyadan Çek", tema: FikoButtonTema( boyutYazi: 10, textAlign: TextAlign.start, edgePadding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5), boyutYaziSinir: 0, Theme.of(context).extension()?.yaziRengi, yaziSinirRengi: Colors.transparent, ), onPressed: () async { try { // Dosya seçme FilePickerResult? result = await FilePicker.platform.pickFiles( dialogTitle: 'Kayıt dosyasını seçin', type: FileType.any, // allowedExtensions: ['.FikoAyar'], // Sadece JSON dosyalarını seçtir ); if (result != null && result.files.single.path != null) { // Dosya yolunu al String filePath = result.files.single.path!; // Dosyanın içeriğini oku File file = File(filePath); String fileContent = await file.readAsString(); // JSON verisini çözümle dynamic jsonList = json.decode(fileContent); FikoYTService.servisMesaici.ayarlarModel?.value = ModelAyarlar.fromJson(jsonList); FikoYTService.servisMesaici.ayarlarModel?.refresh(); ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text('Ayarlar Dosyadan Çekildi'), duration: Duration(seconds: 2), // SnackBar'ın ekranda kalma süresi ), ); } else {} } catch (e) { if (kDebugMode) { print(e); } SnackBar snck = const SnackBar( content: Text('Bir Hata Oluştu'), backgroundColor: Colors.red, duration: Duration(seconds: 2), // SnackBar'ın ekranda kalma süresi ); ScaffoldMessenger.of(context).showSnackBar(snck); } }, ), ], ), ), ), ), ) : null, ), ), /** */ Row( crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end, children: [ FikoButton( text: Icon( Icons.help_outline_rounded, color: Colors.blue.withAlpha(100), size: 24, ), tema: FikoButtonTema( radius: 32, ), // backColor: Colors.amber.withAlpha(80), // borderColor: Colors.amber.withAlpha(200), route: "/mesaici/yardim/konu=ayarlar", ), ], ), /** */ // const SizedBox( // height: 36, // child: DefaultTabController( // length: 2, // child: TabBar( // labelStyle: TextStyle(fontSize: 10), // labelPadding: EdgeInsets.zero, // indicatorPadding: EdgeInsets.zero, // padding: EdgeInsets.zero, // tabs: [ // Tab( // icon: Tooltip( // message: "Ayrıntılı Ayarlar", // child: Text( // "📋", // style: TextStyle( // fontSize: 18, // ), // ), // ), // // text: "Ayrıntılı", // ), // Tab( // icon: Tooltip( // message: "Ayar Sihirbazı", // child: Text( // "🤖", // style: TextStyle( // fontSize: 18, // ), // ), // ), // // text: "Sihirbaz", // ), // ], // ), // ), // ), Padding( padding: const EdgeInsets.all(5), child: Column( children: [ Card( child: ListTile( leading: const Text( "📱", style: TextStyle( fontSize: 24, ), ), title: const Text( 'Uygulama Ayarları', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: true, subtitle: const Text('FikoYT Mesaici Programına Ait Ayarları Yönetin'), trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: false, splashColor: Colors.grey.shade300, onTap: () { context.vRouter.to("/mesaici/ayarlar/uygulama-ayarlari"); }, ), ), Card( child: ListTile( leading: const Text( "🔐", style: TextStyle( fontSize: 24, ), ), title: const Text( 'Hesap Ayarları', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: true, subtitle: const Text('FikoYT Hesabınıza İlişkin Ayarlarınızı Yönetin'), trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: false, splashColor: Colors.grey.shade300, onTap: () { context.vRouter.to("/mesaici/ayarlar/hesap-ayarlari"); }, ), ), Card( child: ListTile( leading: const Text( "🕒", style: TextStyle( fontSize: 24, ), ), title: const Text( 'Çalışma Süreleri', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: true, subtitle: const Text('Çalışma Sürelerinizi Düzenleyin'), trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: false, splashColor: Colors.grey.shade300, onTap: () { context.vRouter.to("/mesaici/ayarlar/calisma-sureleri"); }, ), ), Card( child: ListTile( leading: const Text( "🚩", style: TextStyle( fontSize: 24, ), ), title: const Text( 'Resmi Tatiller', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: true, subtitle: const Text('Resmi Tatilleri Tanımlayın'), trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: false, splashColor: Colors.grey.shade300, onTap: () { context.vRouter.to("/mesaici/ayarlar/resmi-tatiller"); }, ), ), // Card( // child: ListTile( // leading: const Text( // "🚩", // style: TextStyle( // fontSize: 24, // ), // ), // title: const Text( // 'Resmi Tatil F.Mesai Oranları', // style: TextStyle( // fontWeight: FontWeight.w600, // ), // ), // dense: true, // subtitle: const Text('Resmi Tatile Denk Gelen Fazla Mesailerinizin Oranını Düzenleyin'), // trailing: const Icon(Icons.chevron_right_sharp), // isThreeLine: false, // splashColor: Colors.grey.shade300, // onTap: () { // context.vRouter.to("/mesaici/ayarlar/resmi-tatil-fazla-mesai-oranlari"); // }, // ), // ), Card( child: ListTile( leading: const Text( "💸", style: TextStyle( fontSize: 24, ), ), title: const Text( 'Maaş Parametreleri', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: true, subtitle: const Text('Maaşınıza Ait Değişkenleri Düzenleyin'), trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: false, splashColor: Colors.grey.shade300, onTap: () { context.vRouter.to("/mesaici/ayarlar/maas-parametreleri"); }, ), ), // Card( // child: ListTile( // leading: const Text( // "🔻", // style: TextStyle( // fontSize: 24, // ), // ), // title: const Text( // 'Asgari Ücret Verileri', // style: TextStyle( // fontWeight: FontWeight.w600, // ), // ), // dense: true, // subtitle: const Text('Mevcut Döneme Ait Asgari Ücret Verilerini İnceleyin'), // trailing: const Icon(Icons.chevron_right_sharp), // isThreeLine: false, // splashColor: Colors.grey.shade300, // onTap: () { // context.vRouter.to("/mesaici/ayarlar/asgari-ucret-verileri"); // }, // ), // ), // Card( // child: ListTile( // leading: const Text( // "🧾", // style: TextStyle( // fontSize: 24, // ), // ), // title: const Text( // 'Vergiler', // style: TextStyle( // fontWeight: FontWeight.w600, // ), // ), // dense: true, // subtitle: const Text('Mevcut Döneme Ait Vergilendirme Değişkenlerinizi Düzenleyin'), // trailing: const Icon(Icons.chevron_right_sharp), // isThreeLine: false, // splashColor: Colors.grey.shade300, // onTap: () { // context.vRouter.to("/mesaici/ayarlar/vergiler"); // }, // ), // ), // Card( // child: ListTile( // leading: const Text( // "💊", // style: TextStyle( // fontSize: 24, // ), // ), // title: const Text( // 'Primler Kesintiler', // style: TextStyle( // fontWeight: FontWeight.w600, // ), // ), // dense: true, // subtitle: const Text('Sgk, İşsizlik vb. Gibi Ödediğiniz Primleri Düzenleyiniz'), // trailing: const Icon(Icons.chevron_right_sharp), // isThreeLine: false, // splashColor: Colors.grey.shade300, // onTap: () { // context.vRouter.to("/mesaici/ayarlar/primler-kesintiler"); // }, // ), // ), const Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Divider( indent: 20.0, endIndent: 10.0, thickness: 1, ), ), Text( "Yada", style: TextStyle(color: Colors.blueGrey, fontSize: 14), ), Expanded( child: Divider( indent: 10.0, endIndent: 20.0, thickness: 1, ), ), ], ), Card( child: ListTile( leading: const Text( "🗄️", style: TextStyle( fontSize: 24, ), ), title: const Text( 'Yedekleme', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: true, subtitle: const Text('Yedekleme Parametrelerinizi Yönetin'), trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: false, splashColor: Colors.grey.shade300, onTap: () { context.vRouter.to("/mesaici/ayarlar/yedekleme"); }, ), ), // Card( // child: ListTile( // leading: const Text( // "🤖", // style: TextStyle( // fontSize: 24, // ), // ), // title: const Text( // 'Ayar Yardımcısı', // style: TextStyle( // fontWeight: FontWeight.w600, // ), // ), // dense: true, // subtitle: const Text('Bu Yardımcı\'nın Sorduğu Sorulara Cevap Vererek Ayarlarınızı Kolaylıkla Yapabilirsiniz'), // trailing: const Icon(Icons.chevron_right_sharp), // isThreeLine: false, // splashColor: Colors.grey.shade300, // onTap: () { // context.vRouter.to("/mesaici/ayarlar/ayar-yardimcisi"); // }, // ), // ), Card( child: ListTile( leading: const Text( "💳", style: TextStyle( fontSize: 24, ), ), title: const Text( 'Satın Al', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: true, subtitle: const Text('Mesaiciyi Kullanmaya Devam Edin'), trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: false, splashColor: Colors.grey.shade300, onTap: () { context.vRouter.to("/mesaici/ayarlar/satin-al"); }, ), ), ], ), ), ], // bottomNavigationBar: // BottomNavigationBar( // items: const [ // BottomNavigationBarItem( // icon: Text( // "📋", // style: TextStyle( // fontSize: 18, // ), // ), // label: 'Ayrıntılı', // backgroundColor: Colors.white, // tooltip: "Ayrıntılı"), // BottomNavigationBarItem( // icon: Text( // "🤖", // style: TextStyle( // fontSize: 18, // ), // ), // label: 'Sihirbaz', // tooltip: 'Sihirbaz', // backgroundColor: Colors.green, // ), // ], // currentIndex: 0, // selectedItemColor: Colors.amber[800], // onTap: (value) {}, // ), // const SizedBox( // height: 36, // child: DefaultTabController( // length: 2, // child: TabBar( // labelStyle: TextStyle(fontSize: 10), // labelPadding: EdgeInsets.zero, // indicatorPadding: EdgeInsets.zero, // padding: EdgeInsets.zero, // tabs: [ // Tab( // icon: Tooltip( // message: "Ayrıntılı Ayarlar", // child: Text( // "📋", // style: TextStyle( // fontSize: 18, // ), // ), // ), // // text: "Ayrıntılı", // ), // Tab( // icon: Tooltip( // message: "Ayar Sihirbazı", // child: Text( // "🤖", // style: TextStyle( // fontSize: 18, // ), // ), // ), // // text: "Sihirbaz", // ), // ], // ), // ), // ), headerExpandedHeight: 315, // stretchMaxHeight: 100, fullyStretchable: false, backgroundColor: Theme.of(context).extension()?.arkaPlanRenk, //Colors.grey.shade200, centerTitle: true, alwaysShowLeadingAndAction: true, appBarColor: Colors.blue.shade500, alwaysShowTitle: true, curvedBodyRadius: 0, onStretchTrigger: () async { context.vRouter.to("/"); }, ); } @override void dispose() { Get.delete(); super.dispose(); } }