import 'package:fikoyt_sistem/apps/uyar/core/base_sol_menu.dart'; import 'package:fikoyt_sistem/apps/uyar/core/uyar_service.dart'; import 'package:fikoyt_sistem/main.dart'; import 'package:fikoyt_ui/core/fiko_request.dart'; import 'package:fikoyt_ui/fikoyt_ui.dart'; import 'package:flutter/material.dart'; class SolMenu extends StatefulWidget { SolMenu({super.key}); @override State createState() => _SolMenuState(); } class _SolMenuState extends State { final UyarService uyarServis = Get.put(UyarService()); var $baglantiToplamlarOlay; RxMap baglantilar = RxMap.from({"desktop": 0, "machine": 0, "mobile": 0, "tablet": 0, "tv": 0}); @override void initState() { $baglantiToplamlarOlay = FikoYTCoreService.socket.on("FikoYT.sistem.cihaz.bağlandı.toplamlar", (data) { baglantilar.value = Map.from(data?[0]); baglantilar.refresh(); }); FikoYTCoreService.ioEmit("FikoYT.sistem.io.cihaz.baglandi", {}); super.initState(); } @override void dispose() { if ($baglantiToplamlarOlay != null) $baglantiToplamlarOlay(); super.dispose(); } @override Widget build(BuildContext context) { return BaseSolMenu( solMenuUst: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ Image.asset("packages/fikoyt_ui/assets/core/icons/fikoyt-4.png", height: 32), // Align( // alignment: Alignment.centerRight, // child: Text( // "Özel Üye", // style: TextStyle(color: Colors.black45, fontSize: 12, fontWeight: FontWeight.bold), // ), // ), ], ), ), solMenu: Column( children: [ SizedBox(height: 5), Stack( children: [ Row( spacing: 2, children: [ FikoYTButton( text: "👑", tema: FikoYTButtonTheme( fontSize: 14, edgePadding: EdgeInsets.all(3), radius: 5, backgroundColor: context.vRouter.url.startsWith("/uyar/admin") ? Colors.white : Colors.transparent, ), onPressed: () { context.vRouter.to("/uyar/admin/ana-sayfa"); }, ), Spacer(), FikoYTButton( text: Icon(Icons.exit_to_app, size: 22, color: Colors.red), tema: FikoYTButtonTheme(fontSize: 14, edgePadding: EdgeInsets.all(3), radius: 5), onPressed: () { istek_yap(command: 'FikoYT.sistem.cikis.yap') .listen((sonuc) async { if (sonuc.type == FikoYTRequestType.RESPONDED) { toastification.dismissAll(delayForAnimation: true); uyarServis.aktifKullanici.value = null; FikoYTCoreService.serviceSettings.socketDataMiddleWare = {"kullanici_kimlik": null}; FikoYTCoreService.socket.disconnect(); FikoYTCoreService.socket.connect(); FikoYTCoreService.ioEmit("FikoYT.sistem.io.cihaz.baglandi", {}); /// Giriş Başarılı toastification.show( context: FikoYTCoreService.navigatorKey.currentContext, type: ToastificationType.info, style: ToastificationStyle.fillColored, // title: Text("FikoYT Sistem"), description: Text("Çıkışınız Yapıldı."), alignment: Alignment.topRight, margin: EdgeInsets.only(top: 32, right: 20), autoCloseDuration: const Duration(seconds: 4), borderRadius: BorderRadius.circular(4.0), // boxShadow: lowModeShadow, showProgressBar: false, dragToClose: true, applyBlurEffect: true, ); context.vRouter.to("/uyar/kisi/ana-sayfa"); } }) /** */ .onError((hata) async { toastification.dismissAll(delayForAnimation: true); FikoYTCoreService.ioEmit("FikoYT.sistem.io.cihaz.baglandi", {}); }); }, ), ], ), FikoytOvalResim( resimUrl: "https://fikoyt.com:9000/fapiv1/fikoyt.com.FikoYT.sistem.kullanici.${uyarServis.aktifKullanici.value?['_id']?.toString()}.profilResmi?boyut=128x?&t=0.8143431303498987", tema: FikoYTOvalResimTheme(borderColor: Colors.blue, radius: 36, spacing: 7), ), ], ), FikoYTButton( text: "${uyarServis.aktifKullanici.value?['isim'] ?? ""} ${uyarServis.aktifKullanici.value?['soyIsim'] ?? ""}", 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: [ FikoYTButton( text: "👬", tema: FikoYTButtonTheme( fontSize: 14, edgePadding: EdgeInsets.all(3), radius: 5, backgroundColor: context.vRouter.url.startsWith("/uyar/uye/kullanici/arkadaslar") ? Colors.white : Colors.transparent, ), onPressed: () { context.vRouter.to("/uyar/uye/kullanici/arkadaslar"); }, ), FikoYTButton( text: "💬", tema: FikoYTButtonTheme( fontSize: 14, edgePadding: EdgeInsets.all(3), radius: 5, backgroundColor: context.vRouter.url.startsWith("/uyar/uye/kullanici/mesajlar") ? Colors.white : Colors.transparent, ), onPressed: () { context.vRouter.to("/uyar/uye/kullanici/mesajlar"); }, ), FikoYTButton( text: "🔔", tema: FikoYTButtonTheme( fontSize: 14, edgePadding: EdgeInsets.all(3), radius: 5, backgroundColor: context.vRouter.url.startsWith("/uyar/uye/kullanici/bildirimler") ? Colors.white : Colors.transparent, ), onPressed: () { context.vRouter.to("/uyar/uye/kullanici/bildirimler"); }, ), // FikoYTButton( // text: "⚙️", // tema: FikoYTButtonTheme( // fontSize: 14, // edgePadding: EdgeInsets.all(3), // radius: 5, // backgroundColor: context.vRouter.url.startsWith("/uyar/uye/ayarlar") ? Colors.white : Colors.transparent, // ), // onPressed: () { // context.vRouter.to("/uyar/uye/ayarlar"); // }, // ), ], ), ), ), /// NOT: Göstergeler SizedBox( height: 24, child: ListView( shrinkWrap: true, scrollDirection: Axis.horizontal, physics: const BouncingScrollPhysics(), children: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 5.0, vertical: 2.0), child: Obx( () => Row( spacing: 2, children: [ FikoYTButton( text: SizedBox( height: 18, child: Row( children: [ Icon(Icons.wifi, size: 12, color: Colors.white), Icon( FikoYTCoreService.internetBagli.value ? Icons.check : Icons.close, size: 12, color: Colors.white, fontWeight: FontWeight.bold, ), ], ), ), tema: FikoYTButtonTheme( fontSize: 11, edgePadding: EdgeInsets.symmetric(horizontal: 0, vertical: 2), radius: 10, backgroundColor: FikoYTCoreService.internetBagli.value ? Colors.green : Colors.red, ), ), FikoYTButton( text: SizedBox( height: 18, child: Row( children: [ Icon(Icons.bolt, size: 12, color: Colors.white), Icon( FikoYTCoreService.wsBagli.value ? Icons.check : Icons.close, size: 12, color: Colors.white, fontWeight: FontWeight.bold, ), ], ), ), tema: FikoYTButtonTheme( fontSize: 11, edgePadding: EdgeInsets.symmetric(horizontal: 0, vertical: 2), radius: 10, backgroundColor: FikoYTCoreService.wsBagli.value ? Colors.green : Colors.red, ), ), FikoYTButton( text: SizedBox( height: 18, child: Row( children: [ Icon(Icons.monitor, size: 12, color: Colors.white), Text( " (${baglantilar.value?["desktop"] ?? 0})", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 10, color: Colors.white), ), ], ), ), tema: FikoYTButtonTheme( fontSize: 11, edgePadding: EdgeInsets.symmetric(horizontal: 0, vertical: 2), radius: 2, backgroundColor: Colors.blue, ), ), FikoYTButton( text: SizedBox( height: 18, child: Row( children: [ Icon(Icons.smartphone, size: 12, color: Colors.white), Text( " (${baglantilar.value?["mobile"] ?? 0})", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 10, color: Colors.white), ), ], ), ), tema: FikoYTButtonTheme( fontSize: 11, edgePadding: EdgeInsets.symmetric(horizontal: 0, vertical: 2), radius: 2, backgroundColor: Colors.blue, ), ), FikoYTButton( text: SizedBox( height: 18, child: Row( children: [ Icon(Icons.memory, size: 14, color: Colors.white), Text( " (0)", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 10, color: Colors.white), ), ], ), ), tema: FikoYTButtonTheme( fontSize: 11, edgePadding: EdgeInsets.symmetric(horizontal: 0, vertical: 2), radius: 2, backgroundColor: Colors.blue, ), ), FikoYTButton( text: SizedBox( height: 18, child: Row( children: [ Icon(Icons.precision_manufacturing, size: 12, color: Colors.white), Text( " (0)", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 10, color: Colors.white), ), ], ), ), tema: FikoYTButtonTheme( fontSize: 11, edgePadding: EdgeInsets.symmetric(horizontal: 0, vertical: 2), radius: 2, backgroundColor: Colors.blue, ), ), ], ), ), ), ], ), ), /// Divider(height: 4), SizedBox(height: 5), if (((uyarServis.aktifKullanici.value?['yetkiler'] as List?) ?? []).contains("Süper Yönetici")) SolMenuItem( icon: Icons.admin_panel_settings, label: 'Admin Paneli', selected: context.vRouter.url.startsWith("/uyar/uye/admin"), onTap: () { context.vRouter.to("/uyar/uye/admin/ana-sayfa"); }, ), SolMenuItem( icon: Icons.dashboard, label: 'Ana pencere', selected: context.vRouter.url.startsWith("/uyar/uye/ana-sayfa"), onTap: () { context.vRouter.to("/uyar/uye/ana-sayfa"); }, ), SolMenuItem( icon: Icons.shopping_cart_checkout, label: 'Stoklar', selected: context.vRouter.url.startsWith("/uyar/uye/stoklar"), onTap: () { context.vRouter.to("/uyar/uye/stoklar/ana-sayfa"); }, ), SolMenuItem( icon: Icons.person, label: 'Pdks', selected: context.vRouter.url.startsWith("/uyar/uye/pdks"), onTap: () { context.vRouter.to("/uyar/uye/pdks"); }, ), SolMenuItem( icon: Icons.polymer_rounded, label: 'Projeler', selected: context.vRouter.url.startsWith("/uyar/uye/projeler"), onTap: () { context.vRouter.to("/uyar/uye/projeler"); }, ), ], ), solMenuAlt: Padding( padding: const EdgeInsets.all(8.0), child: Row( children: [ FikoYTButton( text: "🎧", tema: FikoYTButtonTheme( fontSize: 16, edgePadding: EdgeInsets.all(5), radius: 5, backgroundColor: context.vRouter.url.startsWith("/uyar/uye/iletisim") ? Colors.white : Colors.transparent, ), onPressed: () { context.vRouter.to("/uyar/uye/iletisim"); }, ), Spacer(), FikoYTButton( text: "⚙️", tema: FikoYTButtonTheme( fontSize: 16, edgePadding: EdgeInsets.all(5), radius: 5, backgroundColor: context.vRouter.url.startsWith("/uyar/uye/ayarlar") ? Colors.white : Colors.transparent, ), onPressed: () { context.vRouter.to("/uyar/uye/ayarlar/ana-sayfa"); }, ), ], ), ), ); } } class SolMenuItem extends StatefulWidget { final IconData icon; final String label; final bool selected; final VoidCallback onTap; const SolMenuItem({super.key, required this.icon, required this.label, required this.selected, required this.onTap}); @override State createState() => _SolMenuItemState(); } class _SolMenuItemState extends State { bool isHovered = false; bool isPressed = false; bool isFocused = false; @override Widget build(BuildContext context) { final isSelected = widget.selected; Color getBackgroundColor() { if (isSelected) return Colors.white; if (isPressed) return Colors.black.withOpacity(0.05); if (isHovered) return Colors.white.withOpacity(0.15); return Colors.transparent; } Color getBorderColor() { // if (isSelected) return const Color(0xFF00A67E); // if (isFocused) return Colors.blueAccent.withOpacity(0.8); // if (isHovered) return Colors.grey.withOpacity(0.4); return Colors.transparent; } return Focus( onFocusChange: (focus) => setState(() => isFocused = focus), child: MouseRegion( onEnter: (_) => setState(() => isHovered = true), onExit: (_) => setState(() => isHovered = false), cursor: SystemMouseCursors.click, child: GestureDetector( onTapDown: (_) => setState(() => isPressed = true), onTapUp: (_) => setState(() => isPressed = false), onTapCancel: () => setState(() => isPressed = false), onTap: widget.onTap, child: AnimatedContainer( duration: const Duration(milliseconds: 100), margin: const EdgeInsets.symmetric(horizontal: 14, vertical: 0), padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10), decoration: BoxDecoration( color: getBackgroundColor(), borderRadius: BorderRadius.circular(6), border: Border.all(color: getBorderColor(), width: 0), ), child: Row( children: [ Icon(widget.icon, color: Colors.black87, size: 24), const SizedBox(width: 20), Text( widget.label, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.black87), ), ], ), ), ), ), ); } }