BASE: Implement Localization In Home Screen.

This commit is contained in:
2025-12-08 13:51:09 +05:00
parent 653f1f93bf
commit 81895849df
4 changed files with 157 additions and 56 deletions

View File

@@ -129,6 +129,16 @@
"newArrival": "New Arrivals", "newArrival": "New Arrivals",
"topBrands": "Top Brands", "topBrands": "Top Brands",
"styleUp": "Style up with the latest fits, now at unbeatable prices.", "styleUp": "Style up with the latest fits, now at unbeatable prices.",
"additionlOffers": "Additional Offers" "additionlOffers": "Additional Offers",
"largestDiscounts": "Largest Discounts",
"newArrivals": "New Arrivals",
"popularStores": "Popular Stores",
"allStores": "All Stores",
"alert": "Alert",
"cancel": "Cancel",
"ok": "Ok",
"doYouWantChangeTheDeliverOption": "Do you really want to change the delivery option? Your cart will be empty.",
"freeDelivery": "Free Delivery",
"upto": "Upto"
} }

View File

@@ -130,15 +130,15 @@ class ConstTexts {
static String topBrands = "topBrands"; static String topBrands = "topBrands";
static String styleUp = "styleUp"; static String styleUp = "styleUp";
static String additionlOffers = "additionlOffers"; static String additionlOffers = "additionlOffers";
// static String enableLocation = "enableLocation"; static String largestDiscounts = "largestDiscounts";
// static String allowLocation = "allowLocation"; static String newArrivals = "newArrivals";
// static String useCurrentLocation = "useCurrentLocation"; static String popularStores = "popularStores";
// static String setFromMap = "setFromMap"; static String allStores = "allStores";
// static String enterManuallyLocation = "enterManuallyLocation"; static String alert = "alert";
// static String changeLanguage = "changeLanguage"; static String cancel = "cancel";
// static String aroundTheCity = "aroundTheCity"; static String ok = "ok";
// static String rideDetails = "rideDetails"; static String freeDelivery = "freeDelivery";
// static String youDoNothaveSufficientwalletBalance = "youDoNothaveSufficientwalletBalance"; static String upto = "upto";
// static String somethingWentWrong = "somethingWentWrong"; static String doYouWantChangeTheDeliverOption = "doYouWantChangeTheDeliverOption";
// static String cash = "cash"; static String cash = "cash";
} }

View File

