step 3 : hapus ai_barcode_scanner, ai barcode, update permission_handler, flutter_map,latlong2
This commit is contained in:
127
lib/widget/map_dialog.dart
Normal file
127
lib/widget/map_dialog.dart
Normal file
@@ -0,0 +1,127 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
|
||||
import '../app/constant.dart';
|
||||
|
||||
typedef void MyFunction();
|
||||
|
||||
showMapDialog({
|
||||
required BuildContext context,
|
||||
required double lat,
|
||||
required double long,
|
||||
required MyFunction confirm,
|
||||
required MyFunction notConfirm,
|
||||
required String address,
|
||||
}) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
"Konfirmasi lokasi",
|
||||
style: Constant.body1(context: context),
|
||||
),
|
||||
content: SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 280),
|
||||
height: Constant.getActualY(context: context, y: 200),
|
||||
child: SizedBox(
|
||||
width: Constant.getActualX(context: context, x: 200),
|
||||
height: Constant.getActualY(context: context, y: 100),
|
||||
// child: FlutterMap(
|
||||
// options: MapOptions(
|
||||
// center: LatLng(lat, long),
|
||||
// zoom: 16,
|
||||
// ),
|
||||
// nonRotatedChildren: [
|
||||
// Align(
|
||||
// alignment: Alignment.bottomLeft,
|
||||
// child: Text(
|
||||
// address,
|
||||
// style: Constant.body1(context: context).copyWith(
|
||||
// backgroundColor: Colors.black.withOpacity(0.5),
|
||||
// color: Colors.white),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// children: [
|
||||
// TileLayer(
|
||||
// urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
// userAgentPackageName: 'com.example.app',
|
||||
// ),
|
||||
// MarkerLayer(
|
||||
// markers: [
|
||||
// Marker(
|
||||
// point: LatLng(lat, long),
|
||||
// width: 100,
|
||||
// height: 100,
|
||||
// builder: (context) => const Icon(
|
||||
// Icons.location_on,
|
||||
// color: Colors.red,
|
||||
// size: 50,
|
||||
// )),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
child: FlutterMap(
|
||||
options: MapOptions(
|
||||
initialCenter: LatLng(lat, long),
|
||||
initialZoom: 16,
|
||||
),
|
||||
children: [
|
||||
TileLayer(
|
||||
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
userAgentPackageName: 'com.example.app',
|
||||
),
|
||||
MarkerLayer(
|
||||
markers: [
|
||||
Marker(
|
||||
point: LatLng(lat, long),
|
||||
width: 100,
|
||||
height: 100,
|
||||
child: const Icon(
|
||||
Icons.location_on,
|
||||
color: Colors.red,
|
||||
size: 50,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
address,
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
// backgroundColor: Colors.black.withOpacity(0.5),
|
||||
backgroundColor: Colors.black.withAlpha(128),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
OutlinedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
notConfirm();
|
||||
},
|
||||
child: const Text("Ulangi"),
|
||||
),
|
||||
SizedBox(width: Constant.getActualX(context: context, x: 5)),
|
||||
ElevatedButton(onPressed: confirm, child: Text("ya")),
|
||||
SizedBox(width: Constant.getActualX(context: context, x: 10)),
|
||||
],
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(24)),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user