import 'package:fikoyt_mesaici/apps/mesaici/base_page_mesaici_view.dart'; import 'package:fikoyt_mesaici/apps/mesaici/model/ayarlar/model_ayarlar.dart'; import 'package:fikoyt_mesaici/apps/mesaici/pages/ayarlar/maas_parametreleri/vergi_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'; class VergilerWidget extends StatelessWidget { VergilerWidget({super.key, required this.maasObs}); BasePageMesaiciLogic basePageMesaiciLogic = Get.put(BasePageMesaiciLogic()); final FikoYTMesaiciService servisMesaici = Get.put(FikoYTMesaiciService()); final FikoYTService servisFikoYT = FikoYTService(); Rx maasObs; @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Expanded( child: Divider( indent: 20.0, endIndent: 10.0, thickness: 1, ), ), const Text( 'Vergiler', style: TextStyle( fontWeight: FontWeight.bold, ), ), const Expanded( child: Divider( indent: 10.0, endIndent: 20.0, thickness: 1, ), ), SizedBox( width: 33, 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 { Vergi ksnt = Vergi(); FikoYTService.dialogGoster( context, SizedBox( width: 250, child: VergiEkle( vergi: ksnt, ), ), FikoDialogAyarlari(baslik: "Vergi Tanımlama", baslikSimge: "🧾", altButonlar: [ AnimatedFikoButton1( textColor: Colors.green, textStrokeColor: Colors.transparent, text: "Ekle", edgePadding: const EdgeInsets.symmetric(horizontal: 5, vertical: 0), onPressed: (() { List ksntlr = maasObs.value.vergiler?.toList() ?? []; ksntlr.add(ksnt); maasObs.value.vergiler = ksntlr; servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }), ), const Spacer(), AnimatedFikoButton1( 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), ), ), ], ), /** */ // if ((maasObs.value.kesintiler ?? []).isEmpty) AnimatedCrossFade( crossFadeState: (maasObs.value.vergiler ?? []).isEmpty ? CrossFadeState.showFirst : CrossFadeState.showSecond, duration: const Duration(milliseconds: 250), firstChild: Padding( padding: const EdgeInsets.only(top: 30.0), child: Stack( children: [ Card( child: Container( height: 100.0, ), ), const FractionalTranslation( translation: Offset(0.0, -0.4), child: Align( alignment: FractionalOffset(0.5, 0.0), child: CircleAvatar( // backgroundColor: Colors.redAccent.shade200, radius: 25.0, child: Text( "🧾", style: TextStyle(fontSize: 36), ), ), ), ), Padding( padding: const EdgeInsets.only(top: 48), child: Align( alignment: const FractionalOffset(0.5, 0.5), child: Text( "Hiç Vergi Eklenmemiş", style: TextStyle(fontSize: 14, fontWeight: FontWeight.normal, color: Colors.blueAccent.shade400), textAlign: TextAlign.center, ), ), ), ], ), ), secondChild: Column( spacing: 5.0, children: [ for (var i = 0; i < (maasObs.value.vergiler ?? []).length; i++) Obx( () { Vergi vrgi_ = maasObs.value.vergiler![i]; return AnimatedFikoButton1( text: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "${vrgi_.turu.simge} ${(vrgi_.ismi ?? 'İsim Verilmemiş')}", ), const Spacer(), if (vrgi_.vergiSekli == VergiSekli.SABIT) Row( children: [ AnimatedFikoButton1( textColor: Colors.white, textStrokeColor: Colors.black, text: "${vrgi_.miktar ?? '0.0'}", ), AnimatedFikoButton1( textColor: Colors.amber, textStrokeColor: Colors.blue, text: "TL", ), ], ), if (vrgi_.vergiSekli == VergiSekli.YUZDELIK) Row( children: [ AnimatedFikoButton1( textColor: Colors.white, textStrokeColor: Colors.black, text: "${vrgi_.oran ?? '0.0'}", ), AnimatedFikoButton1( textColor: Colors.amber, textStrokeColor: Colors.blue, text: "%", ), ], ), if (vrgi_.vergiSekli == VergiSekli.DIGER) Row( children: [ AnimatedFikoButton1( textColor: Colors.white, textStrokeColor: Colors.black, text: "${vrgi_.oran ?? '0.0'}% | ${vrgi_.miktar ?? '0.0'} 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: VergiEkle( vergi: vrgi_, ), ), FikoDialogAyarlari(baslik: "Vergi Düzenle", baslikSimge: "🧾", altButonlar: [ AnimatedFikoButton1( textColor: Colors.red, textStrokeColor: Colors.transparent, text: "Sil", onPressed: () { List? list0 = maasObs.value.vergiler?.toList() ?? []; list0.removeAt(i); maasObs.value.vergiler = list0; servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }, ), const Spacer(), AnimatedFikoButton1( textColor: Colors.green, textStrokeColor: Colors.transparent, text: "Kapat", onPressed: (() { servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }), ), ]), ); }, ).animate( effects: [const FadeEffect(), ShimmerEffect(delay: 1000.ms)], ); }, ), ], ), ), ], ); } }