Compare commits

...

3 Commits

Author SHA1 Message Date
Abdusalom G'ayratov
297f7c368b BASE: Implement Localization. 2025-12-09 19:06:51 +05:00
Abdusalom G'ayratov
a6109290b3 BASE: Implement Localization In Home Screen. 2025-12-09 11:42:38 +05:00
Abdusalom G'ayratov
01c625b9c9 MINOR-FIX: DropDownMenu Problem Fix. 2025-12-09 11:34:02 +05:00
7 changed files with 101 additions and 70 deletions

View File

@@ -152,6 +152,19 @@
"nonVeg": "Non Veg", "nonVeg": "Non Veg",
"favourites": "Favourites", "favourites": "Favourites",
"orders": "Orders", "orders": "Orders",
"takeAway": "TakeAway" "takeAway": "TakeAway",
"seeAll": "See All",
"bestServingFood": "Best Servings Food",
"outCategories": "Our Categories",
"saveUpTo50Perc": "Save Up to 50% Off",
"stories": "Stories",
"bestFoodStories": "Best Food Stories Ever",
"error": "Error",
"couldNotLaunch": "Could not launch",
"exploreCategories": "Explore the Categories",
"noStoreFound": "No Store Found in Your Area",
"currentlyNoAvailableStoreInZone": "Currently, there are no available store in your zone. Try changing your location to find nearby options.",
"dineInReservations": "Dine-In Reservations",
"bookATable": "Book a table at your favorite restaurant and enjoy a delightful dining experience."
} }

View File

@@ -152,12 +152,34 @@ class ConstTexts {
static String favourites = "favourites"; static String favourites = "favourites";
static String orders = "orders"; static String orders = "orders";
static String takeAway = "takeAway"; static String takeAway = "takeAway";
// static String allStores = "allStores"; static String seeAll = "seeAll";
// static String alert = "alert"; static String bestServingFood = "bestServingFood";
// static String cancel = "cancel"; static String ourCategories = "outCategories";
// static String ok = "ok"; static String saveUpTo50Perc = "saveUpTo50Perc";
// static String freeDelivery = "freeDelivery"; static String error = "error";
// static String upto = "upto"; static String bestFoodStories = "bestFoodStories";
static String doYouWantChangeTheDeliverOption = "doYouWantChangeTheDeliverOption"; static String doYouWantChangeTheDeliverOption =
// static String cash = "cash"; "doYouWantChangeTheDeliverOption";
static String stories = "stories";
static String couldNotLaunch = "couldNotLaunch";
static String exploreCategories = "exploreCategories";
static String changeZone = "Change Zone";
static String noStoreFound = "noStoreFound";
static String currentlyNoAvailableStoreInZone = "currentlyNoAvailableStoreInZone";
static String dineInReservations = "dineInReservations";
static String bookATable = "bookATable";
// static String orders = "orders";
// static String takeAway = "takeAway";
// static String seeAll = "seeAll";
// static String bestServingFood = "bestServingFood";
// static String ourCategories = "outCategories";
// static String saveUpTo50Perc = "saveUpTo50Perc";
// static String error = "error";
// static String bestFoodStories = "bestFoodStories";
// static String doYouWantChangeTheDeliverOption =
// "doYouWantChangeTheDeliverOption";
// static String stories = "stories";
// static String couldNotLaunch = "couldNotLaunch";
// static String exploreCategories = "exploreCategories";
// static String changeZone = "Change Zone";
} }

View File

