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/hareketler/hareket-ekle/hareket-ekle.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/hesaplar/__atik__/hesap-duzenle/_hesap-duzenle.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'; 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; @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: TapRegion( child: AnimatedContainer( alignment: Alignment.center, width: isOpenFab ? 150 : 60, height: isOpenFab ? 140 : 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, ), ) : TusYayilmasiEngelleWidget( shouldBlockKey: (event) { if (event.logicalKey == LogicalKeyboardKey.goBack || event.logicalKey == LogicalKeyboardKey.abort || event.logicalKey == LogicalKeyboardKey.cancel || event.logicalKey == LogicalKeyboardKey.browserBack) { Future.delayed(50.ms, () { setState(() { isOpenFab = false; }); }); return true; } return false; }, child: ListView( physics: BouncingScrollPhysics(), children: [ finansServis?.animasyonluWidgetAc( ozelId: "HesapFab-Gelir-Ekle", routeSettings: RouteSettings(name: "/uye/hareketler/ekle"), mevcutWidget: (context, action) => FikoYTButton( text: "➕ Gelir Ekle", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, edgePadding: EdgeInsets.symmetric(horizontal: 5, vertical: 10), ), ), acilacakWidget: (context, action) => SayfaHareketEkle(animClose: action), ), finansServis?.animasyonluWidgetAc( ozelId: "HesapFab-Gider-Ekle", routeSettings: RouteSettings(name: "/uye/hareketler/ekle"), mevcutWidget: (context, action) => FikoYTButton( text: "➖ Gider Ekle", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, edgePadding: EdgeInsets.symmetric(horizontal: 5, vertical: 10), ), ), acilacakWidget: (context, action) => SayfaHareketEkle(animClose: action), ), finansServis?.animasyonluWidgetAc( ozelId: "HesapFab-Transfer-Ekle", routeSettings: RouteSettings(name: "/uye/hareketler/ekle"), mevcutWidget: (context, action) => FikoYTButton( text: "🎗 Transfer Ekle", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, edgePadding: EdgeInsets.symmetric(horizontal: 5, vertical: 10), ), ), acilacakWidget: (context, action) => SayfaHareketEkle(animClose: action), ), finansServis?.animasyonluWidgetAc( ozelId: "HesapFab-Şablondan-Ekle", routeSettings: RouteSettings(name: "/uye/hareketler/ekle"), mevcutWidget: (context, action) => FikoYTButton( text: "🎫 Şablondan Ekle", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, edgePadding: EdgeInsets.symmetric(horizontal: 5, vertical: 10), ), ), acilacakWidget: (context, action) => SayfaHareketEkle(animClose: action), ), ], ), ), ), // AnimatedCrossFade( // firstChild: FikoYTButton( // text: "+", // tema: FikoYTButtonTheme( // textColor: Colors.white, // // fontWeight: FontWeight.w700, // edgePadding: EdgeInsets.all(3), // // borderColor: Colors.blueAccent, // elevation: 3, // fontSize: 36, // ), // ), // secondChild: SizedBox.shrink(), // crossFadeState: widget.isOpenFab ? CrossFadeState.showSecond : CrossFadeState.showFirst, // duration: finansServis?.openContainerDuration ?? Duration.zero, // ), ), onTapInside: (v) { setState(() { isOpenFab = true; }); // if (!isOpen) { // setState(() { // width = 200; // height = 200; // left = 60; // bottom = 60; // isOpen = !isOpen; // }); // } }, onTapOutside: (event) { setState(() { isOpenFab = false; }); }, ), 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, ), ).animate(effects: [MoveEffect(begin: Offset(150, 0), duration: Duration(milliseconds: 750))]), ], ), // ovalResimTiklandi: finansServis?.profilResmiDegistir, ), ), headerBottomBar: Container( color: Theme.of(context).extension()?.cardBackgroundColor?.withAlpha(200), child: Row( children: [ Obx( () => FikoYTButton( text: "${hesap.value?.paraBirimi.value?.sembol ?? ""} ${hesap.value?.paraBirimi.value?.ismi ?? ""} ${hesap.value?.paraBirimi.value?.kod ?? ""}", tema: Theme.of(context).extension()?.copyWith( textColor: Theme.of(context).extension()?.tertiaryTextColor, ), onPressed: () {}, ), ), 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) => SayfaHesapDuzenle(hesapId: widget.hesapId), ), ], ), ), /// 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: 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: action, 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), ), ], ), ), ), ), acilacakWidget: (context, action) => Scaffold( body: Container(), ).animate(effects: [FadeEffect(begin: 0, end: 1, delay: Duration(milliseconds: (index) * 50 + 250))]), ); }) .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(), ); } }