import 'package:fikoyt_mesaici/apps/mesaici/model/calisma_kayit/calisma_kayit.dart'; import 'package:fikoyt_mesaici/apps/mesaici/model/ayarlar/model_ayarlar.dart'; import 'package:fikoyt_mesaici/apps/mesaici/servisler/fikoyt.mesaici.service.dart'; import 'package:fikoyt_mesaici/apps/mesaici/widgets/aktif_kart/saat_tablosu/mola_dialog.dart'; import 'package:fikoyt_mesaici/core/Extensions/fiko_duration_ext.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 MolalarWidget extends StatelessWidget { MolalarWidget({super.key, required this.kayit}); final Rx? kayit; FikoYTMesaiciService servisMesaici = Get.put(FikoYTMesaiciService()); FikoYTService servisFikoYT = FikoYTService(); @override Widget build(BuildContext context) { return Obx( () => Column( children: [ Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ FikoButton1( text: "⏳ Geçerli Molalar", textSize: 10, edgePadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 1), textColor: Colors.black, textStrokeColor: Colors.transparent, borderColor: Colors.blue, onPressed: () { kayit?.value?.gecerliMolalariAl(); kayit?.refresh(); }, ), ], ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Expanded( child: Divider( indent: 20.0, endIndent: 10.0, thickness: 1, ), ), Text( 'Molalar (${kayit?.value?.molalar?.toplamMola.insanize ?? 'Yok'})', style: const 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 { Rx ml = Mola().obs; FikoYTService.dialogGoster( context, SizedBox( width: 250, // height: 300, child: MolaEkleDialog( mola: ml, ayarGizle: true, ), ), FikoDialogAyarlari(baslik: "Mola Ekle", baslikSimge: "➕", altButonlar: [ FikoButton1( textColor: Colors.green, textStrokeColor: Colors.transparent, text: "Ekle", onPressed: (() { List? list0 = kayit?.value?.molalar?.toList() ?? []; list0.add(ml.value); kayit?.value?.molalar = list0; kayit?.refresh(); servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }), ), const Spacer(), FikoButton1( textColor: Colors.red, textStrokeColor: Colors.transparent, text: "Kapat", onPressed: (() { Navigator.pop( context, ); }), ), ]), ); }, child: const Text("➕"), // const Icon(Icons.notifications, // color: Colors.lightBlue, size: 14), ), ), ], ), (kayit?.value?.molalar ?? []).isEmpty ? Padding( padding: const EdgeInsets.only(top: 30.0), child: Stack( children: [ Card( child: Container( height: 60.0, ), ), FractionalTranslation( translation: const Offset(0.0, -0.4), child: Align( alignment: const FractionalOffset(0.5, 0.0), child: CircleAvatar( // backgroundColor: Colors.redAccent.shade200, radius: 25.0, child: Image.asset( 'assets/mesaici/ayarlar/cay.png', // width: 300, width: 42, height: 42, fit: BoxFit.contain, ), ), ), ), Padding( padding: const EdgeInsets.only(top: 30), child: Align( alignment: const FractionalOffset(0.5, 0.5), child: Text( "Henüz Mola Kaydı Girilmemiş", style: TextStyle(fontSize: 14, fontWeight: FontWeight.w300, color: Colors.blueAccent.shade400), textAlign: TextAlign.center, ), ), ), ], ), ).animate(effects: [const FadeEffect(), ShimmerEffect(delay: 1000.ms)]) : Column( spacing: 5.0, children: [ for (var i = 0; i < (kayit?.value?.molalar ?? []).length; i++) Obx( () { Rx? mola = kayit?.value?.molalar![i].obs; return FikoButton1( text: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( '☕ ${mola?.value.ismi ?? 'İsim Verilmemiş'}', ), const Spacer(), FikoButton1( textColor: Colors.white, textStrokeColor: Colors.black, text: "${mola?.value.farkHesapla().insanize ?? 'Yok'}", ), ], ), 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: MolaEkleDialog( mola: mola!, ayarGizle: true, ), ), FikoDialogAyarlari(baslik: "Mola Düzenle", baslikSimge: "🕙", altButonlar: [ FikoButton1( textColor: Colors.red, textStrokeColor: Colors.transparent, text: "Sil", onPressed: () { List? list0 = kayit?.value?.molalar!.toList() ?? []; list0.removeAt(i); kayit?.value?.molalar = list0; kayit?.refresh(); servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }, ), const Spacer(), FikoButton1( textColor: Colors.green, textStrokeColor: Colors.transparent, text: "Kapat", onPressed: (() { servisMesaici.ayarlarModel!.refresh(); Navigator.pop( context, ); }), ), ]), ); }, ).animate( effects: [const FadeEffect(), ShimmerEffect(delay: 1000.ms)], ); }, ), ], ), // SizedBox( // height: 55, // child: ShaderMask( // shaderCallback: (Rect rect) { // return const LinearGradient( // begin: Alignment.centerLeft, // end: Alignment.centerRight, // colors: [Colors.purple, Colors.transparent, Colors.transparent, Colors.purple], // stops: [0.0, 0.1, 0.9, 1.0], // 10% purple, 80% transparent, 10% purple // ).createShader(rect); // }, // blendMode: BlendMode.dstOut, // child: ListView( // shrinkWrap: true, // physics: const BouncingScrollPhysics(), // // scrollDirection: Axis.horizontal, // // your ListView // children: [ // for (var k = 0; k < (kayit?.value?.molalar ?? []).length; k++) // Obx(() { // // Mola mola = // // gunObs.value.molalar[k]; // Rx? molaObs = kayit?.value?.molalar![k].obs; // molaObs?.listen((val) { // kayit?.value?.molalar![k] = val; // kayit?.refresh(); // servisMesaici.ayarlarModel!.refresh(); // }); // return Padding( // padding: const EdgeInsets.symmetric( // horizontal: 4, // ), // child: ChoiceChip( // avatar: Image.asset( // 'assets/mesaici/ayarlar/cay.png', // // width: 300, // width: 40, // height: 40, // fit: BoxFit.contain, // ), // padding: const EdgeInsets.all(3), // label: Column( // children: [ // Align( // alignment: Alignment.centerLeft, // child: Obx( // () => Text( // (molaObs?.value.ismi == "" && molaObs?.value.ismi == null) ? "İsim Verilmemiş" : molaObs?.value.ismi ?? "İsim Verilmemiş", // style: const TextStyle( // fontSize: 12, // ), // textAlign: TextAlign.start, // ), // ), // ), // Row( // crossAxisAlignment: CrossAxisAlignment.center, // children: [ // FikoButton1(text: molaObs?.value.girisSaati?.formatla("HH:mm:ss") ?? "Yok", textSize: 10, textColor: Colors.green, textStrokeColor: Colors.transparent), // FikoButton1( // text: molaObs?.value.cikisSaati?.formatla("HH:mm:ss") ?? "Yok", // textSize: 10, // textColor: Colors.red, // textStrokeColor: Colors.transparent, // ), // ], // ), // Row( // crossAxisAlignment: CrossAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center, // children: [ // FikoButton1( // text: molaObs?.value.farkHesapla().insanize ?? 'Yok', // textSize: 14, // textColor: Colors.green, // textStrokeColor: Colors.transparent, // ), // ], // ), // ], // ), // checkmarkColor: Colors.transparent, // backgroundColor: Colors.transparent, // showCheckmark: false, // selected: false, // onSelected: (bool selected) { // FikoYTService.dialogGoster( // context, // SizedBox( // width: 250, // child: MolaDialog( // mola: molaObs!.value, // ), // ), // FikoDialogAyarlari(baslik: "Mola Düzenle", altButonlar: [ // FikoButton1( // textColor: Colors.red, // textStrokeColor: Colors.transparent, // text: "Sil", // onPressed: () { // List? list0 = kayit?.value?.molalar?.toList() ?? []; // list0.remove(molaObs.value); // kayit?.value?.molalar = list0; // kayit?.refresh(); // servisMesaici.ayarlarModel!.refresh(); // Navigator.pop( // context, // ); // }, // ), // const Spacer(), // FikoButton1( // textColor: Colors.green, // textStrokeColor: Colors.transparent, // text: "Kapat", // onPressed: (() { // // print(molaObs.value.toJson()); // molaObs.refresh(); // kayit?.refresh(); // servisMesaici.ayarlarModel!.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, ), ]); } }