@@ -1,6 +1,7 @@
import 'dart:developer'; import 'dart:developer';
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/constant/const_texts.dart';
import 'package:customer/constant/constant.dart'; import 'package:customer/constant/constant.dart';
import 'package:customer/controllers/dash_board_controller.dart'; import 'package:customer/controllers/dash_board_controller.dart';
import 'package:customer/models/advertisement_model.dart'; import 'package:customer/models/advertisement_model.dart';
@@ -33,7 +34,7 @@ class FoodHomeController extends GetxController {
RxBool isLoading = true.obs; RxBool isLoading = true.obs;
RxBool isListView = true.obs; RxBool isListView = true.obs;
RxBool isPopular = true.obs; RxBool isPopular = true.obs;
RxString selectedOrderTypeValue = "Delivery".tr.obs; RxString selectedOrderTypeValue = "delivery".obs;
Rx<PageController> pageController = Rx<PageController> pageController =
PageController(viewportFraction: 0.877).obs; PageController(viewportFraction: 0.877).obs;
@@ -70,7 +71,7 @@ class FoodHomeController extends GetxController {
getCartData(); getCartData();
selectedOrderTypeValue.value = Preferences.getString( selectedOrderTypeValue.value = Preferences.getString(
Preferences.foodDeliveryType, Preferences.foodDeliveryType,
defaultValue: "Delivery", defaultValue: "delivery",
); );
await getZone(); await getZone();
FireStoreUtils.getAllNearestRestaurant().listen((event) async { FireStoreUtils.getAllNearestRestaurant().listen((event) async {

View File

@@ -1,3 +1,4 @@
import 'package:customer/constant/const_texts.dart';
import 'package:customer/constant/constant.dart'; import 'package:customer/constant/constant.dart';
import 'package:customer/controllers/dash_board_controller.dart'; import 'package:customer/controllers/dash_board_controller.dart';
import 'package:customer/controllers/dash_board_ecommarce_controller.dart'; import 'package:customer/controllers/dash_board_ecommarce_controller.dart';
@@ -52,28 +53,28 @@ class DashBoardEcommerceScreen extends StatelessWidget {
isDark, isDark,
index: 0, index: 0,
assetIcon: "assets/icons/ic_home.svg", assetIcon: "assets/icons/ic_home.svg",
label: 'Home'.tr, label: ConstTexts.home.tr,
controller: controller, controller: controller,
), ),
navigationBarItem( navigationBarItem(
isDark, isDark,
index: 1, index: 1,
assetIcon: "assets/icons/ic_fav.svg", assetIcon: "assets/icons/ic_fav.svg",
label: 'Favourites'.tr, label: ConstTexts.favourites.tr,
controller: controller, controller: controller,
), ),
navigationBarItem( navigationBarItem(
isDark, isDark,
index: 2, index: 2,
assetIcon: "assets/icons/ic_orders.svg", assetIcon: "assets/icons/ic_orders.svg",
label: 'Orders'.tr, label: ConstTexts.orders.tr,
controller: controller, controller: controller,
), ),
navigationBarItem( navigationBarItem(
isDark, isDark,
index: 3, index: 3,
assetIcon: "assets/icons/ic_profile.svg", assetIcon: "assets/icons/ic_profile.svg",
label: 'Profile'.tr, label: ConstTexts.profile.tr,
controller: controller, controller: controller,
), ),
] ]
@@ -82,35 +83,35 @@ class DashBoardEcommerceScreen extends StatelessWidget {
isDark, isDark,
index: 0, index: 0,
assetIcon: "assets/icons/ic_home.svg", assetIcon: "assets/icons/ic_home.svg",
label: 'Home'.tr, label: ConstTexts.home.tr,
controller: controller, controller: controller,
), ),
navigationBarItem( navigationBarItem(
isDark, isDark,
index: 1, index: 1,
assetIcon: "assets/icons/ic_fav.svg", assetIcon: "assets/icons/ic_fav.svg",
label: 'Favourites'.tr, label: ConstTexts.favourites.tr,
controller: controller, controller: controller,
), ),
navigationBarItem( navigationBarItem(
isDark, isDark,
index: 2, index: 2,
assetIcon: "assets/icons/ic_wallet.svg", assetIcon: "assets/icons/ic_wallet.svg",
label: 'Wallet'.tr, label: ConstTexts.wallet.tr,
controller: controller, controller: controller,
), ),
navigationBarItem( navigationBarItem(
isDark, isDark,
index: 3, index: 3,
assetIcon: "assets/icons/ic_orders.svg", assetIcon: "assets/icons/ic_orders.svg",
label: 'Orders'.tr, label: ConstTexts.orders.tr,
controller: controller, controller: controller,
), ),
navigationBarItem( navigationBarItem(
isDark, isDark,
index: 4, index: 4,
assetIcon: "assets/icons/ic_profile.svg", assetIcon: "assets/icons/ic_profile.svg",
label: 'Profile'.tr, label: ConstTexts.profile.tr,
controller: controller, controller: controller,
), ),
], ],

