import 'package:fikoyt_sistem/apps/uyar/core/services/uyar_service.dart'; import 'package:fikoyt_ui/fikoyt_ui.dart'; import 'package:fikoyt_ui/ui/fikoyt_card.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; class KullaniciItem extends StatefulWidget { KullaniciItem({super.key, this.uye}); Map? uye; @override _KullaniciItemState createState() => _KullaniciItemState(); } class _KullaniciItemState extends State { final UyarService uyarService = Get.put(UyarService()); @override Widget build(BuildContext context) { final String imageUrl = "https://fikoyt.com:9000/fapiv1/fikoyt.com.FikoYT.sistem.kullanici.${widget.uye?['_id']?.toString()}.profilResmi?boyut=128x?&t=0.8143431303498987"; final String fullName = "${widget.uye?['isim'] ?? ""} ${widget.uye?['soyIsim'] ?? ""}"; final bool isSuperAdmin = ((widget.uye?['yetkiler'] as List?) ?? []).contains("Süper Yönetici"); final bool aktifKullaniciIsSuperAdmin = ((uyarService.aktifKullanici.value?['yetkiler'] as List?) ?? []).contains( "Süper Yönetici", ); return FikoYTCard( theme: FikoYTCardTheme( elevation: 4, backgroundColor: Colors.white, borderColor: Colors.grey, padding: EdgeInsets.all(5), radius: 5, boxConstraints: BoxConstraints(maxWidth: 160, maxHeight: 170, minHeight: 150), ), children: [ Stack( alignment: Alignment.topLeft, children: [ Row( children: [ Spacer(), if (aktifKullaniciIsSuperAdmin) FikoYTButton( text: Obx(() { uyarService.logicKullanici.ekleIstek.isBusy.value; return Row( children: [ AnimatedSwitcher( duration: const Duration(milliseconds: 500), transitionBuilder: (Widget child, Animation animation) { return FadeTransition( opacity: animation, child: ScaleTransition(scale: animation, child: child), ); }, child: uyarService.logicKullanici.ekleIstek.isBusy.value ? SizedBox( key: const ValueKey('loading'), height: 16, width: 16, child: const CircularProgressIndicator(color: Colors.white), ) : FikoYTButton( text: "🗑", tema: FikoYTButtonTheme( textColor: Colors.white, backgroundColor: Colors.transparent, // fontWeight: FontWeight.w700, edgePadding: EdgeInsets.all(3), borderColor: Colors.transparent, // elevation: 3, fontSize: 12, ), ), ), ], ); }), tema: FikoYTButtonTheme( textColor: Colors.white, backgroundColor: Colors.blue, // fontWeight: FontWeight.w700, edgePadding: EdgeInsets.all(3), borderColor: Colors.blueAccent, elevation: 3, fontSize: 12, ), onPressed: () async { if (uyarService.logicKullanici.ekleIstek.isBusy.value) return; uyarService.logicKullanici.ekleIstek.beforeSendList.clear(); uyarService.logicKullanici.ekleIstek.startWithQueue(); }, ), ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ FikoytOvalResim( resimUrl: imageUrl, tema: FikoYTOvalResimTheme(borderColor: Colors.blue, radius: 42, spacing: 7), ), Center( child: FikoYTButton( text: fullName, tema: FikoYTButtonTheme( fontSize: 12, fontWeight: FontWeight.w600, edgePadding: EdgeInsets.all(0), radius: 0, backgroundColor: Colors.transparent, textColor: Colors.black87, ), ), ), SizedBox( height: 36, child: SingleChildScrollView( scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), child: Row( spacing: 2, children: [ if (isSuperAdmin) FikoYTButton( text: "👑", tema: FikoYTButtonTheme( fontSize: 14, edgePadding: EdgeInsets.all(3), radius: 5, backgroundColor: Colors.transparent, ), onPressed: () { // context.vRouter.to("/uyar/uye/kullanici/arkadaslar"); }, ), ], ), ), ), ], ), ], ), ], ); } }