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/core/services/hesap_turleri_service.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/hesaplar/__atik__/hesap-turleri/hesap-turu.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/hesaplar/_hesaplar-logic.dart'; import 'package:fikoyt_akcali_v1/core/widgets/header_widget/header_widget.dart'; import 'package:fikoyt_akcali_v1/core/widgets/uygulama_baslik/uygulama_baslik.dart'; import 'package:fikoyt_ui/fikoyt_ui.dart'; import 'package:fikoyt_ui/ui/fikoyt_card.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:isar/isar.dart'; class SayfaHesapTurleri extends StatefulWidget { const SayfaHesapTurleri({super.key}); @override State createState() => _SayfaHesapTurleriState(); } class _SayfaHesapTurleriState extends State { FinansServis? finansServis = FikoYTCoreService.servisler.getServis(); HesapTurleriService? logic = Get.put(HesapTurleriService()); HesaplarService? logicHesaplar = Get.put(HesaplarService()); bool isOpenFab = false; @override void initState() { // SchedulerBinding.instance.addPostFrameCallback((_) { // finansServis?.altBaslik.value = "Hesap Türleri"; // }); super.initState(); } @override void dispose() { // Get.delete(); super.dispose(); } @override Widget build(BuildContext context) { return FikoYTSliverApp( leading: UygulamaBaslikSol(), title: UygulamaBaslikOrta(altBaslik: "Hesap Türleri"), actions: [UygulamaBaslikSag()], drawer: finansServis?.solMenu.value, backgroundColor: Theme.of(context).extension()?.backgroundColor, appBarColor: Theme.of(context).extension()?.appBarColor?.withAlpha(230), headerExpandedHeight: 230, // stretchMaxHeight: 100, fullyStretchable: true, centerTitle: true, alwaysShowLeadingAndAction: true, alwaysShowTitle: true, curvedBodyRadius: 0, floatingActionButton: TapRegion( child: AnimatedContainer( alignment: Alignment.center, width: isOpenFab ? 130 : 60, height: isOpenFab ? 110 : 60, decoration: BoxDecoration( color: isOpenFab ? Theme.of(context).extension()?.cardBackgroundColor : Colors.blue, borderRadius: BorderRadius.circular(isOpenFab ? 5 : 35), boxShadow: Theme.of(context).extension()?.boxShadow, ), duration: Duration(milliseconds: ((finansServis?.openContainerDuration ?? Duration.zero).inMilliseconds / 2).toInt()), // margin: !widget.isOpenFab ? EdgeInsets.zero : EdgeInsets.only(right: 30, bottom: 30), // curve: Curves.easeInOut, child: AnimatedSwitcher( duration: finansServis?.openContainerDuration ?? Duration.zero, reverseDuration: Duration(milliseconds: 250), child: !isOpenFab ? FikoYTButton( text: "+", tema: FikoYTButtonTheme( textColor: Colors.white, // fontWeight: FontWeight.w700, edgePadding: EdgeInsets.all(3), // borderColor: Colors.blueAccent, elevation: 3, fontSize: 36, ), ) : ListView( physics: BouncingScrollPhysics(), children: [ finansServis?.animasyonluWidgetAc( ozelId: "YeniHesapTürüEkle", mevcutWidget: (context, action) => Container( decoration: BoxDecoration( color: isOpenFab ? Colors.transparent : Colors.transparent, borderRadius: BorderRadius.circular(isOpenFab ? 5 : 35), ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ FikoYTButton( text: "➕", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, fontSize: 48, ), ), FikoYTButton( text: "Hesap Türü Ekle", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, fontWeight: FontWeight.bold, ), ), FikoYTButton( text: "Hesap Türü Eklemeniz İçin Akçalıya Yönlendirir", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, fontWeight: FontWeight.w300, fontSize: 10, ), ), ], ), ), acilacakWidget: (context, action) { return SayfaHesapTuru(animClose: action); }, ), ], ), ), ), onTapInside: (v) { setState(() { isOpenFab = true; }); // if (!isOpen) { // setState(() { // width = 200; // height = 200; // left = 60; // bottom = 60; // isOpen = !isOpen; // }); // } }, onTapOutside: (event) { setState(() { isOpenFab = false; }); }, ), // onStretchTrigger: () async { // context.vRouter.to("/"); // }, /// headerWidget: Obx( () => HeaderWidget( ovalResimUrl: finansServis?.aktifKullanici.value?.profilResmiUrl ?? "🏠", baslik: finansServis?.aktifKullanici.value?.ismi, baslikTheme: Theme.of(context).extension()?.copyWith( textColor: Theme.of(context).extension()?.secondaryTextColor, fontWeight: FontWeight.bold, fontSize: 16, ), altBaslik: "Sisteminizdeki Hesap Türleri", altBaslikTheme: Theme.of(context).extension()?.copyWith( textColor: Theme.of(context).extension()?.tertiaryTextColor, fontWeight: FontWeight.normal, fontSize: 12, ), ovalResimTiklandi: finansServis?.profilResmiDegistir, ovalResimCiftTiklandi: finansServis?.profilResmiSil, ), ), /// golgeGoster: false, bodyColor: Colors.transparent, bodyMaxWidth: 600, body: [ SizedBox(height: 15), ///$ Container( margin: EdgeInsets.symmetric(vertical: 10), constraints: BoxConstraints(maxWidth: 400), child: Column( children: [ Row( children: [ FikoYTButton(text: "Hesap Türleri", tema: FikoYTButtonTheme(fontSize: 12)), Spacer(), FikoYTButton(text: "🧬", onPressed: () {}), ], ), Divider(height: 4), Obx(() { logic?.kayit.value; return AnimatedSwitcher( duration: const Duration(milliseconds: 500), layoutBuilder: (Widget? currentChild, List previousChildren) { return Stack( alignment: Alignment.topCenter, children: [...previousChildren, if (currentChild != null) currentChild], ); }, transitionBuilder: (Widget child, Animation animation) { return FadeTransition( opacity: animation, child: SizeTransition(sizeFactor: animation, axisAlignment: 1.0, child: Center(child: child)), ); }, // visible: logic.aktifHareket.value != null ? logic.aktifHareket.value!.altKartlar.isEmpty : false, child: (finansServis?.isar?.hesapTurus.where().countSync() ?? 0) <= 0 ? Container( // width: double.infinity, padding: const EdgeInsets.only(bottom: 20, top: 20, left: 5, right: 5), margin: EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Theme.of(context).extension()?.cardBackgroundColor, border: Border.all(color: Colors.grey.shade400), // boxShadow: [ // BoxShadow(color: Colors.teal.withOpacity(0.15), spreadRadius: -15.0, blurRadius: 12.0), // const BoxShadow(color: Colors.transparent, spreadRadius: -5.0, blurRadius: 12.0), // ], ), child: Column( children: [ const Row( mainAxisAlignment: MainAxisAlignment.center, children: [Text("🏷", style: TextStyle(fontSize: 36))], ), FikoYTButton( text: "Hesap Türü Bulunamadı", tema: Theme.of(context).extension()?.copyWith( textColor: Theme.of(context).extension()?.errorTextColor, textStrokeColor: Colors.white, fontSize: 16, ), ), /** */ // hesapTuruEkleBolumu(context), ], ), ) : Builder( builder: (context) { List snapshot = finansServis?.isar?.hesapTurus.where().findAllSync() ?? []; return Column( children: [ snapshot.isNotEmpty ? ListView.builder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: finansServis?.isar?.hesapTurus.where().countSync() ?? 0, itemBuilder: (context, index) { return hesapTuruItem(snapshot, index, context); // FikoYTButton( // text: // "${snapshot[index].kod} ${snapshot[index].ismi} ${snapshot[index].sembol} -> ${snapshot[index].oran}", // ); }, ) : SizedBox.shrink(), /** */ // hesapTuruEkleBolumu(context), ], ); }, ), ); }), ], ), ), ], ); } hesapTuruItem(List snapshot, int index, BuildContext context) { return finansServis?.animasyonluWidgetAc( ozelId: "YeniHesapTürüItem${snapshot[index].ismi}${snapshot[index].id}", mevcutWidget: (context, action) => Container( padding: EdgeInsets.all(3), child: ListTileTheme( contentPadding: EdgeInsets.zero, dense: true, horizontalTitleGap: 0, minVerticalPadding: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)), child: ListTile( leading: FikoYTButton(text: "${snapshot[index].emoji}", tema: FikoYTButtonTheme(fontSize: 20)), title: FikoYTButton(text: "${snapshot[index].ismi}"), trailing: FikoYTButton(text: snapshot[index].anaParaBirimi.value?.kod ?? ''), tileColor: Theme.of(context).extension()?.cardBackgroundColor, isThreeLine: false, subtitle: FikoYTButton( text: snapshot[index].aciklama ?? 'Açıklama Yok', tema: FikoYTButtonTheme(fontWeight: FontWeight.w200, fontSize: 12), ), ), ), ), acilacakWidget: (context, action) => SayfaHesapTuru(animClose: action, kyt: snapshot[index].obs), ); } hesapTuruEkleBolumu(BuildContext context, {Rx? kyt}) { return finansServis?.animasyonluWidgetAc( ozelId: "YeniHesapTürüEkle", mevcutWidget: (context, action) => FikoYTButton( text: 'Yeni Hesap Türü', tema: Theme.of(context).extension()?.copyWith( textAlign: TextAlign.center, textStrokeColor: Colors.transparent, textColor: Theme.of(context).extension()?.infoTextColor, // textShadow: [], edgePadding: EdgeInsets.symmetric(horizontal: 15), ), // onPressed: () { // // dialogHesapTuruEkleGoster(context); // }, ), acilacakWidget: (context, action) { return SayfaHesapTuru(animClose: action); }, ); } }