Facebook
From natural, 1 Month ago, written in Dart.
This paste is a reply to Untitled from natural - go back
Embed
Viewing differences between Untitled and Re: Untitled
 GestureDetector(\n                  onTap: () async {\n                    bool isServiceEnabled = await Geolocator.isLocationServiceEnabled();\n                    if (isServiceEnabled) {\n                      import 'package:flutter/material.dart';

class LocationDialog extends StatelessWidget {
  
final GoogleMapController controller = await model.controller.future;
                      controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(
                        target: model.userLocation == null
                            ? LatLng(34.0059934, 71.5057068)
                            : LatLng(model.userLocation!.latitude, model.userLocation!.longitude),
                        zoom: 14,
                      )));
                    } else {
                      Get.dialog(LocationDialog(
                        
successMsg;
  final onPressed;

  LocationDialog({@required this.successMsg, required this.onPressed});

  @override
  Widget build(BuildContext context) {
    return AlertDialog(
      content: Text("To continue turn on device location, which uses Google's location service"),
      actions: [
        ElevatedButton(
          
onPressed: () async {
                          await Geolocator.openLocationSettings();
                          Get.back();
                          await model.getCurrentLocationUpdates();
                          setState(() async {
                            final GoogleMapController controller = await model.controller.future;
                            controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(
                              target: model.userLocation == null
                                  ? LatLng(34.0059934, 71.5057068)
                                  : LatLng(model.userLocation!.latitude, model.userLocation!.longitude),
                              zoom: 14,
                            )));
                          });
                        },
                      ));
                    }
                  },
                  
{
            Navigator.pop(context); // Close the dialog
          },
          
child: const CircleAvatar(
                      backgroundColor: commonColor_4,
                      
Text('No Thanks'),
        ),
        ElevatedButton(
          onPressed: onPressed,
          
child: Icon(
                        Icons.location_on,
                        color: Colors.white,
                      )),
                ),
Text('Ok'),
        ),
      ],
    );
  }
}