// 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/pages/ayarlar/maas_parametreleri/ek_odemeler_widget.dart'; import 'package:fikoyt_mesaici/apps/mesaici/pages/ayarlar/maas_parametreleri/kesintiler_widget.dart'; import 'package:fikoyt_mesaici/apps/mesaici/pages/ayarlar/maas_parametreleri/vergiler_widget.dart'; import 'package:fikoyt_mesaici/apps/mesaici/widgets/mesaici_navigasyon/mesaici_navigasyon.dart'; import 'package:fikoyt_mesaici/core/Extensions/fiko_duration_ext.dart'; import 'package:fikoyt_mesaici/core/fikoyt.service.dart'; import 'package:fikoyt_mesaici/core/interface/fiko_dialog_ayarlari.dart'; import 'package:fikoyt_mesaici/core/widgets/yazi_kutulari/yazi_kutulari.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:flutter_animate/flutter_animate.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 '../../../widgets/uygulama_baslik/uygulama_baslik.dart'; class PageHesapMaasParametreleriLogic extends GetxController {} class PageMesaiciMaasParametreleri extends StatefulWidget { const PageMesaiciMaasParametreleri({super.key}); @override _PageMesaiciMaasParametreleriState createState() => _PageMesaiciMaasParametreleriState(); } class _PageMesaiciMaasParametreleriState extends State { PageHesapMaasParametreleriLogic logic = Get.put(PageHesapMaasParametreleriLogic()); BasePageLogic basePageLogic = Get.put(BasePageLogic()); // final FikoYTMesaiciService FikoYTService.servisMesaici = Get.put(FikoYTMesaiciService()); final FikoYTService servisFikoYT = FikoYTService(); //---> late Rx aktifAy; //---> final GlobalKey globalKeysAktifAy = GlobalKey(); final scrollController = ScrollController(); //---> @override void initState() { aktifAy = FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.toListe()[DateTime.now().month - 1].obs; super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) async { await Future.delayed(const Duration(milliseconds: 1000)); RenderObject? aktifAyObject = globalKeysAktifAy.currentContext?.findRenderObject(); // print(globalKeysAktifAy); if (aktifAyObject != null) { scrollController.position.ensureVisible( aktifAyObject, alignment: 0.5, // How far into view the item should be scrolled (between 0 and 1). duration: const Duration(seconds: 1), ); } }); } @override void dispose() { Get.delete(); scrollController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { SchedulerBinding.instance.addPostFrameCallback((_) { basePageLogic.subTitle.value = "💸 Maaş Parametreleri"; }); ScreenSizeTypes screenType = FikoYTElastic.getScreenSizeType(context); [ // ScreenSizeTypes.small, ScreenSizeTypes.mini, ScreenSizeTypes.extraMini ].contains(screenType); return FikoYTSliverApp( 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, ), ), ), //CircleAvatar ), //CircleAvatar ), //CircleAvatar ), FikoYTButton( text: "Maaş Parametreleri", tema: Theme.of(context).extension()?.copyWith( fontSize: 24, textStrokeColor: 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.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( "Maaş Parametrelerinizi Bu Sayfadan Düzenleyebilirsiniz", style: TextStyle(color: Colors.grey.shade800, fontSize: 10), ), ), const MesaiciNavigasyon(), ], ), ), ], ), body: [ // Obx( // () => ListTile( // leading: const SizedBox( // // height: double.infinity, // child: Text( // "🍀", // style: TextStyle( // fontSize: 36, // ), // ), // ), // title: const Text( // 'İkramiye Sayınız', // style: TextStyle( // fontWeight: FontWeight.w600, // ), // ), // dense: false, // subtitle: Column( // crossAxisAlignment: CrossAxisAlignment.start, // children: [ // FikoYTButton( // text: '${FikoYTService.servisMesaici.mesaiciAyarlar.maasParametreleri.ikramiyeSayisi.value.toInt()} Maaş İkramiye', // textColor: Colors.teal, // textStrokeColor: Colors.white, // ), // Slider( // value: FikoYTService.servisMesaici.mesaiciAyarlar.maasParametreleri.ikramiyeSayisi.value.toDouble(), // // label: "", // min: 0, // max: 5, // onChanged: (double value) { // FikoYTService.servisMesaici.mesaiciAyarlar.maasParametreleri.ikramiyeSayisi.value = value.toInt(); // }, // ), // ], // ), // // trailing: const Icon(Icons.chevron_right_sharp), // isThreeLine: true, // splashColor: Colors.grey.shade300, // ), // ), /** */ const SizedBox( height: 10, ), SizedBox( height: 22, 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( controller: scrollController, // shrinkWrap: true, physics: const BouncingScrollPhysics(), scrollDirection: Axis.horizontal, // your ListView child: Row( children: [ const SizedBox( width: 20, ), for (var i = 0; i < FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.toListe().length; i++) Obx( () { Maas vrd = FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.toListe()[i]; return Padding( key: (DateTime.now().month - 1) == i ? globalKeysAktifAy : null, padding: const EdgeInsets.symmetric( horizontal: 1, ), child: FikoYTButton( text: "📅 ${vrd.ismi}", tema: Theme.of(context).extension()?.copyWith( borderColor: Colors.grey.shade400, arkaPlanRengi: vrd.ismi == aktifAy.value.ismi ? Colors.blue.withOpacity(0.7) : Colors.black.withOpacity(0), edgePadding: const EdgeInsets.symmetric(vertical: 2, horizontal: 5), textColor: Colors.amberAccent, textStrokeColor: Colors.blue, ), onLongPress: () {}, onPressed: () { aktifAy.value = FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.toListe()[i]; aktifAy.refresh(); // kesinti?.turu = KesintiTuruTumu[i]; // kesintiObs.value.turu = KesintiTuruTumu[i]; // kesintiObs.refresh(); // FikoYTService.servisMesaici.ayarlarModel!.value.calismaSuresiAyarlari.aktifVardiya = i; // FikoYTService.servisMesaici.ayarlarModel!.refresh(); }, ), ).animate( effects: [const FadeEffect(), ShimmerEffect(delay: 1000.ms)], ); }, ), const SizedBox( width: 20, ), ], ), ), ), ), Row( crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end, children: [ FikoYTButton( text: Icon( Icons.help_outline_rounded, color: Colors.blue.withAlpha(100), size: 24, ), tema: Theme.of(context).extension()?.copyWith( radius: 32, ), // backColor: Colors.amber.withAlpha(80), // borderColor: Colors.amber.withAlpha(200), route: "/mesaici/yardim/konu=maas_parametreleri", ), ], ), const SizedBox( height: 5, ), /** */ // for (var i = 0; i < FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.toListe().length; i++) Obx( () { Maas maas = aktifAy.value; final Rx kayit = maas.obs; FikoYTService.servisMesaici.ayarlarModel!.value; kayit.listen( (gn) { maas = gn; // FikoYTService.servisMesaici.ayarlarModel!.refresh(); }, ); return AnimatedSwitcher( duration: const Duration(milliseconds: 1000), transitionBuilder: (Widget child, Animation animation) { return FadeTransition( opacity: animation, child: SizeTransition( sizeFactor: animation, axisAlignment: 2, // fixedCrossAxisSizeFactor: 1, axis: Axis.vertical, child: child, ), ); }, child: Visibility( key: ValueKey(kayit.value.ismi), child: Padding( padding: const EdgeInsets.all(5), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ // AyAyarlari(maasObs: maasObs) // AnimatedSwitcher( // duration: const Duration(milliseconds: 1000), // transitionBuilder: (Widget child, Animation animation) { // return FadeTransition(opacity: animation, child: child); // }, // child: FikoYTButton( key: ValueKey(kayit.value.ismi), text: '${kayit.value.ismi} Ayı Ayarları', tema: Theme.of(context).extension()?.copyWith( textColor: Colors.amber, textStrokeColor: Colors.blue, fontSize: 22, ), ), // ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "📆", style: TextStyle( fontSize: 36, ), ), ), title: const Text( ' Aylık Çalışma Günü', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Maaşınız Kaç Gün Üzerinden Hesaplanıcak', style: TextStyle( fontWeight: FontWeight.w300, ), ), Obx( () => Slider( value: kayit.value.aylikMaasGunu?.toDouble() ?? 30, // label: "", min: 1, max: 31, onChanged: (double value) { kayit.value.aylikMaasGunu = value.toInt(); FikoYTService.servisMesaici.ayarlarModel!.refresh(); }, ), ), Align( alignment: Alignment.centerRight, child: Obx( () => Text( " ${kayit.value.aylikMaasGunu ?? '30'} Gün", style: const TextStyle( fontWeight: FontWeight.bold, color: Colors.teal, ), ), ), ), ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey.shade300, onTap: () {}, ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "🕥", style: TextStyle( fontSize: 36, ), ), ), title: const Text( ' Aylık Çalışma Saati', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Bir Aylık Çalışma Saatiniz', style: TextStyle( fontWeight: FontWeight.w300, ), ), // Obx( // () => Slider( // value: FikoYTService.servisMesaici.aylikMaasGunu.value.toDouble(), // // label: "", // min: 1, // max: 31, // onChanged: (double value) { // FikoYTService.servisMesaici.aylikCalismaSaati.value = value; // FikoYTService.servisMesaici.ayarlariKaydet(); // }, // ), // ), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Obx( () => FikoYTButton( text: "⏳ ${kayit.value.aylikCalismaSaati?.insanizeEk( ekler: ['Saat', 'Dakika', 'Saniye'], ) ?? 'Yok'}", tema: Theme.of(context).extension()?.copyWith( fontSize: 12, edgePadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 1), textColor: Colors.teal, textStrokeColor: Colors.transparent, ), // borderColor: Colors.blue, onPressed: () async { kayit.value.aylikCalismaSaati = await (kayit.value.aylikCalismaSaati ?? const Duration(microseconds: 0)).sureSec(context, ayarlar: FikoDialogAyarlari(baslik: "Aylık Çalışma Saati Seçiniz", baslikSimge: "🕥", icerik: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ FikoYTButton( text: "⏳ 270 Saat", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, edgePadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 1), textColor: Theme.of(context).extension()?.textColor, textStrokeColor: Colors.transparent, borderColor: Colors.blue, ), onPressed: () { kayit.value.aylikCalismaSaati = const Duration(hours: 270); // gunObs.refresh(); FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop(context, kayit.value.aylikCalismaSaati); }, ), const SizedBox( width: 5, ), FikoYTButton( text: "⏳ 225 Saat", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, edgePadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 1), textColor: Theme.of(context).extension()?.textColor, textStrokeColor: Colors.transparent, borderColor: Colors.blue, ), onPressed: () { kayit.value.aylikCalismaSaati = const Duration(hours: 225); // gunObs.refresh(); FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop(context, kayit.value.aylikCalismaSaati); }, ), const SizedBox( width: 5, ), FikoYTButton( text: "⏳ 180 Saat", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, edgePadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 1), textColor: Theme.of(context).extension()?.textColor, textStrokeColor: Colors.transparent, borderColor: Colors.blue, ), onPressed: () { kayit.value.aylikCalismaSaati = const Duration(hours: 180); // gunObs.refresh(); FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop(context, kayit.value.aylikCalismaSaati); }, ), ], ), ])); FikoYTService.servisMesaici.ayarlarModel!.refresh(); }, ), ), ], ), ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey.shade300, onTap: () {}, ), /** */ // ListTile( // leading: const SizedBox( // // height: double.infinity, // child: Text( // "💸", // style: TextStyle( // fontSize: 36, // ), // ), // ), // title: const Text( // 'Asgari Ücret', // style: TextStyle( // fontWeight: FontWeight.w600, // ), // ), // dense: false, // subtitle: Column( // crossAxisAlignment: CrossAxisAlignment.start, // children: [ // const Text( // 'Hükümetin Belirlediği Ödenmesi Gereken En Düşük Ücret', // style: TextStyle( // fontWeight: FontWeight.w300, // ), // ), // FikoYaziKutusu( // baslik: "Asgari Ücret", // simgeSol: const Text( // "💸", // style: TextStyle(fontSize: 16), // ), // sonEk: const Text("₺"), // radius: 5.0, // klavyeTipi: TextInputType.number, // degeri: "${kayit.value.asgariUcret}", // degisti: (value) { // kayit.value.asgariUcret = double.tryParse(value.replaceAll("₺", "").replaceAll(",", "")); // FikoYTService.servisMesaici.ayarlarModel!.refresh(); // }, // ), // ], // ), // isThreeLine: true, // splashColor: Colors.grey.shade300, // ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "💸", style: TextStyle( fontSize: 36, ), ), ), title: const Text( 'Maaşınız', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Bir Aylık Maaşınız', style: TextStyle( fontWeight: FontWeight.w300, ), ), FikoYaziKutusu( baslik: "Maaşınız", simgeSol: const Text( "💸", style: TextStyle(fontSize: 16), ), sonEk: const Text("₺"), radius: 5.0, klavyeTipi: TextInputType.number, degeri: "${kayit.value.brutMaas}", degisti: (value) { kayit.value.brutMaas = double.tryParse(value.replaceAll("₺", "").replaceAll(",", "")) ?? 0.0; // maasObs.refresh(); // FikoYTService.servisMesaici.ayarlarModel!.refresh(); }, // degeri: "0.00₺", ), ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey.shade300, ), // ListTile( // leading: const SizedBox( // // height: double.infinity, // child: Text( // "💸", // style: TextStyle( // fontSize: 36, // ), // ), // ), // title: const Text( // 'Net Maaşınız', // style: TextStyle( // fontWeight: FontWeight.w600, // ), // ), // dense: false, // subtitle: Column( // crossAxisAlignment: CrossAxisAlignment.start, // children: [ // const Text( // 'Aylık Mesaisiz Giydirilmemiş Net Maaşınız', // style: TextStyle( // fontWeight: FontWeight.w300, // ), // ), // FikoYaziKutusu( // baslik: "Net Maaşınız", // simgeSol: const Text( // "💸", // style: TextStyle(fontSize: 16), // ), // sonEk: const Text("₺"), // radius: 5.0, // klavyeTipi: TextInputType.number, // degeri: "${kayit.value.netMaas}", // degisti: (value) { // kayit.value.netMaas = double.tryParse(value.replaceAll("₺", "").replaceAll(",", "")) ?? 0.0; // // FikoYTService.servisMesaici.ayarlarModel!.refresh(); // }, // ), // ], // ), // isThreeLine: true, // splashColor: Colors.grey.shade300, // ), Visibility( visible: true, child: Column( children: [ Row( children: [ Expanded( child: FikoYTButton( text: "Vergiler / Kesintiler / Primler ", tema: Theme.of(context).extension()?.copyWith( fontSize: 12, textAlign: TextAlign.center, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textStrokeWidth: 0, textColor: Colors.redAccent, textStrokeColor: Colors.transparent, ), ), ), ], ), /*** * */ 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()?.cardBackgroundColor, ), 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: [ FikoYTButton( text: "🧬 Panoya Kopyala", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, textAlign: TextAlign.start, edgePadding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5), textStrokeWidth: 0, textColor: Theme.of(context).extension()?.textColor, textStrokeColor: Colors.transparent, ), onPressed: () { String data = json.encode({ "ekOdemeler": kayit.value.ekOdemeler, "kesintiler": kayit.value.kesintiler, "vergiler": kayit.value.vergiler, }); 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('Liste Panoya Kopyalandı'), duration: Duration(seconds: 2), // SnackBar'ın ekranda kalma süresi ); ScaffoldMessenger.of(context).showSnackBar(snck); }, ), FikoYTButton( text: "📋 Panodan Çek", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, textAlign: TextAlign.start, edgePadding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5), textStrokeWidth: 0, textColor: Theme.of(context).extension()?.textColor, textStrokeColor: Colors.transparent, ), onPressed: () async { try { List lstEkOdm = []; List lstKesinti = []; List lstVrg = []; dynamic panoData = json.decode((await Clipboard.getData(Clipboard.kTextPlain))?.text ?? "{}"); for (var i = 0; i < panoData["ekOdemeler"]?.length; i++) { lstEkOdm.add(EkOdeme.fromJson(panoData["ekOdemeler"]?[i])); } for (var i = 0; i < panoData["kesintiler"]?.length; i++) { lstKesinti.add(Kesinti.fromJson(panoData["kesintiler"]?[i])); } for (var i = 0; i < panoData["vergiler"]?.length; i++) { lstVrg.add(Vergi.fromJson(panoData["vergiler"]?[i])); } kayit.value.ekOdemeler = lstEkOdm; kayit.value.kesintiler = lstKesinti; kayit.value.vergiler = lstVrg; FikoYTService.servisMesaici.ayarlarModel!.refresh(); ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text('Liste 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 ), ); } }, ), FikoYTButton( text: "💾 Dosyaya Aktar", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, textAlign: TextAlign.start, edgePadding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5), textStrokeWidth: 0, textColor: Theme.of(context).extension()?.textColor, textStrokeColor: Colors.transparent, ), onPressed: () async { try { String data = json.encode({ "ekOdemeler": kayit.value.ekOdemeler, "kesintiler": kayit.value.kesintiler, "vergiler": kayit.value.vergiler, }); // JSON verisini oluştur String jsonString = data; // Dosya kaydetme yerini sor String? outputPath = await FilePicker.platform.saveFile( dialogTitle: 'Kayıt dosyası nereye kaydedilsin?', fileName: 'VergilerKesintilerPrimler.json', 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); } }, ), FikoYTButton( text: "📂 Dosyadan Çek", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, textAlign: TextAlign.start, edgePadding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5), textStrokeWidth: 0, textColor: Theme.of(context).extension()?.textColor, textStrokeColor: Colors.transparent, ), onPressed: () async { try { // Dosya seçme FilePickerResult? result = await FilePicker.platform.pickFiles( dialogTitle: 'Kayıt dosyasını seçin', type: FileType.custom, allowedExtensions: ['json'], // 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 List lstEkOdm = []; List lstKesinti = []; List lstVrg = []; dynamic panoData = json.decode(fileContent); for (var i = 0; i < panoData["ekOdemeler"]?.length; i++) { lstEkOdm.add(EkOdeme.fromJson(panoData["ekOdemeler"]?[i])); } for (var i = 0; i < panoData["kesintiler"]?.length; i++) { lstKesinti.add(Kesinti.fromJson(panoData["kesintiler"]?[i])); } for (var i = 0; i < panoData["vergiler"]?.length; i++) { lstVrg.add(Vergi.fromJson(panoData["vergiler"]?[i])); } kayit.value.ekOdemeler = lstEkOdm; kayit.value.kesintiler = lstKesinti; kayit.value.vergiler = lstVrg; FikoYTService.servisMesaici.ayarlarModel!.refresh(); } else {} } 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); } }, ), // FikoYTButton( // text: "📡 İnternetten Çek", // textSize: 10, // textAlign: TextAlign.start, // edgePadding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5), // textStrokeWidth: 0, // textColor: Colors.black87, // textStrokeColor: Colors.transparent, // onPressed: () {}, // ), FikoYTButton( text: "🗑️ Tümünü Sil", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, textAlign: TextAlign.start, edgePadding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5), textStrokeWidth: 0, textColor: Theme.of(context).extension()?.textColor, textStrokeColor: Colors.transparent, ), onPressed: () async { FikoYTService.dialogGoster( context, const Text("Listedeki Tüm Kayıtlar Silinecek.Bu İşlem Geri Alınamaz. Onaylıyormusunuz?"), FikoDialogAyarlari(baslik: "Onay", baslikSimge: "❔", altButonlar: [ FikoYTButton( text: "✔️ Onaylıyorum", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.green, textStrokeColor: Colors.transparent, ), onPressed: () { kayit.value.vergiler = []; kayit.value.kesintiler = []; kayit.value.ekOdemeler = []; FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }, ), const Spacer(), FikoYTButton( text: "❌ Onaylamıyorum", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.red, textStrokeColor: Colors.transparent, ), onPressed: (() { FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }), ), ])); }, onLongPress: () { kayit.value.vergiler = []; kayit.value.kesintiler = []; kayit.value.ekOdemeler = []; FikoYTService.servisMesaici.ayarlarModel!.refresh(); }, ), ], ), ), ), ), ), /** * */ /** */ EkOdemelerWidget(kayit: kayit), /** */ KesintilerWidget(kayit: kayit), /** */ VergilerWidget(kayit: kayit), ], ), ), const Divider( height: 2, ), FikoYTButton( text: "Bu Ayarları Uygula:", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.redAccent, textStrokeColor: Colors.transparent, ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.center, children: [ Visibility( visible: (FikoYTService.servisMesaici.ayarlarModel?.value.maasParametreleri.toListe().indexOf(kayit.value) ?? -1) > 0, child: TextButton( // icon: const Text("💡"), child: const Text( "◀ Öncekilere", style: TextStyle( color: Colors.blue, fontWeight: FontWeight.bold, fontSize: 12, ), ), onPressed: () { FikoYTService.dialogGoster( context, const Text("Önceki Ayların Ayarları Bu Aya Göre Eşitlenecek.Bu İşlem Geri Alınamaz. Onaylıyormunuz?"), FikoDialogAyarlari(baslik: "Onay", baslikSimge: "❔", altButonlar: [ FikoYTButton( text: "✔️ Onaylıyorum", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.green, textStrokeColor: Colors.transparent, ), onPressed: () { int aktifAyIndex = FikoYTService.servisMesaici.ayarlarModel?.value.maasParametreleri.toListe().indexOf(kayit.value) ?? -1; int aySayisi = FikoYTService.servisMesaici.ayarlarModel?.value.maasParametreleri.toListe().length ?? 0; for (var i = aktifAyIndex; i >= 0; i--) { Maas aktifMaas = FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.toListe()[i]; aktifMaas.fromOther(maas: kayit.value); } // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.ocak.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.subat.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.mart.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.nisan.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.mayis.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.haziran.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.temmuz.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.agustos.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.eylul.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.ekim.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.kasim.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.aralik.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }, ), const Spacer(), FikoYTButton( text: "❌ Onaylamıyorum", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.red, textStrokeColor: Colors.transparent, ), onPressed: (() { FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }), ), ])); }, ), ), TextButton( // icon: const Text("💡"), child: const Text( "⚙️ Tümüne", style: TextStyle( color: Colors.blue, fontWeight: FontWeight.bold, fontSize: 12, ), ), onPressed: () { FikoYTService.dialogGoster( context, const Text("Tüm Ayların Ayarları Bu Aya Göre Eşitlenecek.Bu İşlem Geri Alınamaz. Onaylıyormunuz?"), FikoDialogAyarlari(baslik: "Onay", baslikSimge: "❔", altButonlar: [ FikoYTButton( text: "✔️ Onaylıyorum", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.green, textStrokeColor: Colors.transparent, ), onPressed: () { FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.ocak.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.subat.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.mart.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.nisan.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.mayis.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.haziran.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.temmuz.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.agustos.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.eylul.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.ekim.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.kasim.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.aralik.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }, ), const Spacer(), FikoYTButton( text: "❌ Onaylamıyorum", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.red, textStrokeColor: Colors.transparent, ), onPressed: (() { FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }), ), ])); }, ), Visibility( visible: (FikoYTService.servisMesaici.ayarlarModel?.value.maasParametreleri.toListe().indexOf(kayit.value) ?? -1) < 11, child: TextButton( // icon: const Text("💡"), child: const Text( "Sonrakilere ▶", style: TextStyle( color: Colors.blue, fontWeight: FontWeight.bold, fontSize: 12, ), ), onPressed: () { FikoYTService.dialogGoster( context, const Text("Sonraki Ayların Ayarları Bu Aya Göre Eşitlenecek.Bu İşlem Geri Alınamaz. Onaylıyormunuz?"), FikoDialogAyarlari(baslik: "Onay", baslikSimge: "❔", altButonlar: [ FikoYTButton( text: "✔️ Onaylıyorum", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.green, textStrokeColor: Colors.transparent, ), onPressed: () { int aktifAyIndex = FikoYTService.servisMesaici.ayarlarModel?.value.maasParametreleri.toListe().indexOf(kayit.value) ?? -1; int aySayisi = FikoYTService.servisMesaici.ayarlarModel?.value.maasParametreleri.toListe().length ?? 0; for (var i = aktifAyIndex; i < aySayisi; i++) { Maas aktifMaas = FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.toListe()[i]; aktifMaas.fromOther(maas: kayit.value); } // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.ocak.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.subat.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.mart.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.nisan.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.mayis.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.haziran.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.temmuz.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.agustos.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.eylul.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.ekim.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.kasim.fromOther(maas: kayit.value); // FikoYTService.servisMesaici.ayarlarModel!.value.maasParametreleri.aralik.fromOther(maas: kayit.value); FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }, ), const Spacer(), FikoYTButton( text: "❌ Onaylamıyorum", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.red, textStrokeColor: Colors.transparent, ), onPressed: (() { FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }), ), ])); }, ), ), ], ), ], ), ), ), ).animate(effects: [const FadeEffect()]); }, ), ], headerExpandedHeight: 315, // stretchMaxHeight: 100, fullyStretchable: false, backgroundColor: Theme.of(context).extension()?.backgroundColor, //Colors.grey.shade200, centerTitle: true, alwaysShowLeadingAndAction: true, appBarColor: Theme.of(context).extension()?.appBarColor, alwaysShowTitle: true, curvedBodyRadius: 0, onStretchTrigger: () async { context.vRouter.to("/"); }, ); } }