View File

@@ -1,3 +1,5 @@
// ignore_for_file: depend_on_referenced_packages
import 'package:customer/constant/const_texts.dart'; import 'package:customer/constant/const_texts.dart';
import 'package:customer/constant/constant.dart'; import 'package:customer/constant/constant.dart';
import 'package:customer/controllers/dine_in_controller.dart'; import 'package:customer/controllers/dine_in_controller.dart';
@@ -11,7 +13,6 @@ import 'package:customer/themes/app_them_data.dart';
import 'package:customer/themes/responsive.dart'; import 'package:customer/themes/responsive.dart';
import 'package:customer/themes/round_button_fill.dart'; import 'package:customer/themes/round_button_fill.dart';
import 'package:customer/utils/network_image_widget.dart'; import 'package:customer/utils/network_image_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@@ -82,7 +83,7 @@ class DineInScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
"Dine-In Reservations".tr, ConstTexts.dineInReservations.tr,
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 24,
fontFamily: AppThemeData.semiBold, fontFamily: AppThemeData.semiBold,
@@ -94,8 +95,7 @@ class DineInScreen extends StatelessWidget {
), ),
), ),
Text( Text(
"Book a table at your favorite restaurant and enjoy a delightful dining experience." ConstTexts.bookATable.tr,
.tr,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
@@ -133,7 +133,7 @@ class DineInScreen extends StatelessWidget {
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
Text( Text(
"No Store Found in Your Area".tr, ConstTexts.noStoreFound.tr,
style: TextStyle( style: TextStyle(
color: color:
isDark isDark
@@ -145,8 +145,7 @@ class DineInScreen extends StatelessWidget {
), ),
const SizedBox(height: 5), const SizedBox(height: 5),
Text( Text(
"Currently, there are no available store in your zone. Try changing your location to find nearby options." ConstTexts.currentlyNoAvailableStoreInZone.tr,
.tr,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: color:
@@ -160,7 +159,7 @@ class DineInScreen extends StatelessWidget {
const SizedBox(height: 20), const SizedBox(height: 20),
RoundedButtonFill( RoundedButtonFill(
borderRadius: 10.r, borderRadius: 10.r,
title: "Change Zone".tr, title: ConstTexts.changeZone.tr,
width: 55, width: 55,
height: 5.5, height: 5.5,
color: AppThemeData.primary300, color: AppThemeData.primary300,
@@ -184,7 +183,7 @@ class DineInScreen extends StatelessWidget {
const SizedBox(height: 10), const SizedBox(height: 10),
titleView( titleView(
isDark, isDark,
"Explore the Categories".tr, ConstTexts.exploreCategories.tr,
() { () {
Get.to(const ViewAllCategoryDineInScreen()); Get.to(const ViewAllCategoryDineInScreen());
}, },
@@ -220,7 +219,7 @@ class DineInScreen extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"New Arrivals".tr, ConstTexts.newArrivals.tr,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
@@ -241,12 +240,13 @@ class DineInScreen extends StatelessWidget {
"vendorList": "vendorList":
controller controller
.newArrivalRestaurantList, .newArrivalRestaurantList,
"title": "New Arrival", "title":
ConstTexts.newArrival.tr,
}, },
); );
}, },
child: Text( child: Text(
"View all".tr, ConstTexts.viewAll.tr,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
@@ -318,7 +318,7 @@ class DineInScreen extends StatelessWidget {
vertical: 10, vertical: 10,
), ),
child: Text( child: Text(
"Popular Stores".tr, ConstTexts.popularStores.tr,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
@@ -359,7 +359,7 @@ class DineInScreen extends StatelessWidget {
vertical: 10, vertical: 10,
), ),
child: Text( child: Text(
"All Stores".tr, ConstTexts.allStores.tr,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
@@ -427,7 +427,7 @@ class DineInScreen 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,
@@ -494,7 +494,7 @@ class PopularRestaurant 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),
], ],
), ),
@@ -757,7 +757,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),
], ],
), ),
@@ -1019,7 +1019,7 @@ class NewArrival 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,
], ],
), ),
@@ -1326,7 +1326,7 @@ class BannerBottomView extends StatelessWidget {
if (await canLaunchUrl(uri)) { if (await canLaunchUrl(uri)) {
await launchUrl(uri); await launchUrl(uri);
} else { } else {
ShowToastDialog.showToast("Could not launch".tr); ShowToastDialog.showToast(ConstTexts.couldNotLaunch.tr);
} }
} }
}, },

