step 12 : ubah dari nomitism ke google apis untuk address
This commit is contained in:
@@ -16,7 +16,7 @@ class GoogleApisNotifier extends StateNotifier<GoogleApisState> {
|
||||
GoogleApisNotifier({required this.ref}) : super(GoogleApisStateInit());
|
||||
|
||||
void getAddressGoogleApis(
|
||||
{required double latitude, required double longitude}) async {
|
||||
{required String latitude, required String longitude}) async {
|
||||
try {
|
||||
state = GoogleApisStateLoading();
|
||||
final graphql = ref.read(graphqlProvider(''));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'package:absensi_sas/app/googleapis_location.dart';
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:camera_web/camera_web.dart';
|
||||
import 'dart:io';
|
||||
@@ -94,16 +95,16 @@ class PresensiScreen extends HookConsumerWidget {
|
||||
_locationData = await location.getLocation();
|
||||
|
||||
// Mendapatkan alamat dari posisi
|
||||
final address = await positionToAddress(
|
||||
final address = await positionToAddressGoogleApis(
|
||||
LatLng(_locationData.latitude!, _locationData.longitude!));
|
||||
|
||||
if (positionLongitude.value.isEmpty && positionLatitude.value.isEmpty) {
|
||||
if (address.city != "") {
|
||||
if (address != "") {
|
||||
isLoadingAddressUserLocation.value = false;
|
||||
|
||||
ref.read(googleApisProvider.notifier).getAddressGoogleApis(
|
||||
latitude: _locationData.latitude!,
|
||||
longitude: _locationData.longitude!,
|
||||
latitude: _locationData.latitude.toString(),
|
||||
longitude: _locationData.longitude.toString(),
|
||||
);
|
||||
|
||||
// String address =
|
||||
|
||||
@@ -24,6 +24,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
// import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
import '../../app/googleapis_location.dart';
|
||||
import '../../app/route.dart';
|
||||
import '../../provider/camera_controller_provider.dart';
|
||||
import '../../provider/current_check_distance_provider.dart';
|
||||
@@ -194,7 +195,7 @@ class PresensiSelfieScreen extends HookConsumerWidget {
|
||||
_locationData = await location.getLocation();
|
||||
|
||||
// Mendapatkan alamat dari posisi
|
||||
final address = await positionToAddress(
|
||||
final address = await positionToAddressGoogleApis(
|
||||
LatLng(_locationData.latitude!, _locationData.longitude!));
|
||||
|
||||
// final address = await positionToAddress(
|
||||
@@ -203,12 +204,12 @@ class PresensiSelfieScreen extends HookConsumerWidget {
|
||||
|
||||
// Mendapatkan alamat dari posisi
|
||||
if (positionLongitude.value.isEmpty && positionLatitude.value.isEmpty) {
|
||||
if (address.city != "") {
|
||||
if (address != "") {
|
||||
isLoadingAddressUserLocation.value = false;
|
||||
|
||||
ref.read(googleApisProvider.notifier).getAddressGoogleApis(
|
||||
latitude: _locationData.latitude!,
|
||||
longitude: _locationData.longitude!,
|
||||
latitude: _locationData.latitude.toString(),
|
||||
longitude: _locationData.longitude.toString(),
|
||||
);
|
||||
|
||||
// String address =
|
||||
|
||||
Reference in New Issue
Block a user