@@ -654,7 +654,7 @@ class HomeScreen extends StatelessWidget {
children: [ children: [
titleView( titleView(
isDark, isDark,
"Largest Discounts", ConstTexts.largestDiscounts.tr,
() { () {
Get.to( Get.to(
const DiscountRestaurantListScreen(), const DiscountRestaurantListScreen(),
@@ -709,7 +709,7 @@ class HomeScreen extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"New Arrivals".tr, ConstTexts.newArrival.tr,
textAlign: textAlign:
TextAlign TextAlign
.start, .start,
@@ -744,7 +744,7 @@ class HomeScreen extends StatelessWidget {
}); });
}, },
child: Text( child: Text(
"View all".tr, ConstTexts.viewAll.tr,
textAlign: textAlign:
TextAlign TextAlign
.center, .center,
@@ -825,7 +825,7 @@ class HomeScreen extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"Highlights for you" ConstTexts.highlightsForU
.tr, .tr,
textAlign: textAlign:
TextAlign TextAlign
@@ -855,7 +855,7 @@ class HomeScreen extends StatelessWidget {
}); });
}, },
child: Text( child: Text(
"View all" ConstTexts.viewAll
.tr, .tr,
textAlign: textAlign:
TextAlign TextAlign
@@ -971,7 +971,7 @@ class HomeScreen extends StatelessWidget {
vertical: 10, vertical: 10,
), ),
child: Text( child: Text(
"Popular Stores" ConstTexts.popularStores
.tr, .tr,
textAlign: textAlign:
TextAlign TextAlign
@@ -1025,7 +1025,7 @@ class HomeScreen extends StatelessWidget {
vertical: 10, vertical: 10,
), ),
child: Text( child: Text(
"All Stores".tr, ConstTexts.allStores.tr,
textAlign: textAlign:
TextAlign TextAlign
.center, .center,
@@ -1247,12 +1247,12 @@ class HomeScreen extends StatelessWidget {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return CustomDialogBox( return CustomDialogBox(
title: "Alert".tr, title: ConstTexts.alert.tr,
descriptions: descriptions:
"Do you really want to change the delivery option? Your cart will be empty." ConstTexts.doYouWantChangeTheDeliverOption
.tr, .tr,
positiveString: "Ok".tr, positiveString: ConstTexts.ok.tr,
negativeString: "Cancel".tr, negativeString: ConstTexts.cancel.tr,
positiveClick: () async { positiveClick: () async {
await Preferences.setString( await Preferences.setString(
Preferences.foodDeliveryType, Preferences.foodDeliveryType,
@@ -1305,7 +1305,7 @@ class HomeScreen extends StatelessWidget {
onPress!(); onPress!();
}, },
child: Text( child: Text(
"View all".tr, ConstTexts.viewAll.tr,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontFamily: AppThemeData.regular, fontFamily: AppThemeData.regular,
@@ -1479,7 +1479,7 @@ class PopularRestaurant extends StatelessWidget {
), ),
const SizedBox(width: 5), const SizedBox(width: 5),
Text( Text(
"Free Delivery".tr, ConstTexts.freeDelivery.tr,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: AppThemeData.carRent600, color: AppThemeData.carRent600,
@@ -1685,7 +1685,7 @@ class AllRestaurant extends StatelessWidget {
begin: const Alignment(-0.00, -1.00), begin: const Alignment(-0.00, -1.00),
end: const Alignment(0, 1), end: const Alignment(0, 1),
colors: [ colors: [
Colors.black.withOpacity(0), Colors.black.withValues(alpha: 0),
const Color(0xFF111827), const Color(0xFF111827),
], ],
), ),
@@ -1784,7 +1784,7 @@ class AllRestaurant extends StatelessWidget {
), ),
const SizedBox(width: 5), const SizedBox(width: 5),
Text( Text(
"Free Delivery".tr, ConstTexts.freeDelivery.tr,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: AppThemeData.carRent600, color: AppThemeData.carRent600,
@@ -2081,7 +2081,7 @@ class NewArrival extends StatelessWidget {
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Text( Text(
"Free Delivery".tr, ConstTexts.freeDelivery.tr,
textAlign: TextAlign.start, textAlign: TextAlign.start,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
@@ -2491,7 +2491,7 @@ class OfferView extends StatelessWidget {
begin: const Alignment(-0.00, -1.00), begin: const Alignment(-0.00, -1.00),
end: const Alignment(0, 1), end: const Alignment(0, 1),
colors: [ colors: [
Colors.black.withOpacity(0), Colors.black.withValues(alpha: 0),
AppThemeData.grey900, AppThemeData.grey900,
], ],
), ),
@@ -2504,7 +2504,7 @@ class OfferView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"Upto".tr, ConstTexts.upto.tr,
textAlign: TextAlign.start, textAlign: TextAlign.start,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
@@ -2568,7 +2568,7 @@ class OfferView extends StatelessWidget {
), ),
const SizedBox(width: 5), const SizedBox(width: 5),
Text( Text(
"Free Delivery".tr, ConstTexts.freeDelivery.tr,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -3268,7 +3268,7 @@ class MapView extends StatelessWidget {
), ),
colors: [ colors: [
Colors.black Colors.black
.withOpacity(0), .withValues(alpha: 0),
const Color( const Color(
0xFF111827, 0xFF111827,
), ),
@@ -3403,7 +3403,7 @@ class MapView extends StatelessWidget {
width: 5, width: 5,
), ),
Text( Text(
"Free Delivery" ConstTexts.freeDelivery
.tr, .tr,
style: TextStyle( style: TextStyle(
fontSize: fontSize:

View File

@@ -80,26 +80,118 @@ class ServiceListScreen extends StatelessWidget {
SizedBox(height: 10.h), SizedBox(height: 10.h),
// Other Services Section // Other Services Section
_otherServicesCardMaker( controller.sectionList.firstWhereOrNull(
image: "assets/images/garderob_img.png", (element) =>
title: ConstTexts.updateYourWardrobe.tr, element.serviceTypeFlag ==
subtitle: ConstTexts.weDeliverSafely.tr, "ondemand-service",
), ) ==
_otherServicesCardMaker( null
image: "assets/images/keys_img.png", ? SizedBox.shrink()
title: ConstTexts.rent.tr, : _otherServicesCardMaker(
subtitle: ConstTexts.hugeSelectionOfAds.tr, image: "assets/images/garderob_img.png",
), title: ConstTexts.updateYourWardrobe.tr,
_otherServicesCardMaker( subtitle: ConstTexts.weDeliverSafely.tr,
image: "assets/images/cosmetics_img.png", onTap: () {
title: ConstTexts.cosmetics.tr, SectionModel? innerSectionModel = controller
subtitle: ConstTexts.moreThan1000Products.tr, .sectionList
), .firstWhereOrNull(
_otherServicesCardMaker( (element) =>
image: "assets/images/products_img.png", element.serviceTypeFlag ==
title: ConstTexts.foodProducts.tr, "ondemand-service",
subtitle: ConstTexts.moreThan1000Products.tr, );
),
if (innerSectionModel != null) {
controller.onServiceTap(
context,
innerSectionModel,
);
}
},
),
controller.sectionList.firstWhereOrNull(
(element) =>
element.serviceTypeFlag ==
"rental-service",
) ==
null
? SizedBox.shrink()
: _otherServicesCardMaker(
image: "assets/images/keys_img.png",
title: ConstTexts.rent.tr,
subtitle: ConstTexts.hugeSelectionOfAds.tr,
onTap: () {
SectionModel? innerSectionModel = controller
.sectionList
.firstWhereOrNull(
(element) =>
element.serviceTypeFlag ==
"rental-service",
);
if (innerSectionModel != null) {
controller.onServiceTap(
context,
innerSectionModel,
);
}
},
),
controller.sectionList.firstWhereOrNull(
(element) =>
element.serviceTypeFlag ==
"ecommerce-service",
) ==
null
? SizedBox.shrink()
: _otherServicesCardMaker(
image: "assets/images/cosmetics_img.png",
title: ConstTexts.cosmetics.tr,
subtitle: ConstTexts.moreThan1000Products.tr,
onTap: () {
SectionModel? innerSectionModel = controller
.sectionList
.firstWhereOrNull(
(element) =>
element.serviceTypeFlag ==
"ecommerce-service",
);
if (innerSectionModel != null) {
controller.onServiceTap(
context,
innerSectionModel,
);
}
},
),
controller.sectionList.firstWhereOrNull(
(element) =>
element.serviceTypeFlag ==
"ondemand-service",
) ==
null
? SizedBox.shrink()
: _otherServicesCardMaker(
image: "assets/images/products_img.png",
title: ConstTexts.foodProducts.tr,
subtitle: ConstTexts.moreThan1000Products.tr,
onTap: () {
SectionModel? innerSectionModel = controller
.sectionList
.firstWhereOrNull(
(element) =>
element.serviceTypeFlag ==
"ondemand-service",
);
if (innerSectionModel != null) {
controller.onServiceTap(
context,
innerSectionModel,
);
}
},
),
SizedBox(height: 45.h), SizedBox(height: 45.h),
], ],
), ),
@@ -113,11 +205,10 @@ class ServiceListScreen extends StatelessWidget {
required String image, required String image,
required String title, required String title,
required String subtitle, required String subtitle,
required VoidCallback onTap,
}) { }) {
return InkWell( return InkWell(
onTap: () { onTap: onTap,
log("Other Service Card Tapped: $title");
},
child: Container( child: Container(
width: double.infinity, width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 16.r).copyWith(bottom: 10.r), margin: EdgeInsets.symmetric(horizontal: 16.r).copyWith(bottom: 10.r),