import 'package:fikoyt_ui_web/fikoyt_ui_web.dart' hide SlideEffect, SwapEffect; import 'package:fikoyt_ui_web/ui/fikoyt_card.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:smooth_page_indicator/smooth_page_indicator.dart'; class AnaSayfaFab extends StatefulWidget { const AnaSayfaFab({super.key}); @override State createState() => _AnaSayfaFabState(); } class _AnaSayfaFabState extends State { bool isOpenFab = false; @override Widget build(BuildContext context) { return TapRegion( child: AnimatedContainer( alignment: Alignment.center, width: isOpenFab ? 150 : 60, height: isOpenFab ? 150 : 60, margin: EdgeInsets.only(bottom: isOpenFab ? 20 : 0), decoration: BoxDecoration( color: isOpenFab ? Theme.of(context).extension()?.cardBackgroundColor : Colors.white, borderRadius: BorderRadius.circular(isOpenFab ? 5 : 35), boxShadow: Theme.of(context).extension()?.boxShadow, ), clipBehavior: Clip.hardEdge, duration: Duration(milliseconds: 400), // margin: !widget.isOpenFab ? EdgeInsets.zero : EdgeInsets.only(right: 30, bottom: 30), // curve: Curves.easeInOut, child: AnimatedSwitcher( duration: Duration(milliseconds: 400), 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(0.ms, () { setState(() { isOpenFab = false; }); }); return true; } return false; }, child: Column( children: [ Expanded( child: PageView( controller: FikoYTPageController.getInstance("AnaSayfaFabPage"), physics: BouncingScrollPhysics(), scrollDirection: Axis.horizontal, children: [ /// akcaliSayfa(context), /// /// sabitlerSayfa(context), ], ), ), SmoothPageIndicator( controller: FikoYTPageController.getInstance("AnaSayfaFabPage"), count: 2, effect: const JumpingDotEffect( dotHeight: 6, dotWidth: 6, spacing: 2, jumpScale: 1.3, verticalOffset: 5, ), ), ], ), ), ), ), onTapUpInside: (v) { setState(() { isOpenFab = true; }); // } }, onTapUpOutside: (event) { // if (isOpenFab != false) { // Future.delayed(250.ms, () { setState(() { isOpenFab = false; }); // }); // } }, ); } Container akcaliSayfa(BuildContext context) { 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: "💰 Komutlar", tema: FikoYTButtonTheme(fontSize: 12, edgePadding: EdgeInsets.all(3)), ), ), Divider(height: 2, thickness: 1), Expanded(child: SingleChildScrollView(child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ ], ))), ], ), ); } Container sabitlerSayfa(BuildContext context) { 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: "👨🏼‍🔧 Sabitler", tema: FikoYTButtonTheme(fontSize: 12, edgePadding: EdgeInsets.all(3))), ), Divider(height: 2, thickness: 1), Expanded(child: SingleChildScrollView(child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ ], ))), ], ), ); } }