import 'dart:async'; import 'package:fikoyt_mesaici/core/Extensions/fiko_double_ext.dart'; import 'package:fikoyt_ui/fikoyt_ui.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?.odenecekUcret ?? 0.0; fazlaMesaiUcreti$.value = widget.kayit?.value?.netFazlaMesai ?? 0.0; toplamNetUcretler$.value = widget.kayit?.value?.netEkUcretler ?? 0.0; // toplamKesinti$.value = widget.kayit?.value?.hesaplamalar.toplamKesinti ?? 0.0; timer$ = Timer.periodic( const Duration(seconds: 1), (timer) async { // await widget.kayit?.value?.hesapla(); normalNetMaas$.value = widget.kayit?.value?.odenecekUcret ?? 0.0; fazlaMesaiUcreti$.value = widget.kayit?.value?.netFazlaMesai ?? 0.0; toplamNetEkUcretler$.value = widget.kayit?.value?.netEkUcretler ?? 0.0; toplamNetUcretler$.value = widget.kayit?.value?.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( () => AnimatedNumberFikoYTButton1( text: normalNetMaas$.value, textBuilder: (tweenValue) => tweenValue.toParaBirimi(), tema: FikoYTButtonTheme( fontSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backgroundColor: Colors.grey.shade200, ), onPressed: () {}, ), ), ), Expanded( child: Obx( () => AnimatedNumberFikoYTButton1( text: fazlaMesaiUcreti$.value, textBuilder: (tweenValue) => tweenValue.toParaBirimi(), tema: FikoYTButtonTheme( fontSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backgroundColor: Colors.grey.shade200, ), onPressed: () {}, ), ), ), Expanded( child: Obx( () => AnimatedNumberFikoYTButton1( text: toplamNetEkUcretler$.value, textBuilder: (tweenValue) => tweenValue.toParaBirimi(), tema: FikoYTButtonTheme( fontSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backgroundColor: Colors.grey.shade200, ), onPressed: () {}, ), ), ), ], ), /** */ Obx( () => Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: AnimatedNumberFikoYTButton1( text: normalNetMaas$.value, textBuilder: (tweenValue) => "Ödenecek Tutar -> ${tweenValue.toParaBirimi()}", tema: FikoYTButtonTheme( fontSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.blueAccent, textStrokeColor: Colors.transparent, radius: 0, backgroundColor: Colors.yellow.shade100, ), onPressed: () {}, ), ), ], ), ), ], ); } }