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_ui/fikoyt_ui.dart'; import 'package:flutter/material.dart'; import 'package:isar/isar.dart'; class HesapTuruSecWidget extends StatelessWidget { HesapTuruSecWidget({super.key}); FinansServis? finansServis = FikoYTCoreService.servisler.getServis(); @override Widget build(BuildContext context) { 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: 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: 36))], ), FikoYTButton( text: "Hesap Türü Bulunamadı", tema: Theme.of(context).extension()?.copyWith( textColor: Theme.of(context).extension()?.errorTextColor, textStrokeColor: Colors.white, fontSize: 16, ), ), ], ), ) : 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(), /** */ ], ); }, ), ); } Container hesapTuruItem(List snapshot, int index, BuildContext context) { return Container( padding: EdgeInsets.all(0), child: ListTileTheme( contentPadding: EdgeInsets.zero, dense: true, horizontalTitleGap: 0, minVerticalPadding: 0, child: Column( children: [ ListTile( title: Text( "${snapshot[index].ismi}", style: TextStyle(color: Theme.of(context).extension()?.infoTextColor, fontSize: 14), ), subtitle: Text("Nakit Hesaplarınızı Buradan Oluşturabilirsiniz.Örneğin Cüzdan Cep, Birikim Kumbara vb."), dense: true, trailing: Text(snapshot[index].anaParaBirimi.value?.kod ?? '', style: TextStyle(fontSize: 32)), onTap: () { context.vRouter.to("/uye/hesaplar/nakit-hesap-ekle"); }, ), ListTile( leading: FikoYTButton(text: "${snapshot[index].emoji}"), title: FikoYTButton(text: "${snapshot[index].ismi}"), trailing: FikoYTButton(text: snapshot[index].anaParaBirimi.value?.kod ?? ''), tileColor: Theme.of(context).extension()?.cardBackgroundColor, isThreeLine: false, onTap: () { // dialogHesapTuruEkleGoster(context, kyt: snapshot[index].obs); }, subtitle: FikoYTButton( text: snapshot[index].aciklama ?? 'Açıklama Yok', tema: FikoYTButtonTheme(fontWeight: FontWeight.w200, fontSize: 12), ), ), Divider(height: 1, thickness: 1), ], ), ), ); } }