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/widgets/akcali-ui/mini-hesap-kart.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/hesaplar/_hesaplar-logic.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/hesaplar/hesap/pages/hesap-ekle.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/hesaplar/hesap/pages/hesap.dart'; import 'package:fikoyt_ui/fikoyt_ui.dart'; import 'package:flutter/material.dart'; import 'package:isar/isar.dart'; class HesapListesiWidget extends StatefulWidget { const HesapListesiWidget({super.key}); @override State createState() => _HesapListesiWidgetState(); } class _HesapListesiWidgetState extends State { FinansServis? finansServis = FikoYTCoreService.servisler.getServis(); HesapService hesaplarServis = Get.put(HesapService()); @override void initState() { // TODO: implement initState super.initState(); } @override Widget build(BuildContext context) { return Column( children: [ /** */ Container( decoration: BoxDecoration( color: Theme.of(context).extension()?.cardBackgroundColor, borderRadius: BorderRadius.circular(0), border: Border.all(color: Colors.grey.shade400), ), padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), margin: EdgeInsets.symmetric(vertical: 0, horizontal: 0), child: Row( children: [ Obx( () => FikoYTButton(text: "Hesaplarınız ${hesaplarServis.veriSayisi.value}", tema: FikoYTButtonTheme(fontSize: 12)), ), Spacer(), // FikoYTButton( // text: "➜", // onPressed: () { // // hesaplarServis?.guncelle.refresh(); // }, // ), finansServis?.animasyonluWidgetAc( routeSettings: RouteSettings(name: "/uye/akcali/kategoriler", arguments: null), mevcutWidget: (context, action) { // girisAction = action; return FikoYTButton( text: "+", tema: FikoYTButtonTheme( fontSize: 18, fontWeight: FontWeight.bold, edgePadding: EdgeInsets.symmetric(horizontal: 3, vertical: 3), ), ); }, acilacakWidget: (context, action) { return SayfaHesapEkle(animClose: action); }, ), ], ), ), // Container( // margin: EdgeInsets.symmetric(vertical: 10), // child: Row( // children: [ // FikoYTButton(text: "Hesaplarınız", tema: FikoYTButtonTheme(fontSize: 12)), // const Spacer(), // FikoYTButton( // text: "➜", // onPressed: () { // hesaplarServis?.guncelle.refresh(); // }, // ), // ], // ), // ), /// // if ((finansServis?.isar?.hesaps.countSync() ?? 0) > 0) SizedBox(height: 5), Obx(() { hesaplarServis.liste.value; finansServis?.aktifKullanici.value; finansServis?.hesaplarServis.hesaplar.value; finansServis?.hesaplarServis.guncelle.value; return Column( children: [ Visibility( visible: hesaplarServis.liste.isEmpty, child: 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), ), child: Column( children: [ const Row( mainAxisAlignment: MainAxisAlignment.center, children: [Text("💸", style: TextStyle(fontSize: 48))], ), FikoYTButton( text: "Hiç Hesabınız Yok", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.black, textStrokeColor: Colors.white, fontSize: 20, ), ), Wrap( alignment: WrapAlignment.center, crossAxisAlignment: WrapCrossAlignment.center, children: [ Align( alignment: Alignment.center, child: finansServis?.animasyonluWidgetAc( ozelId: "AnaSayfaFab-HesapEkle-1", routeSettings: RouteSettings(name: "/uye/akcali/hesap-turleri", arguments: null), mevcutWidget: (context, action) { return FikoYTButton( text: "💳 Hesap Ekle", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, edgePadding: EdgeInsets.symmetric(horizontal: 1, vertical: 3), fontWeight: FontWeight.bold, textShadow: List.empty(), fontSize: 14, textColor: Colors.blue, ), ); }, acilacakWidget: (context, action) { return SayfaHesapEkle(animClose: action); }, onClosed: (p0) { finansServis?.hesaplarServis.guncelle.refresh(); }, ), // TextButton( // // icon: const Text("💡"), // child: const Text( // "💡 Şimdi Ekle", // style: TextStyle(color: Colors.blue, fontWeight: FontWeight.bold, fontSize: 14), // ), // onPressed: () async { // dialogHesapEkle(context); // }, // ), ), ], ), ], ), ), ), /// Visibility( visible: hesaplarServis.liste.isNotEmpty, child: Wrap( spacing: 2, runSpacing: 2, children: (hesaplarServis.liste) .asMap() .entries .map((entry) { int index = entry.key; var hesap = entry.value; return // MiniHesapKart( // baslik: hesap.ismi, // simge: hesap.simgesi, // solUstWidget: Text(hesap.hesapTipi.emoji) , // altBaslik: "0 ${hesap.paraBirimi.value?.kod ?? ''}", // sagUstBaslik: hesap.paraBirimi.value?.sembol, // onPressed: () { // context.vRouter.to("/uye/hesaplar/hesap/${hesap.id}"); // }, // ) finansServis?.animasyonluWidgetAc( ozelId: "mini-hesapkart-${hesap.id}", routeSettings: RouteSettings( name: "/uye/hesaplar/hesap/:hesapId", arguments: {"hesapId": hesap.id.toString()}, ), mevcutWidget: (context, action) => MiniHesapKart( baslik: hesap.ismi, simge: hesap.simgesi, renk: hesap.rengi, solUstWidget: Text(hesap.hesapTipi.emoji), altBaslik: "0 ${hesap.paraBirimi.value?.kod ?? ''}", sagUstBaslik: hesap.paraBirimi.value?.sembol, onPressed: action, ), acilacakWidget: (context, action) => SayfaHesap(hesapId: hesap.id.toString()), onClosed: (p0) async { // hesaplarServis?.guncelle.refresh(); await hesaplarServis.listeyiYenile(); }, ); }) .toList() .cast(), ), ), SizedBox(height: 5), Row( children: [ Column( children: [ FikoYTButton( text: "Daha Az", tema: FikoYTButtonTheme(textColor: Theme.of(context).extension()?.infoTextColor, fontSize: 14), onPressed: () async { await hesaplarServis.dahaAz(); }, ), ], ), Spacer(), // Visibility( // visible: (hesaplarServis?.limit.value ?? 0) > (hesaplarServis?.sayi.value ?? 3), // child: Column( children: [ FikoYTButton( text: "Sıfırla", tema: FikoYTButtonTheme(textColor: Theme.of(context).extension()?.infoTextColor, fontSize: 14), onPressed: () { hesaplarServis.dahaSifirla(); }, ), ], ), // ), // if (((hesaplarServis?.limit.value ?? 0) < // (finansServis?.aktifKullanici.value?.hesaplar.filter().countSync() ?? 0))) Spacer(), Column( children: [ FikoYTButton( text: "Daha Fazla", tema: FikoYTButtonTheme(textColor: Theme.of(context).extension()?.infoTextColor, fontSize: 14), onPressed: () async { await hesaplarServis.dahaFazla(); }, ), ], ), ], ), ], ); }), /// const SizedBox(height: 5), ], ); } } ///