import 'dart:async';

import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart';
import 'package:rounded_loading_button_plus/rounded_loading_button.dart';

import '../../Helper/Locationservice/Locationservice.dart';
import '../../View/Authentication/Logiview.dart';

class LocationPermissionController extends GetxController{

  LocationService locationService = LocationService();
  Position? resultPosition;

  final RoundedLoadingButtonController btnController = RoundedLoadingButtonController();


  getLatLong() async {
    resultPosition = await locationService.getLocation();
    // print('resultPosition$resultPosition');
    if (resultPosition != null) {
      btnController.reset();
      Get.to(()=>LoginView());
    }
  }


  void doSomething() async {
    Timer(const Duration(seconds: 1), () async {
      btnController.success();

      getLatLong();
    });
  }


  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
  }
}