// ignore_for_file: unnecessary_overrides

import 'package:cached_network_image/cached_network_image.dart';
import 'package:customer/app/models/onboarding_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';

import '../../../../utils/fire_store_utils.dart';

class IntroScreenController extends GetxController {

  PageController pageController = PageController();
  RxInt currentPage = 0.obs;
  RxList<OnBoardingModel> onboardingList = <OnBoardingModel>[].obs;

  @override
  void onInit() {
    super.onInit();
    getOnBoardings();
  }

  Future<void> getOnBoardings() async {
    await FireStoreUtils.getOnboarding().then((value) {
      onboardingList.value = value;
      for (var item in value) {
        if (item.image != null && item.image!.isNotEmpty) {
          precacheImage(CachedNetworkImageProvider(item.image!), Get.context!);
        }
      }
    });
  }
}
