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/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/widgets/hesap.fab.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:flutter/material.dart'; import 'package:flutter/scheduler.dart'; class SayfaHesap extends StatefulWidget { SayfaHesap({super.key, required this.hesapId}); String? hesapId; @override State createState() => _SayfaHesapState(); } class _SayfaHesapState extends State { FinansServis? finansServis = FikoYTCoreService.servisler.getServis(); HesaplarService? logicHesaplar; Rx hesap = Rx(null); Rx hesaplama = Rx(""); bool isOpenFab = false; final fabPageViewController = PageController(viewportFraction: 1, keepPage: true); @override void initState() { super.initState(); // finansServis = FikoYTCoreService.servisler.getServis(); logicHesaplar = Get.put(HesaplarService()); SchedulerBinding.instance.addPostFrameCallback((_) { // logic.gun.value = widget.gun; hesap.value = logicHesaplar?.hesapByIdSync(int.tryParse(widget.hesapId ?? "-1") ?? -1); // await logic.alHareketler(); // await logic.alAltHareketler(); // logic.gun.refresh(); finansServis?.altBaslik.value = "Hesap Yönetimi"; finansServis?.solMenuAl(context); }); } @override void dispose() { // Get.delete(); super.dispose(); } @override Widget build(BuildContext context) { return FikoYTSliverApp( leading: UygulamaBaslikSol(), title: UygulamaBaslikOrta(), actions: [UygulamaBaslikSag()], drawer: finansServis?.solMenu.value, backgroundColor: Theme.of(context).extension()?.backgroundColor, appBarColor: Theme.of(context).extension()?.appBarColor?.withAlpha(230), headerExpandedHeight: 250, // stretchMaxHeight: 100, fullyStretchable: true, centerTitle: true, alwaysShowLeadingAndAction: true, alwaysShowTitle: true, curvedBodyRadius: 0, // onStretchTrigger: () async { // context.vRouter.to("/"); // }, /// floatingActionButton: HesapFab(), headerWidget: Obx( () => HeaderWidget( ovalResimUrl: hesap.value?.simgesi ?? "💳", baslik: hesap.value?.ismi ?? "İsimsiz Hesap", baslikTheme: Theme.of(context).extension()?.copyWith( textColor: Theme.of(context).extension()?.secondaryTextColor, fontWeight: FontWeight.bold, fontSize: 16, ), altBaslik: hesap.value?.aciklama ?? "${hesap.value?.ismi != null ? '${hesap.value?.ismi} İsimli' : 'İsim Verilmemiş'} Finansal Hesabınızı Yönetin", altBaslikTheme: Theme.of(context).extension()?.copyWith( textColor: Theme.of(context).extension()?.tertiaryTextColor, fontWeight: FontWeight.normal, fontSize: 12, ), ustKisim: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Spacer(), FikoYTButton( text: "${hesap.value?.hesapTipi.emoji ?? ''}${hesap.value?.hesapTipi.isim ?? ''}", tema: Theme.of(context).extension()?.copyWith( textColor: Theme.of(context).extension()?.secondaryTextColor, fontWeight: FontWeight.normal, textShadow: [], fontSize: 12, ), ), ], ), // ovalResimTiklandi: finansServis?.profilResmiDegistir, ), ), headerBottomBar: Container( color: Theme.of(context).extension()?.cardBackgroundColor?.withAlpha(200), child: Row( children: [ FikoYTButton( text: "🗑", tema: Theme.of(context).extension()?.copyWith(edgePadding: EdgeInsets.all(5)), onPressed: () async { AwesomeDialog( context: context, dialogType: DialogType.question, animType: AnimType.scale, headerAnimationLoop: false, title: 'Silme Onayı', titleTextStyle: TextStyle(color: Theme.of(context).extension()?.infoTextColor, fontSize: 16), desc: '${hesap.value!.ismi ?? ""} Hesabı Silinecek. Onaylıyormusunuz?', btnCancelOnPress: () { // context.vRouter.pop(); }, btnCancelColor: Colors.green, btnCancelText: "İptal", btnOkOnPress: () async { await logicHesaplar?.isar?.writeTxn(() async { await logicHesaplar?.hesapSilById(hesap.value!.id); /// Başarılı toastification.show( context: FikoYTCoreService.navigatorKey.currentContext, type: ToastificationType.warning, style: ToastificationStyle.fillColored, // title: Text("FikoYT Sistem"), description: Text("${hesap.value!.ismi ?? ""} Hesabı Silindi."), alignment: Alignment.topRight, autoCloseDuration: const Duration(seconds: 4), borderRadius: BorderRadius.circular(4.0), boxShadow: lowModeShadow, showProgressBar: false, dragToClose: true, applyBlurEffect: true, ); // widget.animClose != null ? widget.animClose!() : null; Navigator.pop(context); }); }, btnOkColor: Colors.red, btnOkText: "Sil", ).show(); }, ), Spacer(), finansServis?.animasyonluWidgetAc( routeSettings: RouteSettings( name: "/uye/hesaplar/hesap/:hesapId/duzenle", arguments: {"hesapId": widget.hesapId.toString()}, ), mevcutWidget: (context, action) => FikoYTButton( text: "🖋", tema: Theme.of(context).extension()?.copyWith(edgePadding: EdgeInsets.all(5)), onPressed: action, // () { // context.vRouter.to("/uye/hesaplar/hesap/${widget.hesapId}/duzenle"); // }, ), acilacakWidget: (context, action) => SayfaHesapEkle(kyt: hesap.value!.obs, animClose: action), onClosed: (p0) { hesap.value = logicHesaplar?.hesapByIdSync(int.tryParse(widget.hesapId ?? "-1") ?? -1); hesap.refresh(); }, ), ], ), ), /// golgeGoster: false, bodyColor: Colors.transparent, bodyMaxWidth: 400, body: [ SizedBox(height: 15), /** */ Container( margin: EdgeInsets.symmetric(vertical: 10), child: Row( children: [ FikoYTButton(text: "Hesap Hareketleri", tema: FikoYTButtonTheme(fontSize: 12)), Spacer(), FikoYTButton( text: "➜", onPressed: () { // hesaplarServis?.guncelle.refresh(); }, ), ], ), ), ...[1, 2, 3, 4, 5, 6] .asMap() .entries .map((entry) { int index = entry.key; return finansServis?.animasyonluWidgetAc( ozelId: "RotaWidgetAbur.$index", mevcutWidget: (context, action) => Container( padding: EdgeInsets.all(1), child: ListTileTheme( contentPadding: EdgeInsets.all(2), dense: true, horizontalTitleGap: 0, minVerticalPadding: 5, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0)), child: HareketlerItem(animClose: action), ), ), acilacakWidget: (context, action) => Scaffold(body: Container()), ); }) .toList() .cast(), // FikoYTCard( // theme: (Theme.of(context).extension() ?? FikoYTCardTheme()).copyWith( // // boxConstraints: BoxConstraints(maxWidth: 350), // ), // children: [ // Center( // child: FikoYTButton( // text: 'Ana Para Birimi', // tema: Theme.of(context).extension()?.copyWith( // textAlign: TextAlign.center, // textStrokeColor: Colors.transparent, // textColor: Theme.of(context).extension()?.secondaryTextColor, // // textShadow: Theme.of(context).extension()?.textShadow, // ), // ), // ), // Divider(height: 4), // Center( // child: Obx( // () => Text( // hesap.value?.ismi ?? "Alınamadı", // style: TextStyle(fontSize: 36, color: Theme.of(context).extension()?.secondaryTextColor), // ), // ), // ), // // SizedBox(height: 1400), // ], // ), ], sliverAltKisim: SizedBox.shrink(), ); } } class HareketlerItem extends StatelessWidget { const HareketlerItem({super.key, this.animClose}); Function()? animClose; @override Widget build(BuildContext context) { return ListTile( leading: FikoYTButton(text: "🛹", tema: FikoYTButtonTheme(fontSize: 18)), title: Row( children: [ FikoYTButton(text: "Aburrr Cuburrr", tema: FikoYTButtonTheme(fontSize: 12)), Spacer(), FikoYTButton( text: "-50₺", tema: FikoYTButtonTheme(textColor: Theme.of(context).extension()?.errorTextColor, fontSize: 12), ), ], ), tileColor: Theme.of(context).extension()?.cardBackgroundColor, isThreeLine: false, onTap: animClose, subtitle: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ FikoYTButton(text: 'Finansbank Hesabı', tema: FikoYTButtonTheme(fontWeight: FontWeight.w200, fontSize: 10)), Spacer(), FikoYTButton(text: "16.02.2025", tema: FikoYTButtonTheme(fontWeight: FontWeight.w200, fontSize: 10)), ], ), FikoYTButton(text: 'Açıklama Yok', tema: FikoYTButtonTheme(fontWeight: FontWeight.w200, fontSize: 11)), ], ), ); } }