import 'package:fikoyt_mesaici/apps/mesaici/model/ayarlar/model_ayarlar.dart'; import 'package:fikoyt_mesaici/apps/mesaici/pages/ayarlar/resmi_tatiller/resmi_tatil_dialog.dart'; import 'package:fikoyt_mesaici/core/Extensions/fiko_tarih.dart'; import 'package:fikoyt_mesaici/core/fikoyt.service.dart'; import 'package:fikoyt_mesaici/core/interface/fiko_dialog_ayarlari.dart'; import 'package:fikoyt_ui/fikoyt_ui.dart'; import 'package:flutter/material.dart'; class ResmiTatilItem extends StatelessWidget { ResmiTatilItem({super.key, required this.resmiTatil}); // final FikoYTMesaiciService FikoYTService.servisMesaici = Get.put(FikoYTMesaiciService()); final FikoYTService servisFikoYT = FikoYTService(); ResmiTatil resmiTatil; late Rx resmiTatilObs = resmiTatil.obs; @override Widget build(BuildContext context) { resmiTatilObs.listen((val) { resmiTatil = val; FikoYTService.servisMesaici.ayarlarModel!.refresh(); }); return Obx( () => Padding( padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4), child: ChoiceChip( avatar: Image.asset( 'assets/mesaici/ayarlar/resmi-tatil.png', // width: 300, width: 40, height: 40, fit: BoxFit.contain, ), surfaceTintColor: Colors.transparent, selectedColor: Colors.transparent, color: const WidgetStatePropertyAll(Colors.transparent), padding: const EdgeInsets.all(3), label: Column( children: [ Align( alignment: Alignment.centerLeft, child: Text( "${resmiTatilObs.value.ismi ?? "Tatil İsmi Verilmemiş"} ${resmiTatilObs.value.telafiSayilabilir ? ' 🚨' : ''}", style: const TextStyle( fontSize: 14, fontWeight: FontWeight.bold, ), textAlign: TextAlign.start, ), ), Align( alignment: Alignment.centerLeft, child: Text( "${resmiTatilObs.value.tarihi != null ? resmiTatilObs.value.tarihi!.formatla('dd MMMM yyyy EEEE') : 'Tarihi Seçiniz'} ", style: const TextStyle( fontSize: 12, fontWeight: FontWeight.normal, ), textAlign: TextAlign.start, ), ), Align( alignment: Alignment.centerLeft, child: Text( resmiTatilObs.value.aciklama ?? "Açıklama Yapılmamış", style: const TextStyle( fontSize: 10, color: Colors.grey, ), textAlign: TextAlign.start, ), ), Column( children: [ Row( children: [ Expanded( child: FikoYTButton( text: "M. Oranı", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, textColor: Colors.white, arkaPlanRengi: Colors.blue, textStrokeColor: Colors.transparent, ), ), ), Expanded( child: FikoYTButton( text: "D.G. Oranı", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, textColor: Colors.white, arkaPlanRengi: Colors.blue, textStrokeColor: Colors.transparent, ), ), ), Expanded( child: FikoYTButton( text: "H.T. Oranı", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, textColor: Colors.white, arkaPlanRengi: Colors.blue, textStrokeColor: Colors.transparent, ), ), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: FikoYTButton( text: "${resmiTatilObs.value.mesaiOrani} %", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.green, textStrokeColor: Colors.transparent, radius: 0, arkaPlanRengi: Colors.transparent, ), ), ), Expanded( child: FikoYTButton( text: "${resmiTatilObs.value.dinlenmeGunuMesaiOrani} %", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.green, textStrokeColor: Colors.transparent, radius: 0, arkaPlanRengi: Colors.transparent, ), ), ), Expanded( child: FikoYTButton( text: "${resmiTatilObs.value.haftaTatiliMesaiOrani} %", tema: Theme.of(context).extension()?.copyWith( fontSize: 10, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.green, textStrokeColor: Colors.transparent, radius: 0, arkaPlanRengi: Colors.transparent, ), ), ), ], ), ], ) ], ), checkmarkColor: Colors.transparent, backgroundColor: Colors.transparent, showCheckmark: false, selected: false, onSelected: (bool selected) { FikoYTService.dialogGoster( context, SizedBox( width: 250, child: ResmiTatilDialog(resmiTatil: resmiTatilObs.value), ), FikoDialogAyarlari(baslik: "Resmi Tatil Düzenle", altButonlar: [ FikoYTButton( text: "Sil", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.red, textStrokeColor: Colors.transparent, ), onPressed: () { List list = FikoYTService.servisMesaici.ayarlarModel!.value.resmiTatiller.toList(); list.remove(resmiTatilObs.value); FikoYTService.servisMesaici.ayarlarModel!.value.resmiTatiller = list; resmiTatilObs.refresh(); FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }, ), const Spacer(), FikoYTButton( text: "Kapat", tema: Theme.of(context).extension()?.copyWith( textColor: Colors.green, textStrokeColor: Colors.transparent, ), onPressed: (() { // print(molaObs.value.toJson()); resmiTatilObs.refresh(); FikoYTService.servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }), ), ]), ); }), ), ); } }