import 'dart:ui'; import 'package:animations/animations.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/kisi/pages/ana-sayfa/hesap_ekle_dialog_widget.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/hesaplar/_hesaplar-logic.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/hesaplar/hesap/hesap.dart'; import 'package:fikoyt_ui/fikoyt_ui.dart'; import 'package:flutter/material.dart'; import 'package:isar/isar.dart'; class HesapListesiWidget extends StatelessWidget { HesapListesiWidget({super.key}); FinansServis? finansServis; HesaplarService? hesaplarServis; @override StatelessElement createElement() { // TODO: implement createElement finansServis = FikoYTCoreService.servisler.getServis(); hesaplarServis = Get.put(HesaplarService()); return super.createElement(); } @override Widget build(BuildContext context) { return Column( children: [ Container( margin: EdgeInsets.symmetric(vertical: 10), child: Row( children: [ FikoYTButton(text: "Hesaplarınız", tema: FikoYTButtonTheme(fontSize: 12)), Spacer(), FikoYTButton( text: "➜", onPressed: () { hesaplarServis?.guncelle.refresh(); }, ), ], ), ), /// // if ((finansServis?.isar?.hesaps.countSync() ?? 0) > 0) Obx(() { hesaplarServis?.guncelle.value; return FutureBuilder( future: finansServis?.aktifKullanici.value?.hesaplar .filter() .offset(0) .limit(hesaplarServis?.limit.value ?? 99999999) .findAll(), //,hesaplarServis?.listeAl(0, 1000), builder: (context, snapshot) { return Column( children: [ Visibility( visible: snapshot.data?.isEmpty ?? true, 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: Colors.transparent, 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: 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: 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: snapshot.hasData, child: Wrap( spacing: 2, runSpacing: 2, children: (snapshot.data ?? []) .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}"); // }, // ) OpenContainer( closedColor: Colors.transparent, closedElevation: 0, middleColor: Colors.transparent, openElevation: 0, transitionDuration: Duration(milliseconds: 750), closedBuilder: (context, action) => FikoYTButton( text: "🖋", tema: Theme.of( context, ).extension()?.copyWith(edgePadding: EdgeInsets.all(5)), onPressed: action, ), openBuilder: (context, action) => SayfaHesap(hesapId: hesap.id.toString(), ).animate( effects: [FadeEffect(begin: 0, end: 1, delay: Duration(milliseconds: (index) * 50 + 250))], ); }) .toList() .cast(), ), ), SizedBox(height: 5), Row( children: [ Visibility( visible: (hesaplarServis?.limit.value ?? 0) > (hesaplarServis?.sayi.value ?? 3), child: Column( children: [ FikoYTButton( text: "Daha Az", tema: FikoYTButtonTheme( textColor: Theme.of(context).extension()?.infoTextColor, fontSize: 14, ), onPressed: () { hesaplarServis?.limit.value -= hesaplarServis?.sayi.value ?? 1; hesaplarServis?.guncelle.refresh(); }, ), ], ), ), 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?.limit.value = hesaplarServis?.sayi.value ?? 1; hesaplarServis?.guncelle.refresh(); }, ), ], ), ), if (((hesaplarServis?.limit.value ?? 0) < (finansServis?.aktifKullanici.value?.hesaplar.filter().countSync() ?? 0))) Spacer(), Visibility( visible: (hesaplarServis?.limit.value ?? 0) < (finansServis?.aktifKullanici.value?.hesaplar.filter().countSync() ?? 0), child: Column( children: [ FikoYTButton( text: "Daha Fazla", tema: FikoYTButtonTheme( textColor: Theme.of(context).extension()?.infoTextColor, fontSize: 14, ), onPressed: () { hesaplarServis?.limit.value += hesaplarServis?.sayi.value ?? 1; hesaplarServis?.guncelle.refresh(); }, ), ], ), ), ], ), ], ); }, ); }), /// const SizedBox(height: 5), // if ((finansServis?.isar?.hesaps.countSync() ?? 0) > 0) Align( alignment: Alignment.centerRight, child: SizedBox( // width: 130, child: FikoYTButton( text: "🎫 Hesap Ekle", tema: FikoYTButtonTheme( fontSize: 10, textColor: Colors.blueAccent, textStrokeColor: Colors.transparent, backgroundColor: Colors.white.withValues(alpha: 180), borderColor: Colors.lightBlueAccent, edgePadding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10), textStrokeWidth: 0, textAlign: TextAlign.center, ), onPressed: () { dialogHesapEkle(context); }, ), ), ), ], ); } Future dialogHesapEkle(BuildContext context) { return showModalBottomSheet( context: context, showDragHandle: true, isScrollControlled: true, constraints: BoxConstraints(maxHeight: 560, maxWidth: 420), // backgroundColor: Colors.white.withAlpha(230), elevation: 5, useSafeArea: true, builder: (BuildContext context) { return GestureDetector( behavior: HitTestBehavior.opaque, child: BackdropFilter(filter: ImageFilter.blur(sigmaX: 1, sigmaY: 1), child: HesapEkleDialogWidget()), ); }, ); } } ///