// ignore_for_file: unnecessary_overrides import 'dart:io'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:IQ/app/global/static_informs.dart'; import 'package:IQ/app/modules/home/models/notifications_model.dart'; import 'package:IQ/app/modules/home/providers/language_currency.dart'; import 'package:IQ/app/modules/home/providers/notifications.dart'; import 'package:IQ/app/modules/home/providers/service.dart'; class NotificationsScreenController extends GetxController with WidgetsBindingObserver { bool fetchNotifsData = false; // ignore: prefer_typing_uninitialized_variables var fetchLoadingNotifsDataVar; Future onRefresh() async { fetchNotifsData = false; notifications = null; fetchLoadingNotifsDataVar = fetchLoadingNotifsData(); update(); } fetchLoadingNotifsData() async { await getUserNotificationsInforms(""); if (getUserNotificationsInformsLoads) { fetchNotifsData = true; listOfNotifs = notifications?.data ?? []; update(); } } String activiationType = '${service?.data?.profileName}'; String subscriptionCurrency = languagesCurrencyModel?.data?.currency ?? ''; String profileName = service?.data?.profileName ?? ''; List? listOfNotifs = notifications?.data ?? []; @override void didChangeAppLifecycleState(AppLifecycleState state) { super.didChangeAppLifecycleState(state); if (state == AppLifecycleState.inactive || state == AppLifecycleState.detached || state == AppLifecycleState.paused) return; if (state == AppLifecycleState.resumed) { defaultLocale = Platform.localeName.split('_')[0]; snackBarText = 'back_twice'.tr; } } @override void onInit() { fetchLoadingNotifsDataVar = fetchLoadingNotifsData(); WidgetsBinding.instance.addObserver(this); super.onInit(); } @override void onReady() { super.onReady(); } @override void onClose() { WidgetsBinding.instance.removeObserver(this); } }