View File

@@ -1223,13 +1223,10 @@ class HomeScreen extends StatelessWidget {
isDark isDark
? AppThemeData.greyDark100 ? AppThemeData.greyDark100
: AppThemeData.grey100, : AppThemeData.grey100,
value: controller.selectedOrderTypeValue.value.tr, value: controller.selectedOrderTypeValue.value,
icon: const Icon(Icons.keyboard_arrow_down), icon: const Icon(Icons.keyboard_arrow_down),
items: items:
<String>[ ["delivery", "takeaway"].map((String value) {
ConstTexts.delivery,
ConstTexts.takeAway,
].map((String value) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: Text( child: Text(
@@ -1391,7 +1388,7 @@ class PopularRestaurant 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),
], ],
), ),
@@ -1998,7 +1995,7 @@ class NewArrival 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,
], ],
), ),
@@ -2221,7 +2218,7 @@ class AdvertisementHomeCard extends StatelessWidget {
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.black.withOpacity(0.1), color: Colors.black.withValues(alpha: 0.1),
blurRadius: isDark ? 6 : 2, blurRadius: isDark ? 6 : 2,
spreadRadius: 0, spreadRadius: 0,
offset: Offset(0, isDark ? 3 : 1), offset: Offset(0, isDark ? 3 : 1),
@@ -2698,7 +2695,7 @@ class BannerView extends StatelessWidget {
if (await canLaunchUrl(uri)) { if (await canLaunchUrl(uri)) {
await launchUrl(uri); await launchUrl(uri);
} else { } else {
ShowToastDialog.showToast("Could not launch".tr); ShowToastDialog.showToast(ConstTexts.couldNotLaunch.tr);
} }
} }
}, },
@@ -2970,7 +2967,7 @@ class StoryView extends StatelessWidget {
height: Responsive.height(100, context), height: Responsive.height(100, context),
width: Responsive.width(100, context), width: Responsive.width(100, context),
), ),
Container(color: Colors.black.withOpacity(0.30)), Container(color: Colors.black.withValues(alpha: 0.30)),
Padding( Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 5, horizontal: 5,
@@ -2988,7 +2985,7 @@ class StoryView extends StatelessWidget {
if (snapshot.hasError) { if (snapshot.hasError) {
return Center( return Center(
child: Text( child: Text(
'${"Error".tr}: ${snapshot.error}', '${ConstTexts.error.tr}: ${snapshot.error}',
), ),
); );
} else if (snapshot.data == null) { } else if (snapshot.data == null) {

View File

@@ -787,12 +787,10 @@ class HomeScreenTwo extends StatelessWidget {
DropdownButton<String>( DropdownButton<String>(
isDense: false, isDense: false,
underline: const SizedBox(), underline: const SizedBox(),
value: controller.selectedOrderTypeValue.value.tr, value: controller.selectedOrderTypeValue.value,
icon: const Icon(Icons.keyboard_arrow_down), icon: const Icon(Icons.keyboard_arrow_down),
items: items:
<String>[ConstTexts.delivery, ConstTexts.takeAway].map(( ["delivery", "takeaway"].map((String value) {
String value,
) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: Text( child: Text(
@@ -821,12 +819,11 @@ class HomeScreenTwo 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: ConstTexts.ok.tr,
positiveString: "Ok".tr, negativeString: ConstTexts.cancel.tr,
negativeString: "Cancel".tr,
positiveClick: () async { positiveClick: () async {
await Preferences.setString( await Preferences.setString(
Preferences.foodDeliveryType, Preferences.foodDeliveryType,
@@ -888,7 +885,7 @@ class CategoryView extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"Our Categories".tr, ConstTexts.ourCategories.tr,
style: TextStyle( style: TextStyle(
fontFamily: AppThemeData.semiBold, fontFamily: AppThemeData.semiBold,
color: color:
@@ -904,7 +901,7 @@ class CategoryView extends StatelessWidget {
Get.to(const ViewAllCategoryScreen()); Get.to(const ViewAllCategoryScreen());
}, },
child: Text( child: Text(
"See all".tr, ConstTexts.seeAll.tr,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontFamily: AppThemeData.medium, fontFamily: AppThemeData.medium,
@@ -919,7 +916,7 @@ class CategoryView extends StatelessWidget {
], ],
), ),
GradientText( GradientText(
'Best Servings Food'.tr, ConstTexts.bestServingFood.tr,
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 24,
fontFamily: 'Inter Tight', fontFamily: 'Inter Tight',
@@ -1023,7 +1020,7 @@ class OfferView extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"Large Discounts".tr, ConstTexts.largestDiscounts.tr,
style: TextStyle( style: TextStyle(
fontFamily: AppThemeData.semiBold, fontFamily: AppThemeData.semiBold,
color: color:
@@ -1046,7 +1043,7 @@ class OfferView extends StatelessWidget {
); );
}, },
child: Text( child: Text(
"See all".tr, ConstTexts.seeAll.tr,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontFamily: AppThemeData.medium, fontFamily: AppThemeData.medium,
@@ -1061,7 +1058,7 @@ class OfferView extends StatelessWidget {
], ],
), ),
GradientText( GradientText(
'Save Upto 50% Off'.tr, ConstTexts.saveUpTo50Perc.tr,
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 24,
fontFamily: 'Inter Tight', fontFamily: 'Inter Tight',
@@ -1119,7 +1116,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,
], ],
), ),
@@ -1289,7 +1286,7 @@ class StoryView extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"Stories".tr, ConstTexts.stories.tr,
style: TextStyle( style: TextStyle(
fontFamily: AppThemeData.semiBold, fontFamily: AppThemeData.semiBold,
color: color:
@@ -1303,7 +1300,7 @@ class StoryView extends StatelessWidget {
], ],
), ),
GradientText( GradientText(
'Best Food Stories Ever'.tr, ConstTexts.bestFoodStories.tr,
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 24,
fontFamily: 'Inter Tight', fontFamily: 'Inter Tight',
@@ -1353,7 +1350,7 @@ class StoryView extends StatelessWidget {
height: Responsive.height(100, context), height: Responsive.height(100, context),
width: Responsive.width(100, context), width: Responsive.width(100, context),
), ),
Container(color: Colors.black.withOpacity(0.30)), Container(color: Colors.black.withValues(alpha: 0.30)),
Padding( Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 5, horizontal: 5,
@@ -1371,7 +1368,7 @@ class StoryView extends StatelessWidget {
if (snapshot.hasError) { if (snapshot.hasError) {
return Center( return Center(
child: Text( child: Text(
'${"Error".tr}: ${snapshot.error}', '${ConstTexts.error.tr}: ${snapshot.error}',
), ),
); );
} else if (snapshot.data == null) { } else if (snapshot.data == null) {