BASE: Update Icons & Name Of The App.

This commit is contained in:
2025-12-04 10:23:59 +05:00
parent b04050384d
commit e602782edd
228 changed files with 34364 additions and 7905 deletions

View File

@@ -9,8 +9,7 @@ import 'package:customer/widget/place_picker/selected_location_model.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:get/get.dart' hide Trans;
import '../../controllers/enter_manually_location_controller.dart';
import '../../controllers/theme_controller.dart';
import '../../themes/app_them_data.dart';
@@ -40,23 +39,50 @@ class EnterManuallyLocationScreen extends StatelessWidget {
controller.isLoading.value
? Constant.loader()
: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
padding: const EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
controller.mode == "Edit" ? "Edit Address".tr() : "Add a New Address".tr(),
style: AppThemeData.boldTextStyle(fontSize: 24, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
controller.mode == "Edit"
? "Edit Address".tr()
: "Add a New Address".tr(),
style: AppThemeData.boldTextStyle(
fontSize: 24,
color:
isDark
? AppThemeData.greyDark900
: AppThemeData.grey900,
),
),
const SizedBox(height: 10),
Text("Enter your location details so we can deliver your orders quickly and accurately.".tr(), style: AppThemeData.mediumTextStyle(fontSize: 14, color: AppThemeData.grey600)),
Text(
"Enter your location details so we can deliver your orders quickly and accurately."
.tr(),
style: AppThemeData.mediumTextStyle(
fontSize: 14,
color: AppThemeData.grey600,
),
),
const SizedBox(height: 24),
Row(
children: [
Expanded(child: Text("Set as Default Address".tr(), style: AppThemeData.mediumTextStyle(fontSize: 14, color: AppThemeData.grey600))),
Expanded(
child: Text(
"Set as Default Address".tr(),
style: AppThemeData.mediumTextStyle(
fontSize: 14,
color: AppThemeData.grey600,
),
),
),
Transform.scale(
scale: 0.7, // Decrease the size (try 0.5, 0.6, etc.)
scale:
0.7, // Decrease the size (try 0.5, 0.6, etc.)
child: Switch(
value: controller.isDefault.value,
onChanged: (value) {
@@ -74,23 +100,53 @@ class EnterManuallyLocationScreen extends StatelessWidget {
context: context,
onTap: () async {
if (Constant.selectedMapType == 'osm') {
final result = await Get.to(() => MapPickerPage());
final result = await Get.to(
() => MapPickerPage(),
);
if (result != null) {
final firstPlace = result;
final lat = firstPlace.coordinates.latitude;
final lng = firstPlace.coordinates.longitude;
final lat =
firstPlace.coordinates.latitude;
final lng =
firstPlace.coordinates.longitude;
final address = firstPlace.address;
controller.localityEditingController.value.text = address.toString();
controller.location.value = UserLocation(latitude: lat, longitude: lng);
controller
.localityEditingController
.value
.text = address.toString();
controller.location.value = UserLocation(
latitude: lat,
longitude: lng,
);
}
} else {
Get.to(LocationPickerScreen())!.then((value) async {
Get.to(LocationPickerScreen())!.then((
value,
) async {
if (value != null) {
SelectedLocationModel selectedLocationModel = value;
SelectedLocationModel
selectedLocationModel = value;
controller.localityEditingController.value.text = Utils.formatAddress(selectedLocation: selectedLocationModel);
controller.location.value = UserLocation(latitude: selectedLocationModel.latLng!.latitude, longitude: selectedLocationModel.latLng!.longitude);
controller
.localityEditingController
.value
.text = Utils.formatAddress(
selectedLocation:
selectedLocationModel,
);
controller
.location
.value = UserLocation(
latitude:
selectedLocationModel
.latLng!
.latitude,
longitude:
selectedLocationModel
.latLng!
.longitude,
);
}
});
}
@@ -109,23 +165,55 @@ class EnterManuallyLocationScreen extends StatelessWidget {
context: context,
onTap: () async {
if (Constant.selectedMapType == 'osm') {
final result = await Get.to(() => MapPickerPage());
final result = await Get.to(
() => MapPickerPage(),
);
if (result != null) {
final firstPlace = result;
final lat = firstPlace.coordinates.latitude;
final lng = firstPlace.coordinates.longitude;
final lat =
firstPlace.coordinates.latitude;
final lng =
firstPlace.coordinates.longitude;
final address = firstPlace.address;
controller.localityEditingController.value.text = address.toString();
controller.location.value = UserLocation(latitude: lat, longitude: lng);
controller
.localityEditingController
.value
.text = address.toString();
controller
.location
.value = UserLocation(
latitude: lat,
longitude: lng,
);
}
} else {
Get.to(LocationPickerScreen())!.then((value) async {
Get.to(LocationPickerScreen())!.then((
value,
) async {
if (value != null) {
SelectedLocationModel selectedLocationModel = value;
SelectedLocationModel
selectedLocationModel = value;
controller.localityEditingController.value.text = Utils.formatAddress(selectedLocation: selectedLocationModel);
controller.location.value = UserLocation(latitude: selectedLocationModel.latLng!.latitude, longitude: selectedLocationModel.latLng!.longitude);
controller
.localityEditingController
.value
.text = Utils.formatAddress(
selectedLocation:
selectedLocationModel,
);
controller
.location
.value = UserLocation(
latitude:
selectedLocationModel
.latLng!
.latitude,
longitude:
selectedLocationModel
.latLng!
.longitude,
);
Get.back();
}
});
@@ -133,20 +221,50 @@ class EnterManuallyLocationScreen extends StatelessWidget {
},
);
},
child: Padding(padding: const EdgeInsets.only(right: 10), child: Icon(Icons.gps_fixed, size: 24, color: AppThemeData.ecommerce300)),
child: Padding(
padding: const EdgeInsets.only(right: 10),
child: Icon(
Icons.gps_fixed,
size: 24,
color: AppThemeData.ecommerce300,
),
),
),
),
),
const SizedBox(height: 15),
TextFieldWidget(title: "Flat/House/Floor/Building*".tr(), hintText: "Enter address details".tr(), controller: controller.houseBuildingTextEditingController.value),
TextFieldWidget(
title: "Flat/House/Floor/Building*".tr(),
hintText: "Enter address details".tr(),
controller:
controller
.houseBuildingTextEditingController
.value,
),
const SizedBox(height: 15),
TextFieldWidget(title: "Area/Sector/Locality*".tr(), hintText: "Enter area/locality".tr(), controller: controller.localityEditingController.value),
TextFieldWidget(
title: "Area/Sector/Locality*".tr(),
hintText: "Enter area/locality".tr(),
controller:
controller.localityEditingController.value,
),
const SizedBox(height: 15),
TextFieldWidget(title: "Nearby Landmark".tr(), hintText: "Add a landmark".tr(), controller: controller.landmarkEditingController.value),
TextFieldWidget(
title: "Nearby Landmark".tr(),
hintText: "Add a landmark".tr(),
controller:
controller.landmarkEditingController.value,
),
const SizedBox(height: 30),
Container(height: 1, color: AppThemeData.grey200),
const SizedBox(height: 25),
Text("Save Address As".tr(), style: AppThemeData.boldTextStyle(fontSize: 14, color: AppThemeData.grey900)),
Text(
"Save Address As".tr(),
style: AppThemeData.boldTextStyle(
fontSize: 14,
color: AppThemeData.grey900,
),
),
const SizedBox(height: 10),
Wrap(
spacing: 10,
@@ -155,17 +273,37 @@ class EnterManuallyLocationScreen extends StatelessWidget {
.map(
(item) => GestureDetector(
onTap: () {
controller.selectedSaveAs.value = item;
controller.selectedSaveAs.value =
item;
},
child: Container(
decoration: BoxDecoration(
color: controller.selectedSaveAs.value == item ? AppThemeData.primary300 : AppThemeData.grey100,
borderRadius: BorderRadius.circular(10),
color:
controller
.selectedSaveAs
.value ==
item
? AppThemeData.primary300
: AppThemeData.grey100,
borderRadius: BorderRadius.circular(
10,
),
),
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 10,
),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Text(
controller.getLocalizedSaveAs(item),
style: AppThemeData.mediumTextStyle(color: controller.selectedSaveAs.value == item ? AppThemeData.grey50 : AppThemeData.grey600),
style: AppThemeData.mediumTextStyle(
color:
controller
.selectedSaveAs
.value ==
item
? AppThemeData.grey50
: AppThemeData.grey600,
),
textAlign: TextAlign.center,
),
),
@@ -175,55 +313,111 @@ class EnterManuallyLocationScreen extends StatelessWidget {
),
const SizedBox(height: 30),
RoundedButtonFill(
borderRadius: 10.r,
borderRadius: 10.r,
title: "Save Address".tr(),
color: AppThemeData.primary300,
textColor: AppThemeData.grey50,
onPress: () async {
if (controller.location.value.latitude == null || controller.location.value.longitude == null) {
ShowToastDialog.showToast("Please select Location".tr());
} else if (controller.houseBuildingTextEditingController.value.text.isEmpty) {
ShowToastDialog.showToast("Please Enter Flat / House / Floor / Building".tr());
} else if (controller.localityEditingController.value.text.isEmpty) {
ShowToastDialog.showToast("Please Enter Area / Sector / Locality".tr());
if (controller.location.value.latitude == null ||
controller.location.value.longitude == null) {
ShowToastDialog.showToast(
"Please select Location".tr(),
);
} else if (controller
.houseBuildingTextEditingController
.value
.text
.isEmpty) {
ShowToastDialog.showToast(
"Please Enter Flat / House / Floor / Building"
.tr(),
);
} else if (controller
.localityEditingController
.value
.text
.isEmpty) {
ShowToastDialog.showToast(
"Please Enter Area / Sector / Locality".tr(),
);
} else {
ShowToastDialog.showLoader("Please wait...".tr());
ShowToastDialog.showLoader(
"Please wait...".tr(),
);
//Common values
controller.shippingModel.value.location = controller.location.value;
controller.shippingModel.value.addressAs = controller.selectedSaveAs.value;
controller.shippingModel.value.address = controller.houseBuildingTextEditingController.value.text;
controller.shippingModel.value.locality = controller.localityEditingController.value.text;
controller.shippingModel.value.landmark = controller.landmarkEditingController.value.text;
controller.shippingModel.value.location =
controller.location.value;
controller.shippingModel.value.addressAs =
controller.selectedSaveAs.value;
controller.shippingModel.value.address =
controller
.houseBuildingTextEditingController
.value
.text;
controller.shippingModel.value.locality =
controller
.localityEditingController
.value
.text;
controller.shippingModel.value.landmark =
controller
.landmarkEditingController
.value
.text;
if (controller.mode.value == "Edit") {
//Edit Mode
controller.shippingAddressList.value =
controller.shippingAddressList.map((address) {
if (address.id == controller.shippingModel.value.id) {
return controller.shippingModel.value; // replace existing one
controller.shippingAddressList.map((
address,
) {
if (address.id ==
controller.shippingModel.value.id) {
return controller
.shippingModel
.value; // replace existing one
}
return address;
}).toList();
Constant.selectedLocation = controller.shippingModel.value;
Constant.selectedLocation =
controller.shippingModel.value;
} else {
//Add Mode
controller.shippingModel.value.id = Constant.getUuid();
controller.shippingModel.value.isDefault = controller.shippingAddressList.isEmpty ? true : false;
controller.shippingAddressList.add(controller.shippingModel.value);
controller.shippingModel.value.id =
Constant.getUuid();
controller.shippingModel.value.isDefault =
controller.shippingAddressList.isEmpty
? true
: false;
controller.shippingAddressList.add(
controller.shippingModel.value,
);
}
//Handle default address switch
if (controller.isDefault.value) {
controller.shippingAddressList.value =
controller.shippingAddressList.map((address) {
address.isDefault = address.id == controller.shippingModel.value.id ? true : false;
controller.shippingAddressList.map((
address,
) {
address.isDefault =
address.id ==
controller
.shippingModel
.value
.id
? true
: false;
return address;
}).toList();
}
controller.userModel.value.shippingAddress = controller.shippingAddressList;
await FireStoreUtils.updateUser(controller.userModel.value);
controller.userModel.value.shippingAddress =
controller.shippingAddressList;
await FireStoreUtils.updateUser(
controller.userModel.value,
);
ShowToastDialog.closeLoader();
Get.back(result: true);