BASE: Finish Cab Type Section UI.
This commit is contained in:
@@ -31,7 +31,10 @@ class LocationPickerScreen extends StatelessWidget {
|
||||
onMapCreated: (controllers) {
|
||||
controller.mapController = controllers;
|
||||
},
|
||||
initialCameraPosition: CameraPosition(target: controller.selectedLocation.value!, zoom: 15),
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: controller.selectedLocation.value!,
|
||||
zoom: 15,
|
||||
),
|
||||
onTap: (LatLng tappedPosition) {
|
||||
controller.selectedLocation.value = tappedPosition;
|
||||
controller.getAddressFromLatLng(tappedPosition);
|
||||
@@ -44,14 +47,18 @@ class LocationPickerScreen extends StatelessWidget {
|
||||
markerId: const MarkerId("selected-location"),
|
||||
position: controller.selectedLocation.value!,
|
||||
onTap: () {
|
||||
controller.getAddressFromLatLng(controller.selectedLocation.value!);
|
||||
controller.getAddressFromLatLng(
|
||||
controller.selectedLocation.value!,
|
||||
);
|
||||
},
|
||||
),
|
||||
},
|
||||
onCameraMove: controller.onMapMoved,
|
||||
onCameraIdle: () {
|
||||
if (controller.selectedLocation.value != null) {
|
||||
controller.getAddressFromLatLng(controller.selectedLocation.value!);
|
||||
controller.getAddressFromLatLng(
|
||||
controller.selectedLocation.value!,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -67,29 +74,65 @@ class LocationPickerScreen extends StatelessWidget {
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(color: isDark ? AppThemeData.greyDark50 : AppThemeData.grey50, borderRadius: BorderRadius.circular(30)),
|
||||
child: Padding(padding: const EdgeInsets.all(10), child: Icon(Icons.arrow_back_ios_new_outlined, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.greyDark50
|
||||
: AppThemeData.grey50,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Icon(
|
||||
Icons.arrow_back_ios_new_outlined,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.greyDark900
|
||||
: AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
Prediction? p = await PlacesAutocomplete.show(context: context, apiKey: Constant.mapAPIKey, mode: Mode.overlay, language: "en");
|
||||
Prediction? p = await PlacesAutocomplete.show(
|
||||
context: context,
|
||||
apiKey: Constant.mapAPIKey,
|
||||
mode: Mode.overlay,
|
||||
language: "en",
|
||||
);
|
||||
if (p != null) {
|
||||
final detail = await _places.getDetailsByPlaceId(p.placeId!);
|
||||
final detail = await _places.getDetailsByPlaceId(
|
||||
p.placeId!,
|
||||
);
|
||||
final lat = detail.result.geometry!.location.lat;
|
||||
final lng = detail.result.geometry!.location.lng;
|
||||
final LatLng pos = LatLng(lat, lng);
|
||||
controller.selectedLocation.value = pos;
|
||||
controller.mapController?.animateCamera(CameraUpdate.newLatLngZoom(pos, 15));
|
||||
controller.mapController?.animateCamera(
|
||||
CameraUpdate.newLatLngZoom(pos, 15),
|
||||
);
|
||||
controller.getAddressFromLatLng(pos);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: Responsive.width(100, context),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(60)),
|
||||
child: Row(children: [Icon(Icons.search), SizedBox(width: 8), Text("Search place...".tr)]),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(60),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.search),
|
||||
SizedBox(width: 8),
|
||||
Text("Search place...".tr),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -101,13 +144,34 @@ class LocationPickerScreen extends StatelessWidget {
|
||||
right: 20,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: const [BoxShadow(color: Colors.black26, blurRadius: 5)]),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.black26, blurRadius: 5),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Obx(() => Text(controller.address.value, textAlign: TextAlign.center, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500))),
|
||||
Obx(
|
||||
() => Text(
|
||||
controller.address.value,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
RoundedButtonFill(title: "Confirm Location".tr, height: 5.5, color: AppThemeData.primary300, textColor: AppThemeData.grey50, onPress: () => controller.confirmLocation()),
|
||||
RoundedButtonFill(
|
||||
title: "Confirm Location",
|
||||
height: 5.5,
|
||||
color: AppThemeData.mainColor,
|
||||
textColor: AppThemeData.grey50,
|
||||
onPress: () => controller.confirmLocation(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user