import 'package:fikoyt_akcali_v1/apps/finans/core/models/finans.model.dart'; import 'package:fikoyt_akcali_v1/apps/finans/core/services/finans.servis.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/hareketler/hareket-ekle/_logic_hareket_ekle.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/hesaplar/hesap/widgets/hesap-sec-dialog.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/kategoriler/kategori-sec-dialog.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/para-birimleri/para-birimi-sec-dialog.dart'; import 'package:fikoyt_ui/Extensions/fiko_double_ext.dart'; import 'package:fikoyt_ui/fikoyt_ui.dart'; import 'package:fikoyt_ui/ui/fikoyt_finansal_klavye.dart'; import 'package:flutter/material.dart'; class HesapMakinesi extends StatelessWidget { HesapMakinesi({super.key}); FinansServis? finansServis = FikoYTCoreService.servisler.getServis(); HareketEkleService logic = Get.put(HareketEkleService()); // final Rx sonIslem; // final Rx hesaplama; final Rx hesaplama = Rx("0.0"); final Rx sonIslem = Rx(""); @override Widget build(BuildContext context) { hesaplama.value = (logic.kyt.value?.miktar ?? 0.0).toParaBirimi( pattern: "#,${'#' * (2)}0.${'0' * (logic.kyt.value?.paraBirimi.value?.kusurat ?? 2)}", symbol: "", ); FocusManager.instance.primaryFocus?.unfocus(); return Container( color: Colors.white, // Theme.of(context).extension()?.backgroundColor, width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, constraints: BoxConstraints(maxWidth: 620), child: Column( children: [ Container( // height: 30, color: Colors.orangeAccent, child: Flex( direction: Axis.horizontal, crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.max, children: [ Flexible( fit: FlexFit.tight, child: Obx( () => FikoYTButton( text: Center( child: FikoYTButton( text: "Gelir", tema: Theme.of(context).extension()?.copyWith( fontSize: 16, edgePadding: EdgeInsets.symmetric(vertical: 10), textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.white, // textShadow: Theme.of(context).extension()?.textShadow, ), ), ), tema: Theme.of(context).extension()?.copyWith( // fontSize: 41, textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.white, radius: 0, backgroundColor: logic.kyt.value?.tipi == "Gelir" ? Colors.teal : Colors.transparent, // textShadow: Theme.of(context).extension()?.textShadow, ), onPressed: () { logic.kyt.value?.tipi = "Gelir"; logic.kyt.refresh(); }, ), ), ), Flexible( fit: FlexFit.tight, child: Obx( () => FikoYTButton( text: Center( child: FikoYTButton( text: "Gider", tema: Theme.of(context).extension()?.copyWith( fontSize: 16, edgePadding: EdgeInsets.symmetric(vertical: 10), textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.white, // textShadow: Theme.of(context).extension()?.textShadow, ), ), ), tema: Theme.of(context).extension()?.copyWith( // fontSize: 41, textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.white, radius: 0, backgroundColor: logic.kyt.value?.tipi == "Gider" ? Colors.teal : Colors.transparent, // textShadow: Theme.of(context).extension()?.textShadow, ), onPressed: () { logic.kyt.value?.tipi = "Gider"; logic.kyt.refresh(); }, ), ), ), Flexible( fit: FlexFit.tight, child: Obx( () => FikoYTButton( text: Center( child: FikoYTButton( text: "Transfer", tema: Theme.of(context).extension()?.copyWith( fontSize: 16, edgePadding: EdgeInsets.symmetric(vertical: 10), textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.white, // textShadow: Theme.of(context).extension()?.textShadow, ), ), ), tema: Theme.of(context).extension()?.copyWith( textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.white, radius: 0, backgroundColor: logic.kyt.value?.tipi == "Transfer" ? Colors.teal : Colors.transparent, // textShadow: Theme.of(context).extension()?.textShadow, ), onPressed: () { logic.kyt.value?.tipi = "Transfer"; logic.kyt.refresh(); }, ), ), ), ], ), ), // Container(color: Colors.amber), Spacer(), ///$ Row( children: [ Flexible( fit: FlexFit.tight, child: Wrap( crossAxisAlignment: WrapCrossAlignment.end, alignment: WrapAlignment.end, children: [ Obx( () => AnimatedFikoYTButton1( text: sonIslem.value, tema: Theme.of(context).extension()?.copyWith( fontSize: 16, textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.black, textStrokeWidth: 1, // textShadow: Theme.of(context).extension()?.textShadow, // ), ), ), ), ], ), ), ], ), Row( children: [ Obx( () => AnimatedFikoYTButton1( text: logic.kyt.value?.tipi == "Gelir" ? "+" : logic.kyt.value?.tipi == "Gider" ? "─" : "±", tema: Theme.of(context).extension()?.copyWith( fontSize: 41, textAlign: TextAlign.center, textStrokeColor: Colors.black, textColor: Colors.white, textStrokeWidth: 3, // textShadow: Theme.of(context).extension()?.textShadow, ), ), ), Flexible( fit: FlexFit.tight, child: // SingleChildScrollView( // scrollDirection: Axis.horizontal, // physics: BouncingScrollPhysics(), // child: Wrap( crossAxisAlignment: WrapCrossAlignment.end, alignment: WrapAlignment.end, children: [ Obx( () => FikoYTButton( text: hesaplama.value, tema: Theme.of(context).extension()?.copyWith( fontSize: 32, textAlign: TextAlign.center, textStrokeColor: Colors.black, textColor: Colors.white, textStrokeWidth: 3, // textShadow: Theme.of(context).extension()?.textShadow, // ), ), ), ), ], ), ), Obx( () => FikoYTButton( text: logic.kyt.value?.paraBirimi.value?.sembol ?? "?", tema: Theme.of(context).extension()?.copyWith( fontSize: 41, textAlign: TextAlign.center, textStrokeColor: Colors.black, textColor: Colors.white, textStrokeWidth: 3, // textShadow: Theme.of(context).extension()?.textShadow, ), onPressed: () { if (logic.kyt.value?.hesap.value?.cokluParaBirimiDestegi == true) { FikoYTCoreService.dialogGoster(context, ParaBirimiSecDialog(), null).then((value) { if (value.runtimeType == ParaBirimi) { logic.kyt.value?.paraBirimi.value = value as ParaBirimi?; } logic.kyt.refresh(); }); } else { toastification.dismissAll(delayForAnimation: true); if (logic.kyt.value?.hesap.value != null) { toastification.show( context: FikoYTCoreService.navigatorKey.currentContext, type: ToastificationType.warning, style: ToastificationStyle.fillColored, // title: Text("FikoYT Sistem"), description: Text("${logic.kyt.value?.hesap.value?.ismi} Hesabı Çoklu Para Birimini Desteklemiyor."), alignment: Alignment.topRight, autoCloseDuration: const Duration(seconds: 4), borderRadius: BorderRadius.circular(4.0), boxShadow: lowModeShadow, showProgressBar: false, dragToClose: true, applyBlurEffect: true, ); } else { toastification.show( context: FikoYTCoreService.navigatorKey.currentContext, type: ToastificationType.info, style: ToastificationStyle.fillColored, // title: Text("FikoYT Sistem"), description: Text("İlk Önce Hesap Seçilmeli."), alignment: Alignment.topRight, autoCloseDuration: const Duration(seconds: 4), borderRadius: BorderRadius.circular(4.0), boxShadow: lowModeShadow, showProgressBar: false, dragToClose: true, applyBlurEffect: true, ); FikoYTPageController.getInstance( "HareketEkleAnaSayfaIndex", ).git(0, duration: (finansServis?.openContainerDuration ?? 1000.ms) * 1.2, curve: Curves.bounceOut); } } }, ), ), ], ), Spacer(), Container( height: 42, color: Colors.transparent, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: FikoYTButton( text: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.max, children: [ FikoYTButton( text: "Hesap", tema: Theme.of(context).extension()?.copyWith( // fontSize: 41, align: Alignment.center, textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.blueAccent, // textShadow: Theme.of(context).extension()?.textShadow, ), ), Obx( () => FikoYTButton( text: logic.kyt.value?.hesap.value != null ? ("${logic.kyt.value?.hesap.value?.simgesi} ${logic.kyt.value?.hesap.value?.ismi}") : "Seçiniz", tema: Theme.of(context).extension()?.copyWith( // fontSize: 41, align: Alignment.center, textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: logic.kyt.value?.hesap.value != null ? Colors.green : Colors.red, textShadow: [], ), ), ), ], ), tema: Theme.of(context).extension()?.copyWith( // fontSize: 41, align: Alignment.center, textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.white, borderRadius: BorderRadius.zero, // textShadow: Theme.of(context).extension()?.textShadow, ), onPressed: () { FikoYTCoreService.dialogGoster(context, HesapSecDialog(), null).then((value) { if (value.runtimeType == Hesap) { logic.kyt.value?.hesap.value = value as Hesap?; if (logic.kyt.value?.hesap.value != null) { if (logic.kyt.value?.paraBirimi.value == null) { logic.kyt.value?.paraBirimi.value = logic.kyt.value?.hesap.value?.paraBirimi.value; } else if (logic.kyt.value?.hesap.value?.cokluParaBirimiDestegi != true) { logic.kyt.value?.paraBirimi.value = logic.kyt.value?.hesap.value?.paraBirimi.value; } } else { logic.kyt.value?.paraBirimi.value = null; } } logic.kyt.refresh(); }); }, ), ), Expanded( child: FikoYTButton( text: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.max, children: [ FikoYTButton( text: "Kategori", tema: Theme.of(context).extension()?.copyWith( // fontSize: 41, align: Alignment.center, textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.blue, // textShadow: Theme.of(context).extension()?.textShadow, ), ), Obx( () => FikoYTButton( text: logic.kyt.value?.kategori.isNotEmpty == true ? logic.kyt.value?.kategori.length == 1 ? ("${logic.kyt.value?.kategori.first.simge} ${logic.kyt.value?.kategori.first.ismi}") : "${logic.kyt.value?.kategori.length} Kategori" : "Seçiniz", tema: Theme.of(context).extension()?.copyWith( // fontSize: 41, align: Alignment.center, textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.blue, // textShadow: Theme.of(context).extension()?.textShadow, ), ), ), ], ), tema: Theme.of(context).extension()?.copyWith( // fontSize: 41, align: Alignment.center, textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Colors.white, borderRadius: BorderRadius.zero, // textShadow: Theme.of(context).extension()?.textShadow, ), onPressed: () { FikoYTCoreService.dialogGoster(context, KategoriSecDialog(), null).then((value) async { if (value is Kategori) { await finansServis?.isar?.writeTxn(() async { print(logic.kyt.value?.kategori.add(value)); print(logic.kyt.value?.kategori.toList()); logic.kyt.value?.kategori.add(value); }); } if (value is List) { logic.kyt.value?.kategori.clear(); logic.kyt.value?.kategori.addAll(value); } else if (value is Kategori) { logic.kyt.value?.kategori.add(value); } // logic.kyt.value?.kategori.clear(); // logic.kyt.value?.kategori.addAll(secilenKategoriler); logic.kyt.refresh(); }); }, ), ), ], ), ), Container( height: 36, color: Colors.blueAccent, child: Center( child: FikoYTButton( text: "Şablonlar", tema: Theme.of(context).extension()?.fikoYTButtonTheme?.copyWith( textColor: Colors.white, fontSize: 16, edgePadding: EdgeInsets.all(5), ) ?? FikoYTButtonTheme(textColor: Colors.white, fontSize: 16, edgePadding: EdgeInsets.all(5)), onPressed: () {}, ), ), ), Container( // color: Colors.amber.shade400, // Theme.of(context).extension()?.backgroundColor, width: MediaQuery.of(context).size.width, // height: MediaQuery.of(context).size.height, constraints: BoxConstraints(maxWidth: 620), child: FikoYTFinansalKlavye( onInput: (p0) { hesaplama.value = p0; hesaplama.refresh(); }, onCalc: ({hata, sonuc, sonHesap}) { hesaplama.value = double.tryParse(hesaplama.value)?.toParaBirimi( symbol: "", pattern: "#,${'#' * (2)}0.${'0' * (logic.kyt.value?.paraBirimi.value?.kusurat ?? 2)}", ) ?? hesaplama.value; logic.kyt.value?.miktar = (sonuc ?? 0.0); sonIslem.value = sonHesap; logic.kyt.refresh(); if (hata == true) { sonIslem.value = ""; } }, onDelete: () { sonIslem.value = ""; }, ), ), // .animate().moveY(begin: 250, end: 0, delay: 100.ms), ], ), ); } }