import 'dart:async'; import 'package:fikoyt_mesaici/apps/mesaici/widgets/aktif_kart/kumulatif_satir.dart'; import 'package:fikoyt_mesaici/core/Extensions/fiko_double_ext.dart'; import 'package:fikoyt_mesaici/core/widgets/fiko_ui/fiko_button/fiko_button.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../model/calisma_kayit/calisma_kayit.dart'; class NetMaasTablosu extends StatefulWidget { NetMaasTablosu({super.key, required this.kayit}); final Rx? kayit; @override State createState() => _NetMaasTablosuState(); } class _NetMaasTablosuState extends State { Rx normalNetMaas$ = Rx(0.0); Rx fazlaMesaiUcreti$ = Rx(0.0); Rx toplamNetEkUcretler$ = Rx(0.0); Rx toplamNetUcretler$ = Rx(0.0); Rx toplamKesinti$ = Rx(0.0); late Timer timer$; @override void initState() { normalNetMaas$.value = widget.kayit?.value?.hesaplamalar.odenecekUcret ?? 0.0; fazlaMesaiUcreti$.value = widget.kayit?.value?.netFazlaMesai ?? 0.0; toplamNetUcretler$.value = widget.kayit?.value?.hesaplamalar.netNormalUcret ?? 0.0; toplamKesinti$.value = widget.kayit?.value?.hesaplamalar.toplamKesinti ?? 0.0; timer$ = Timer.periodic( const Duration(seconds: 1), (timer) async { await widget.kayit?.value?.hesaplamalar.hesapla(); normalNetMaas$.value = widget.kayit?.value?.hesaplamalar.odenecekUcret ?? 0.0; fazlaMesaiUcreti$.value = widget.kayit?.value?.netFazlaMesai ?? 0.0; toplamNetEkUcretler$.value = widget.kayit?.value?.netEkUcretler ?? 0.0; toplamNetUcretler$.value = widget.kayit?.value?.hesaplamalar.odenecekUcret ?? 0.0; toplamKesinti$.value = widget.kayit?.value?.hesaplamalar.toplamKesinti ?? 0.0; }, ); super.initState(); } @override void dispose() { timer$.cancel(); super.dispose(); } @override Widget build(BuildContext context) { return Column( children: [ Row( children: [ Expanded( child: Container( alignment: Alignment.center, decoration: BoxDecoration( color: Colors.blue.shade400, ), child: const Text( "Net Maaş", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), ), ), Expanded( child: Container( alignment: Alignment.center, decoration: BoxDecoration( color: Colors.blue.shade400, ), child: const Text( "Net F. Mesai", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), ), ), Expanded( child: Container( alignment: Alignment.center, decoration: BoxDecoration( color: Colors.blue.shade400, ), child: const Text( "Net Ek Ücret", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), ), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: Obx( () => AnimatedNumberFikoButton1( text: normalNetMaas$.value, textBuilder: (tweenValue) => tweenValue.toParaBirimi(), textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () {}, ), ), ), Expanded( child: Obx( () => AnimatedNumberFikoButton1( text: fazlaMesaiUcreti$.value, textBuilder: (tweenValue) => tweenValue.toParaBirimi(), textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () {}, ), ), ), Expanded( child: Obx( () => AnimatedNumberFikoButton1( text: toplamNetEkUcretler$.value, textBuilder: (tweenValue) => tweenValue.toParaBirimi(), textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () {}, ), ), ), ], ), /** */ Obx( () => Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: AnimatedNumberFikoButton1( text: normalNetMaas$.value, textBuilder: (tweenValue) => "Ödenecek Tutar -> ${tweenValue.toParaBirimi()}", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.blueAccent, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.yellow.shade100, onPressed: () {}, ), ), ], ), ), ], ); } }