import 'package:fikoyt_akcali_v1/apps/finans/core/models/finans.model.dart'; import 'package:fikoyt_akcali_v1/apps/finans/core/services/finans.servis.dart'; import 'package:fikoyt_akcali_v1/apps/finans/uye/hareketler/hareket-ekle/hareket-ekle.dart'; import 'package:fikoyt_ui/fikoyt_ui.dart' hide SlideEffect, SwapEffect; import 'package:fikoyt_ui/ui/fikoyt_card.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:smooth_page_indicator/smooth_page_indicator.dart'; class HesapFab extends StatefulWidget { HesapFab({super.key, this.hesap}); Hesap? hesap; @override State createState() => _HesapFabState(); } class _HesapFabState extends State { bool isOpenFab = false; FinansServis? finansServis = FikoYTCoreService.servisler.getServis(); @override Widget build(BuildContext context) { return TapRegion( child: AnimatedContainer( alignment: Alignment.center, width: isOpenFab ? 150 : 60, height: isOpenFab ? 140 : 60, decoration: BoxDecoration( color: isOpenFab ? Theme.of(context).extension()?.cardBackgroundColor : Colors.blue, borderRadius: BorderRadius.circular(isOpenFab ? 5 : 35), boxShadow: Theme.of(context).extension()?.boxShadow, ), duration: Duration(milliseconds: ((finansServis?.openContainerDuration ?? Duration.zero).inMilliseconds / 2).toInt()), // margin: !widget.isOpenFab ? EdgeInsets.zero : EdgeInsets.only(right: 30, bottom: 30), // curve: Curves.easeInOut, child: AnimatedSwitcher( duration: finansServis?.openContainerDuration ?? Duration.zero, reverseDuration: Duration(milliseconds: 250), child: !isOpenFab ? FikoYTButton( text: "+", tema: FikoYTButtonTheme( textColor: Colors.white, // fontWeight: FontWeight.w700, edgePadding: EdgeInsets.all(3), // borderColor: Colors.blueAccent, elevation: 3, fontSize: 36, ), ) : TusYayilmasiEngelleWidget( shouldBlockKey: (event) { if (event.logicalKey == LogicalKeyboardKey.goBack || event.logicalKey == LogicalKeyboardKey.goHome || event.logicalKey == LogicalKeyboardKey.allCandidates || event.logicalKey == LogicalKeyboardKey.cancel || event.logicalKey == LogicalKeyboardKey.browserBack || event.physicalKey == PhysicalKeyboardKey.escape || event.physicalKey == PhysicalKeyboardKey.exit || event.physicalKey == PhysicalKeyboardKey.browserBack || event.physicalKey == PhysicalKeyboardKey.close || event.physicalKey == PhysicalKeyboardKey.undo) { // Future.delayed(50.ms, () { setState(() { isOpenFab = false; }); // }); return true; } return true; }, child: Column( children: [ Expanded( child: PageView( controller: FikoYTPageController.getInstance("HesapFabPageIndex"), physics: BouncingScrollPhysics(), scrollDirection: Axis.horizontal, children: [fabHareketKomutlari()], ), ), SmoothPageIndicator( controller: FikoYTPageController.getInstance("HesapFabPageIndex"), count: 1, effect: const JumpingDotEffect( dotHeight: 6, dotWidth: 6, spacing: 2, jumpScale: 1.3, verticalOffset: 5, ), ), ], ), ), ), // AnimatedCrossFade( // firstChild: FikoYTButton( // text: "+", // tema: FikoYTButtonTheme( // textColor: Colors.white, // // fontWeight: FontWeight.w700, // edgePadding: EdgeInsets.all(3), // // borderColor: Colors.blueAccent, // elevation: 3, // fontSize: 36, // ), // ), // secondChild: SizedBox.shrink(), // crossFadeState: widget.isOpenFab ? CrossFadeState.showSecond : CrossFadeState.showFirst, // duration: finansServis?.openContainerDuration ?? Duration.zero, // ), ), onTapInside: (v) { setState(() { isOpenFab = true; }); // if (!isOpen) { // setState(() { // width = 200; // height = 200; // left = 60; // bottom = 60; // isOpen = !isOpen; // }); // } }, onTapOutside: (event) { setState(() { isOpenFab = false; }); }, ); } Container fabHareketKomutlari() { return Container( decoration: BoxDecoration( color: isOpenFab ? Theme.of(context).extension()?.cardBackgroundColor : Colors.white, borderRadius: BorderRadius.circular(isOpenFab ? 5 : 35), ), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ FittedBox( fit: BoxFit.scaleDown, child: FikoYTButton( text: "💰 Hareket Komutları", tema: FikoYTButtonTheme(fontSize: 12, edgePadding: EdgeInsets.all(3)), ), ), Divider(height: 2, thickness: 1), Expanded( child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ finansServis?.animasyonluWidgetAc( ozelId: "HesapFab-Gelir-Ekle", routeSettings: RouteSettings(name: "/uye/hareketler/ekle"), mevcutWidget: (context, action) => FikoYTButton( text: "➕ Gelir Ekle", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, edgePadding: EdgeInsets.symmetric(horizontal: 0, vertical: 5), fontSize: 12, ), ), acilacakWidget: (context, action) { return SayfaHareketEkle(animClose: action, hesap: widget.hesap); }, ), finansServis?.animasyonluWidgetAc( ozelId: "HesapFab-Gider-Ekle", routeSettings: RouteSettings(name: "/uye/hareketler/ekle"), mevcutWidget: (context, action) => FikoYTButton( text: "➖ Gider Ekle", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, edgePadding: EdgeInsets.symmetric(horizontal: 0, vertical: 5), fontSize: 12, ), ), acilacakWidget: (context, action) { return SayfaHareketEkle(animClose: action, hesap: widget.hesap); }, ), finansServis?.animasyonluWidgetAc( ozelId: "HesapFab-Transfer-Ekle", routeSettings: RouteSettings(name: "/uye/hareketler/ekle"), mevcutWidget: (context, action) => FikoYTButton( text: "🎗 Transfer Ekle", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, edgePadding: EdgeInsets.symmetric(horizontal: 0, vertical: 5), fontSize: 12, ), ), acilacakWidget: (context, action) { return SayfaHareketEkle(animClose: action, hesap: widget.hesap); }, ), finansServis?.animasyonluWidgetAc( ozelId: "HesapFab-Şablondan-Ekle", routeSettings: RouteSettings(name: "/uye/hareketler/ekle"), mevcutWidget: (context, action) => FikoYTButton( text: "🎫 Şablondan Ekle", tema: FikoYTButtonTheme( // backgroundColor: Colors.amberAccent, radius: 0, edgePadding: EdgeInsets.symmetric(horizontal: 0, vertical: 5), fontSize: 12, ), ), acilacakWidget: (context, action) { return SayfaHareketEkle(animClose: action); }, ), ], ), ), ), ], ), ); } }