import 'package:fikoyt_mesaici/apps/mesaici/model/ayarlar/model_ayarlar.dart'; import 'package:fikoyt_mesaici/apps/mesaici/pages/ayarlar/maas_parametreleri/ek_odeme_ekle.dart'; import 'package:fikoyt_mesaici/apps/mesaici/servisler/fikoyt.mesaici.service.dart'; import 'package:fikoyt_mesaici/core/fikoyt.service.dart'; import 'package:fikoyt_mesaici/core/interface/fiko_dialog_ayarlari.dart'; import 'package:fikoyt_mesaici/core/widgets/fiko_ui/fiko_button/fiko_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_animate/flutter_animate.dart'; import 'package:get/get.dart'; import '../../model/calisma_kayit/calisma_kayit.dart'; class EkOdemelerWidget extends StatelessWidget { EkOdemelerWidget({super.key, required this.kayit}); final Rx? kayit; FikoYTMesaiciService servisMesaici = Get.put(FikoYTMesaiciService()); FikoYTService servisFikoYT = FikoYTService(); @override Widget build(BuildContext context) { return Column( children: [ /** Ek Ödemeler */ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Expanded( child: Divider( indent: 0.0, endIndent: 10.0, thickness: 1, ), ), FikoButton1( text: '➕ Ek Ödemeler', textStrokeColor: Colors.transparent, textColor: Colors.black, ), const Expanded( child: Divider( indent: 10.0, endIndent: 0.0, thickness: 1, ), ), SizedBox( width: 24, child: MaterialButton( elevation: 0, minWidth: 0, shape: CircleBorder( // borderRadius: // const BorderRadius.all( // Radius.circular(5)), side: BorderSide(width: 1, color: Colors.blue.withOpacity(0.5), style: BorderStyle.solid), ), padding: const EdgeInsets.all(0), // color: Colors.white, onPressed: () async { EkOdeme ekOd = EkOdeme(); FikoYTService.dialogGoster( context, SizedBox( width: 250, child: EkOdemeEkle( ekOdeme: ekOd, ), ), FikoDialogAyarlari(baslik: "Ek Ödeme Tanımlama", baslikSimge: "➕", altButonlar: [ FikoButton1( textColor: Colors.green, textStrokeColor: Colors.transparent, text: "Ekle", edgePadding: const EdgeInsets.symmetric(horizontal: 5, vertical: 0), onPressed: (() { List? ekodmler = kayit?.value?.maas?.ekOdemeler?.toList() ?? []; ekodmler.add(ekOd); kayit?.value?.maas?.ekOdemeler = ekodmler; // kayit?.refresh(); servisMesaici.aktifCalisma?.refresh(); Navigator.pop( context, ); }), ), const Spacer(), FikoButton1( textColor: Colors.red, textStrokeColor: Colors.transparent, text: "Kapat", edgePadding: const EdgeInsets.symmetric(horizontal: 5, vertical: 0), onPressed: (() { Navigator.pop( context, ); }), ), ]), ); }, child: const Text( "➕", ), // const Icon(Icons.notifications, // color: Colors.lightBlue, size: 14), ), ), ], ), // (kayit?.value?.ekOdemeler ?? []).isEmpty AnimatedCrossFade( crossFadeState: (kayit?.value?.ekOdemeler ?? []).isEmpty ? CrossFadeState.showFirst : CrossFadeState.showSecond, duration: const Duration(milliseconds: 250), firstChild: Padding( padding: const EdgeInsets.only(top: 5), child: Align( alignment: const FractionalOffset(0.5, 0.5), child: Text( "Hiç Ek Ödeme Eklenmemiş", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.red.shade400), textAlign: TextAlign.center, ), ), ).animate( effects: [ const FadeEffect(), const ShimmerEffect(), ], ), secondChild: Column( spacing: 2.0, children: [ for (var i = 0; i < (kayit?.value?.ekOdemeler ?? []).length; i++) Obx( () { EkOdeme? ekOdm = kayit?.value?.ekOdemeler![i]; return FikoButton1( borderColor: Colors.grey.shade200, text: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "${ekOdm?.turu.simge} ${(ekOdm?.ismi ?? 'İsim Verilmemiş')}", ), const Spacer(), FikoButton1( textColor: Colors.white, text: "${ekOdm?.miktar ?? '0.0'}", ), FikoButton1( textColor: Colors.amber, textStrokeColor: Colors.blue, text: "TL", ), ], ), textAlign: TextAlign.start, backColor: Colors.black.withOpacity(0.0), edgePadding: const EdgeInsets.symmetric(vertical: 2, horizontal: 5), onPressed: () { FikoYTService.dialogGoster( context, SizedBox( width: 250, child: EkOdemeEkle( ekOdeme: ekOdm, ), ), FikoDialogAyarlari(baslik: "Ek Ödeme Düzenle", baslikSimge: "💎", altButonlar: [ FikoButton1( textColor: Colors.red, textStrokeColor: Colors.transparent, text: "Sil", onPressed: () { List? list0 = kayit?.value?.ekOdemeler!.toList(); list0?.removeAt(i); kayit?.value?.ekOdemeler = list0; // kayit?.refresh(); servisMesaici.aktifCalisma?.refresh(); Navigator.pop( context, ); }, ), const Spacer(), FikoButton1( textColor: Colors.green, textStrokeColor: Colors.transparent, text: "Kapat", onPressed: (() { // kayit?.refresh(); servisMesaici.aktifCalisma?.refresh(); Navigator.pop( context, ); }), ), ]), ); }, ).animate( effects: [const FadeEffect(), ShimmerEffect(delay: 1000.ms)], ); }, ), ], ), ), ], ).animate(effects: [ // FadeEffect(duration: 1000.ms, curve: Curves.easeIn), // ScaleEffect(begin: const Offset(0.2, 0.2),duration: 500.ms, curve: Curves.easeIn), FadeEffect(duration: 1000.ms), SaturateEffect(delay: 1000.ms, duration: 500.ms, curve: Curves.easeIn), BlurEffect( duration: 600.ms, begin: const Offset(3, 3), end: const Offset(0, 0), ), ShimmerEffect( delay: 1000.ms, duration: 1000.ms, curve: Curves.easeIn, ), ]); } }