// ignore_for_file: library_private_types_in_public_api import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../core/widgets/fikoyt_elastic/fikoyt_elastic.dart'; import '../../core/widgets/windows_baslik_cubugu/windows_uygulama_baslik.dart'; class BasePageMesaiciLogic extends GetxController with GetTickerProviderStateMixin { AnimationController? animationController; final ScrollController scrollController = ScrollController(); Animation? topBarAnimation; Rx topBarOpacity = 0.0.obs; Rx topBarOpacityFactor = 75.obs; RxString subTitle = "FikoYT Ana Merkez".obs; Rx showDrawer = true.obs; List children = []; List topMenu = []; @override void onInit() { animationController = AnimationController(duration: const Duration(milliseconds: 400), vsync: this); topBarAnimation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(parent: animationController!, curve: const Interval(0, 0.5, curve: Curves.fastOutSlowIn))); super.onInit(); } @override void onReady() { // animationController = AnimationController( // duration: const Duration(milliseconds: 1500), vsync: this); scrollController.addListener(scrollListener); super.onReady(); } scrollListener() { if (scrollController.offset >= topBarOpacityFactor.value) { if (topBarOpacity.value != 1.0) { topBarOpacity.value = 1.0; // update(); } } else if (scrollController.offset <= topBarOpacityFactor.value && scrollController.offset >= 0) { if (topBarOpacity.value != scrollController.offset / topBarOpacityFactor.value) { topBarOpacity.value = scrollController.offset / topBarOpacityFactor.value; // update(); } } else if (scrollController.offset <= 0) { if (topBarOpacity.value != 0.0) { topBarOpacity.value = 0.0; // update(); } } } @override void onClose() { if (animationController != null) { animationController?.dispose(); } scrollController.removeListener(scrollListener); super.onClose(); } } /// class BasePageMesaici extends StatefulWidget { const BasePageMesaici({super.key, child}) : child = child ?? const SizedBox.shrink(); final Widget child; @override _BasePageMesaiciState createState() => _BasePageMesaiciState(); } class _BasePageMesaiciState extends State { final logic = Get.put(BasePageMesaiciLogic()); @override void initState() { logic.topBarAnimation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(parent: logic.animationController!, curve: const Interval(0, 0.5, curve: Curves.fastOutSlowIn))); // logic.children = widget.children; super.initState(); } @override Widget build(BuildContext context) { // logic.animationController = AnimationController( // duration: const Duration(milliseconds: 600), vsync: this); return WillPopScope( onWillPop: () async { final shouldPop = await _showExitConfirmationDialog(context); if (shouldPop) { SystemNavigator.pop(); // Uygulamayı kapatır return true; } else { return false; // Uygulamayı açık tutar } }, child: Scaffold( // drawerScrimColor: Colors.blue.withOpacity(0.3), drawer: FikoYTElastic.isSmall(context) || FikoYTElastic.isMini(context) || FikoYTElastic.isExtraMini(context) ? const Padding( padding: EdgeInsets.symmetric(vertical: 50), child: Drawer(elevation: 0, child: Text("Sol Menu")), ) : null, drawerEnableOpenDragGesture: FikoYTElastic.isSmall(context) || FikoYTElastic.isMini(context) || FikoYTElastic.isExtraMini(context), resizeToAvoidBottomInset: false, // backgroundColor: Colors.transparent, extendBody: true, extendBodyBehindAppBar: true, body: Stack( children: [ Padding( padding: EdgeInsets.only( top: !kIsWeb ? (Platform.isAndroid == false ? 20 : 0) : 20, // bottom: !kIsWeb ? (Platform.isAndroid == false ? 20 : 0) : 20, ), child: widget.child, ), // widget.child, // Column( // children: [ // Expanded( // flex: 1, // child: Row( // children: [ // GetBuilder( // builder: (logic) => Flexible( // child: ListView( // physics: const BouncingScrollPhysics(), // controller: logic.scrollController, // padding: EdgeInsets.only( // top: AppBar().preferredSize.height + // MediaQuery.of(context).padding.top + // 10, //28, // bottom: MediaQuery.of(context).padding.bottom, // ), // scrollDirection: Axis.vertical, // children: [widget.child ?? SizedBox.shrink()], // ), // ), // ), // ], // ), // ), // ], // ), // if (Platform.isWindows) // Center( // child: Padding( // padding: EdgeInsets.only( // left: 10, // right: 10, // top: !kIsWeb ? (Platform.isAndroid == false ? 28 : 28) : 28), // child: UygMenu1(), // ), // ), // if (!kIsWeb) // if (Platform.isWindows) // Positioned( // left: 0, // right: 0, // top: (MediaQuery.of(context).padding.top + 46 - 4.0) + // (!kIsWeb ? (Platform.isAndroid == false ? 28 : 0) : 28), // /* logic.topBarOpacity*/ // child: Center( // child: Padding( // padding: const EdgeInsets.only(left: 5, right: 5), // child: ConstrainedBox( // constraints: // const BoxConstraints(minWidth: 10, maxWidth: 250), // child: Obx( // () => Container( // decoration: BoxDecoration( // color: Colors.blue.shade300, // borderRadius: const BorderRadius.all( // Radius.circular(12.0), // ), // border: Border.all( // color: Colors.blueAccent // .withOpacity(1.0 /*- logic.topBarOpacity*/)), // boxShadow: [ // BoxShadow( // color: Colors.black // .withOpacity(0.4 * logic.topBarOpacity.value), // offset: const Offset(1.1, 1.1), // blurRadius: 10.0), // ], // ), // child: Padding( // padding: const EdgeInsets.symmetric(horizontal: 15), // child: GetBuilder( // builder: (logic) => Obx( // () => Text( // logic.subTitle.value, // style: const TextStyle( // color: Colors.white, // fontSize: 10, // overflow: TextOverflow.ellipsis, // // fontWeight: FontWeight.w700, // ), // textAlign: TextAlign.center, // ), // ), // ), // ), // ), // ), // ), // ), // ), // ), // if (Platform.isWindows) if (!kIsWeb) if (Platform.isWindows) Obx( () => WindowsUygulamaBaslik( baslik: logic.subTitle.value, ), ), // const Positioned( // bottom: 0, // left: 0, // right: 0, // child: WindowsDurumCubugu(), // ), ], ), ), ); // .animate( // delay: 5000.ms, // this delay only happens once at the very start // onPlay: (controller) => controller.repeat(), // loop // ) // .shimmer(delay: 5000.ms,duration: 1000.ms); // t; } @override void dispose() { // Get.delete(); super.dispose(); } }