// ignore_for_file: library_private_types_in_public_api import 'dart:io'; import 'package:fikoyt_merkez/apps/mesaici/model/model_ayarlar.dart'; import 'package:fikoyt_merkez/apps/mesaici/servisler/fikoyt.mesaici.service.dart'; import 'package:fikoyt_merkez/core/widgets/fiko_ui/fiko_button/fiko_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:get/get.dart'; import 'package:vrouter/vrouter.dart'; import '../../../../core/widgets/base_page/base_page_view.dart'; import '../../../../core/widgets/draggable_home.dart'; import '../../../../core/widgets/fikoyt_elastic/fikoyt_elastic.dart'; import '../../base_page_mesaici_view.dart'; import '../../widgets/mesaici_navigasyon/mesaici_navigasyon.dart'; import '../../widgets/uygulama_baslik/uygulama_baslik.dart'; class PageUygulamaAyarlariLogic extends GetxController {} class PageMesaiciUygulamaAyarlari extends StatefulWidget { const PageMesaiciUygulamaAyarlari({super.key}); @override _PageMesaiciUygulamaAyarlariState createState() => _PageMesaiciUygulamaAyarlariState(); } class _PageMesaiciUygulamaAyarlariState extends State { PageUygulamaAyarlariLogic logic = Get.put(PageUygulamaAyarlariLogic()); BasePageLogic basePageLogic = Get.put(BasePageLogic()); BasePageMesaiciLogic basePageMesaiciLogic = Get.put(BasePageMesaiciLogic()); FikoYTMesaiciService mesaiciService = Get.put(FikoYTMesaiciService()); //---> @override Widget build(BuildContext context) { SchedulerBinding.instance.addPostFrameCallback((_) { basePageLogic.subTitle.value = "📱 Uygulama Ayarları"; }); ScreenSizeTypes screenType = FikoYTElastic.getScreenSizeType(context); [ // ScreenSizeTypes.small, ScreenSizeTypes.mini, ScreenSizeTypes.extraMini ].contains(screenType); return DraggableHome( leading: const UygulamaBaslikSol(), title: UygulamaBaslikOrta(), actions: const [ UygulamaBaslikSag(), ], headerWidget: PageView( children: [ Container( color: Colors.transparent, //Colors.orange, height: 300 - kToolbarHeight - 10, margin: const EdgeInsets.only( top: kToolbarHeight, bottom: 10, right: 10, left: 10), child: Container( child: Column( children: [ Center( child: CircleAvatar( backgroundColor: Colors.blueAccent.shade700, radius: 64, child: CircleAvatar( backgroundColor: Colors.blueAccent.shade100, radius: 54, child: const CircleAvatar( radius: 54, child: Text( "📱", style: TextStyle( fontSize: 54, ), ), ), //CircleAvatar ), //CircleAvatar ), //CircleAvatar ), FikoButton1( text: "Uygulama Ayarları", textSize: 24, textStrokeColor: Colors.blue, ), SizedBox( height: 24.0, child: ListView( shrinkWrap: true, scrollDirection: Axis.horizontal, children: [ SizedBox( width: 33, child: MaterialButton( elevation: 0, minWidth: 0, shape: RoundedRectangleBorder( borderRadius: const BorderRadius.all(Radius.circular(5)), side: BorderSide( width: 1, color: Colors.blue.withOpacity(0.5), style: BorderStyle.solid), ), padding: const EdgeInsets.all(0), child: const Text("🏠"), // const Icon(Icons.home, // color: Colors.lightBlue, size: 14), // color: Colors.white, onPressed: () async { // Scaffold.of(context).openEndDrawer(); context.vRouter.to("/mesaici"); }, ), ), const SizedBox(width: 3), SizedBox( width: 33, child: MaterialButton( elevation: 0, minWidth: 0, shape: RoundedRectangleBorder( borderRadius: const BorderRadius.all(Radius.circular(5)), side: BorderSide( width: 1, color: Colors.blue.withOpacity(0.5), style: BorderStyle.solid), ), padding: const EdgeInsets.all(0), // color: Colors.white, onPressed: () async { // Scaffold.of(context).openEndDrawer(); context.vRouter.to("/mesaici/bildirimler"); }, child: const Text("🛎️"), // const Icon(Icons.notifications, // color: Colors.lightBlue, size: 14), ), ), // const SizedBox(width: 3), // SizedBox( // width: 33, // child: MaterialButton( // elevation: 0, // minWidth: 0, // shape: RoundedRectangleBorder( // borderRadius: // const BorderRadius.all(Radius.circular(5)), // side: BorderSide( // width: 1, // color: Colors.blue.withOpacity(0.5), // style: BorderStyle.solid), // ), // padding: const EdgeInsets.all(0), // child: const Text("👨‍👩‍👦‍👦"), // // const Icon(Icons.people, // // color: Colors.lightBlue, size: 14), // // color: Colors.white, // onPressed: () async { // context.vRouter.to("/mesaici/arkadaslar"); // // Scaffold.of(context).openEndDrawer(); // // context.vRouter.to("/uye/arkadaslar"); // }, // ), // ), // const SizedBox(width: 3), // SizedBox( // width: 33, // child: MaterialButton( // elevation: 0, // minWidth: 0, // shape: RoundedRectangleBorder( // borderRadius: // const BorderRadius.all(Radius.circular(5)), // side: BorderSide( // width: 1, // color: Colors.blue.withOpacity(0.5), // style: BorderStyle.solid), // ), // padding: const EdgeInsets.all(0), // // color: Colors.white, // onPressed: () { // if (kDebugMode) { // context.vRouter.to("/mesaici/mesajlar"); // // Scaffold.of(context).openEndDrawer(); // // print('clicked'); // } // }, // child: const Text("✉️"), // // const Icon(Icons.mail, // // color: Colors.lightBlue, size: 14), // ), // ), const SizedBox(width: 3), SizedBox( width: 33, child: MaterialButton( elevation: 0, minWidth: 0, shape: RoundedRectangleBorder( borderRadius: const BorderRadius.all(Radius.circular(5)), side: BorderSide( width: 1, color: Colors.blue.withOpacity(0.5), style: BorderStyle.solid), ), padding: const EdgeInsets.all(0), child: const Text("⚙️"), // const Icon(Icons.settings, // color: Colors.lightBlue, size: 14), // color: Colors.white, onPressed: () { // if (kDebugMode) { context.vRouter.to("/mesaici/ayarlar"); // Scaffold.of(context).openEndDrawer(); print('clicked'); // } }, ), ), ], ), ), Center( child: Text( "Bu Sihirli Sayfa İle Ayarlarınızı Kolayca Düzenleyin", style: TextStyle(color: Colors.grey.shade800, fontSize: 10), ), ), const MesaiciNavigasyon(), ], ), ), ), ], ), body: [ Padding( padding: const EdgeInsets.all(5), child: Column( children: [ if (Platform.isAndroid) Column( children: [ const Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Divider( indent: 20.0, endIndent: 10.0, thickness: 1, ), ), Text( "🧰 Servis Ayarları", style: TextStyle(color: Colors.blueGrey, fontSize: 14), ), Expanded( child: Divider( indent: 10.0, endIndent: 20.0, thickness: 1, ), ), ], ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "🚀", style: TextStyle( fontSize: 36, ), ), ), title: const Text( 'Otomatik Çalıştır', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Mesaici Açılırken Servisi Çalıştır', style: TextStyle( fontWeight: FontWeight.w300, ), ), Align( alignment: Alignment.centerRight, child: SizedBox( height: 36, child: FittedBox( fit: BoxFit.fill, child: Obx( () => Switch( value: mesaiciService.mesaiciAyarlar .uygulamaAyarlari.otomatikBaslat.value, onChanged: (value) { mesaiciService.ayarlar.setBool( "mesaici.servis.otomatik-baslat", value); mesaiciService .mesaiciAyarlar .uygulamaAyarlari .otomatikBaslat .value = value; }, ), ), ), ), ) ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey, // onTap: () {}, ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "▶️", style: TextStyle( fontSize: 36, ), ), ), title: const Text( 'Açılışta Çalıştır', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Cihaz Açılırken Servisi Çalıştır', style: TextStyle( fontWeight: FontWeight.w300, ), ), Align( alignment: Alignment.centerRight, child: SizedBox( height: 36, child: FittedBox( fit: BoxFit.fill, child: Obx(() => Switch( value: mesaiciService .mesaiciAyarlar .uygulamaAyarlari .baslangictaCalistir .value, onChanged: (value) { mesaiciService .mesaiciAyarlar .uygulamaAyarlari .baslangictaCalistir .value = value; }, )), ), ), ), ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey, // onTap: () {}, ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "💡", style: TextStyle( fontSize: 36, ), ), ), title: const Text( 'Servis Durumu', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Mesaicinin Arkaplanda Aktif Kalmasını Sağla', style: TextStyle( fontWeight: FontWeight.w300, ), ), Align( alignment: Alignment.centerRight, child: Obx( () => TextButton( // icon: const Text("💡"), child: mesaiciService.mesaiciAyarlar .uygulamaAyarlari.servisCalisiyor.value ? const Text( "💡 Servisi Durdur", style: TextStyle( color: Colors.blue, fontWeight: FontWeight.bold, fontSize: 14, ), ) : const Text( "💡 Servisi Başlat", style: TextStyle( color: Colors.blue, fontWeight: FontWeight.bold, fontSize: 14, ), ), onPressed: () { if (mesaiciService .mesaiciAyarlar .uygulamaAyarlari .servisCalisiyor .isTrue) { mesaiciService.arkaPlanServis .invoke("mesaici.servis.durdur"); } else { mesaiciService.arkaPlanServis .startService(); } }, ), ), ) ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey, // onTap: () {}, ), ], ), const Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Divider( indent: 20.0, endIndent: 10.0, thickness: 1, ), ), Text( "🖥️ Açılış Ekranı", style: TextStyle(color: Colors.blueGrey, fontSize: 14), ), Expanded( child: Divider( indent: 10.0, endIndent: 20.0, thickness: 1, ), ), ], ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "📺", style: TextStyle( fontSize: 36, ), ), ), title: const Text( 'İlk Ekranı Her Zaman Göster', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Her Program Açılışında İlk Ekranı Göster', style: TextStyle( fontWeight: FontWeight.w300, ), ), Align( alignment: Alignment.centerRight, child: SizedBox( height: 36, child: FittedBox( fit: BoxFit.fill, child: Obx(() => Switch( value: mesaiciService.ayarlarModel!.value .uygulamaAyarlari.ilkEkraniHerZamanGoster, onChanged: (value) { mesaiciService .ayarlarModel! .value .uygulamaAyarlari .ilkEkraniHerZamanGoster = value; mesaiciService.ayarlarModel!.refresh(); // mesaiciService.ayarlariKaydet(); }, )), ), ), ), ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey, // onTap: () {}, ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "📺", style: TextStyle( fontSize: 36, ), ), ), title: const Text( 'İlk Ekranı Göster', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Bir Sonraki Program Açılışında İlk Ekranı Göster', style: TextStyle( fontWeight: FontWeight.w300, ), ), Align( alignment: Alignment.centerRight, child: SizedBox( height: 36, child: FittedBox( fit: BoxFit.fill, child: Obx(() => Switch( value: mesaiciService .mesaiciAyarlar .uygulamaAyarlari .ilkEkranAcilistaGoster .value, onChanged: (value) { mesaiciService .ayarlarModel! .value .uygulamaAyarlari .ilkEkranAcilistaGoster = value; mesaiciService.ayarlarModel!.refresh(); }, )), ), ), ), ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey, // onTap: () {}, ), /** */ const Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Divider( indent: 20.0, endIndent: 10.0, thickness: 1, ), ), Text( "📢 Bildirim Ayarları", style: TextStyle(color: Colors.blueGrey, fontSize: 14), ), Expanded( child: Divider( indent: 10.0, endIndent: 20.0, thickness: 1, ), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ FikoButton1( text: "🔕 Tümünü Kapat", textSize: 10, edgePadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 1), textColor: Colors.black, textStrokeColor: Colors.transparent, borderColor: Colors.blue, onPressed: () { mesaiciService.ayarlarModel?.value.bildirimAyarlari .tumunuKapat(); }, ), const SizedBox( width: 5, ), FikoButton1( text: "🔔 Tümünü Aç", textSize: 10, edgePadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 1), textColor: Colors.black, textStrokeColor: Colors.transparent, borderColor: Colors.blue, onPressed: () { mesaiciService.ayarlarModel?.value.bildirimAyarlari .tumunuAc(); }, ), ], ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "🛎️", style: TextStyle( fontSize: 36, ), ), ), title: const Text( 'Genel Bildirimler', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Cihazınızda Mesaici Ve FikoYT\'a Ait Genel Bildirimleri Göstermenize Yarar.', style: TextStyle( fontWeight: FontWeight.w300, ), ), Align( alignment: Alignment.centerRight, child: SizedBox( height: 36, child: FittedBox( fit: BoxFit.fill, child: Obx(() => Switch( value: mesaiciService.ayarlarModel!.value .bildirimAyarlari.genelBildirimler, onChanged: (value) { mesaiciService .ayarlarModel! .value .bildirimAyarlari .genelBildirimler = value; mesaiciService.ayarlarModel!.refresh(); }, )), ), ), ), ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey, // onTap: () {}, ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "🛎️", style: TextStyle( fontSize: 36, ), ), ), title: const Text( 'İşe Başlama Bildirimleri', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'İş Saatiniz Geldiğinde Eğer Karta Hala Giriş Yapılmamışsa Bildirimler Aracılığıyla Giriş Yapmanızı Sağlar.', style: TextStyle( fontWeight: FontWeight.w300, ), ), Align( alignment: Alignment.centerRight, child: SizedBox( height: 36, child: FittedBox( fit: BoxFit.fill, child: Obx(() => Switch( value: mesaiciService.ayarlarModel!.value .bildirimAyarlari.iseBaslamaBildirimleri, onChanged: (value) { mesaiciService .ayarlarModel! .value .bildirimAyarlari .iseBaslamaBildirimleri = value; mesaiciService.ayarlarModel!.refresh(); }, )), ), ), ), ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey, // onTap: () {}, ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "🛎️", style: TextStyle( fontSize: 36, ), ), ), title: const Text( 'İşi Bitirme Bildirimleri', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'İş Saatiniz Bittiğinde Eğer Karta Hala Çıkış Yapılmamışsa Bildirimler Aracılığıyla Çıkış Yapmanızı Sağlar.', style: TextStyle( fontWeight: FontWeight.w300, ), ), Align( alignment: Alignment.centerRight, child: SizedBox( height: 36, child: FittedBox( fit: BoxFit.fill, child: Obx(() => Switch( value: mesaiciService.ayarlarModel!.value .bildirimAyarlari.isiBitirmeBildirimleri, onChanged: (value) { mesaiciService .ayarlarModel! .value .bildirimAyarlari .isiBitirmeBildirimleri = value; mesaiciService.ayarlarModel!.refresh(); }, )), ), ), ), ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey, // onTap: () {}, ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "🛎️", style: TextStyle( fontSize: 36, ), ), ), title: const Text( 'Mola Başlangıç Bildirimleri', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Mola Saatiniz Başladığında Eğer Karta Hala Giriş Yapılmamışsa Bildirimler Aracılığıyla Giriş Yapmanızı Sağlar.', style: TextStyle( fontWeight: FontWeight.w300, ), ), Align( alignment: Alignment.centerRight, child: SizedBox( height: 36, child: FittedBox( fit: BoxFit.fill, child: Obx(() => Switch( value: mesaiciService.ayarlarModel!.value .bildirimAyarlari.molaBaslangicBildirimleri, onChanged: (value) { mesaiciService .ayarlarModel! .value .bildirimAyarlari .molaBaslangicBildirimleri = value; mesaiciService.ayarlarModel!.refresh(); }, )), ), ), ), ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey, // onTap: () {}, ), ListTile( leading: const SizedBox( // height: double.infinity, child: Text( "🛎️", style: TextStyle( fontSize: 36, ), ), ), title: const Text( 'Mola Bitiş Bildirimleri', style: TextStyle( fontWeight: FontWeight.w600, ), ), dense: false, subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Mola Saatiniz Bittiğinde Eğer Karta Hala Giriş Yapılmamışsa Bildirimler Aracılığıyla Giriş Yapmanızı Sağlar.', style: TextStyle( fontWeight: FontWeight.w300, ), ), Align( alignment: Alignment.centerRight, child: SizedBox( height: 36, child: FittedBox( fit: BoxFit.fill, child: Obx(() => Switch( value: mesaiciService.ayarlarModel!.value .bildirimAyarlari.molaBitisBildirimleri, onChanged: (value) { mesaiciService .ayarlarModel! .value .bildirimAyarlari .molaBitisBildirimleri = value; mesaiciService.ayarlarModel!.refresh(); }, )), ), ), ), ], ), // trailing: const Icon(Icons.chevron_right_sharp), isThreeLine: true, splashColor: Colors.grey, // onTap: () {}, ), /** */ const Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Divider( indent: 20.0, endIndent: 10.0, thickness: 1, ), ), Text( "📊 Diğer Ayarlar", style: TextStyle(color: Colors.blueGrey, fontSize: 14), ), Expanded( child: Divider( indent: 10.0, endIndent: 20.0, thickness: 1, ), ), ], ), ], ), ), ], headerExpandedHeight: 315, // stretchMaxHeight: 100, fullyStretchable: false, backgroundColor: Colors.grey.shade200, bottomNavigationBar: null, bottomNavigationBarHeight: 0, centerTitle: true, alwaysShowLeadingAndAction: true, appBarColor: Colors.blue.shade500, alwaysShowTitle: true, curvedBodyRadius: 0, onStretchTrigger: () async { context.vRouter.to("/"); }, ); } @override void dispose() { Get.delete(); super.dispose(); } }