8-10
This commit is contained in:
@@ -2,20 +2,27 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/home/map_page_controller.dart';
|
||||
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/home/menu_controller.dart';
|
||||
import 'map_widget.dart/buttom_sheet_map_show.dart';
|
||||
import 'map_widget.dart/map_menu_widget.dart';
|
||||
import 'map_widget.dart/menu_map_page.dart';
|
||||
import 'map_widget.dart/picker_animation_container.dart';
|
||||
|
||||
class MapPage extends StatelessWidget {
|
||||
const MapPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(MapController());
|
||||
Get.put(MyMenuController());
|
||||
return Scaffold(
|
||||
body: GetBuilder<MapController>(
|
||||
builder: (controller) => Stack(
|
||||
children: [
|
||||
GoogleMap(
|
||||
body: Stack(
|
||||
children: [
|
||||
GetBuilder<MapController>(
|
||||
builder: (controller) => GoogleMap(
|
||||
onMapCreated: controller.onMapCreated,
|
||||
cameraTargetBounds: CameraTargetBounds(controller.boundsdata),
|
||||
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
|
||||
@@ -34,12 +41,15 @@ class MapPage extends StatelessWidget {
|
||||
'${argument.latitude.toString()},${argument.longitude.toString()}');
|
||||
|
||||
Get.back();
|
||||
controller.changeButtomSheetShown();
|
||||
controller.bottomSheet();
|
||||
},
|
||||
);
|
||||
},
|
||||
onTap: (argument) {
|
||||
controller.hidePlaces();
|
||||
|
||||
controller.changeButtomSheetShown();
|
||||
controller.bottomSheet();
|
||||
},
|
||||
initialCameraPosition: CameraPosition(
|
||||
@@ -58,8 +68,13 @@ class MapPage extends StatelessWidget {
|
||||
infoWindow: const InfoWindow(title: 'my location'),
|
||||
),
|
||||
Marker(
|
||||
markerId: const MarkerId('destination'),
|
||||
position: controller.mydestination),
|
||||
markerId: const MarkerId('destination'),
|
||||
position: controller.mydestination,
|
||||
draggable: true,
|
||||
onDragEnd: (v) {
|
||||
print(v);
|
||||
},
|
||||
),
|
||||
},
|
||||
polylines: {
|
||||
Polyline(
|
||||
@@ -82,116 +97,44 @@ class MapPage extends StatelessWidget {
|
||||
buildingsEnabled: true,
|
||||
mapToolbarEnabled: true,
|
||||
onCameraMove: (position) {
|
||||
controller.mylocation = position.target;
|
||||
controller.newMylocation = position.target;
|
||||
// print('my' + controller.mylocation.toString());
|
||||
// print('new' + controller.newMylocation.toString());
|
||||
},
|
||||
myLocationEnabled: true,
|
||||
// liteModeEnabled: true,
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Container(
|
||||
decoration:
|
||||
const BoxDecoration(color: AppColor.secondaryColor),
|
||||
child: TextField(
|
||||
decoration: const InputDecoration(
|
||||
suffixIcon: Icon(Icons.search)),
|
||||
controller: controller.placeController,
|
||||
onChanged: (value) {
|
||||
if (controller.placeController.text.length > 6) {
|
||||
controller.getPlaces();
|
||||
controller.changeHeight();
|
||||
}
|
||||
},
|
||||
// onEditingComplete: () => controller.changeHeight(),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height:
|
||||
controller.places.isNotEmpty ? controller.height : 0,
|
||||
color: AppColor.secondaryColor,
|
||||
child: ListView.builder(
|
||||
itemCount: controller.places.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var res = controller.places[index];
|
||||
return TextButton(
|
||||
onPressed: () {
|
||||
controller.changeHeight();
|
||||
Get.defaultDialog(
|
||||
title: 'Are You sure to ride to ${res['name']}',
|
||||
middleText: '',
|
||||
onConfirm: () {
|
||||
controller.getMap(
|
||||
'${controller.mylocation.latitude.toString()},${controller.mylocation.longitude.toString()}',
|
||||
"${res['geometry']['location']['lat']},${res['geometry']['location']['lng']}");
|
||||
controller.places = [];
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Image.network(
|
||||
res['icon'],
|
||||
width: 30,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
res['name'].toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
res['vicinity'].toString(),
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'rate',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
res['rating'].toString(),
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
thickness: 1,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
// Positioned(
|
||||
// bottom: 0,
|
||||
// left: 0,
|
||||
// right: 0,
|
||||
// child: Container(
|
||||
// height: 130, color: AppColor.secondaryColor, child: null))
|
||||
],
|
||||
),
|
||||
),
|
||||
const PickerIconOnMap(),
|
||||
PickerAnimtionContainer(),
|
||||
const MapMenuWidget(),
|
||||
const MenuIconMapPageWidget(),
|
||||
buttomSheetMapPage()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PickerIconOnMap extends StatelessWidget {
|
||||
const PickerIconOnMap({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) => Positioned(
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: controller.isPickerShown
|
||||
? const Icon(
|
||||
Icons.add_location,
|
||||
color: Colors.purple,
|
||||
)
|
||||
: const SizedBox(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user