feat: changing language done

This commit is contained in:
jahongireshonqulov
2025-10-25 20:13:11 +05:00
parent 2750564b08
commit 651a7e5e9d
31 changed files with 621 additions and 57 deletions

View File

@@ -1,3 +0,0 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 16.25L14.3335 12.5833C15.2502 11.25 15.8333 9.6667 15.8333 7.9167C15.8333 3.58336 12.25 0 7.91665 0C3.58334 0 0 3.58336 0 7.9167C0 12.25 3.58334 15.8334 7.91665 15.8334C9.66665 15.8334 11.2501 15.25 12.5835 14.3333L16.25 18L18 16.25ZM2.5 8C2.5 5.00001 4.91667 2.58334 7.91665 2.58334C10.9166 2.58334 13.3333 5.00001 13.3333 8C13.3333 11 10.9166 13.4167 7.91665 13.4167C4.91667 13.4167 2.5 11 2.5 8Z" fill="black"/>
</svg>

Before

Width:  |  Height:  |  Size: 531 B

View File

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M19 6V3V0H16H7H6H4V6H0V19C0 21.7614 2.23858 24 5 24H19C21.7614 24 24 21.7614 24 19V6H19ZM7 3V6H16V3H7Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 271 B

BIN
assets/icons/ic_eng.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

3
assets/icons/ic_gift.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg width="17" height="19" viewBox="0 0 17 19" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.208 1.84935e-06C5.908 1.84935e-06 6.55 0.267002 7.033 0.708002L8.333 1.892L9.633 0.708002C10.1312 0.251855 10.7825 -0.000788628 11.458 1.84935e-06C12.1759 0.00132267 12.864 0.287021 13.3717 0.794555C13.8795 1.30209 14.1654 1.99011 14.167 2.708C14.1657 3.22468 14.0184 3.73047 13.742 4.167H16.667V10H9.583V4.167H7.083V10H0V4.167H2.925C2.64861 3.73047 2.50127 3.22468 2.5 2.708C2.50158 1.99028 2.7874 1.30241 3.29491 0.794907C3.80241 0.287402 4.49028 0.00158681 5.208 1.84935e-06ZM7.083 12.5H0V18.333H7.083V12.5ZM9.583 18.333H16.667V12.5H9.583V18.333Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 721 B

3
assets/icons/ic_help.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg width="19" height="19" viewBox="0 0 19 19" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.167 4.917C8.5 4.917 7.833 5.083 7.25 5.417L3.667 1.833C5.167 0.667 7.084 0 9.167 0C11.25 0 13.167 0.667 14.667 1.833L11.084 5.417C10.4992 5.08687 9.83855 4.91456 9.167 4.917ZM12.833 11C13.167 10.417 13.333 9.75 13.333 9.083C13.333 8.417 13.167 7.75 12.833 7.167L16.417 3.583C17.583 5.083 18.25 7 18.25 9.083C18.25 11.167 17.584 13.083 16.417 14.583L12.833 11ZM11.083 12.75C10.5 13.083 9.833 13.25 9.167 13.25C8.49545 13.2524 7.83483 13.0801 7.25 12.75L3.667 16.334C5.167 17.501 7.084 18.168 9.167 18.168C11.25 18.168 13.167 17.501 14.667 16.334L11.084 12.751L11.083 12.75ZM0.00100017 9.084C0.00100017 7.001 0.668 5.084 1.835 3.584L5.418 7.168C5.085 7.751 4.918 8.418 4.918 9.084C4.918 9.751 5.085 10.418 5.418 11.001L1.834 14.584C0.667 13.084 0 11.167 0 9.084H0.00100017Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 943 B

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><title>ionicons-v5-l</title><path d="M478.33,433.6l-90-218a22,22,0,0,0-40.67,0l-90,218a22,22,0,1,0,40.67,16.79L316.66,406H419.33l18.33,44.39A22,22,0,0,0,458,464a22,22,0,0,0,20.32-30.4ZM334.83,362,368,281.65,401.17,362Z"/><path d="M267.84,342.92a22,22,0,0,0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73,39.65-53.68,62.11-114.75,71.27-143.49H330a22,22,0,0,0,0-44H214V70a22,22,0,0,0-44,0V90H54a22,22,0,0,0,0,44H251.25c-9.52,26.95-27.05,69.5-53.79,108.36-31.41-41.68-43.08-68.65-43.17-68.87a22,22,0,0,0-40.58,17c.58,1.38,14.55,34.23,52.86,83.93.92,1.19,1.83,2.35,2.74,3.51-39.24,44.35-77.74,71.86-93.85,80.74a22,22,0,1,0,21.07,38.63c2.16-1.18,48.6-26.89,101.63-85.59,22.52,24.08,38,35.44,38.93,36.1a22,22,0,0,0,30.75-4.9Z"/></svg>

After

Width:  |  Height:  |  Size: 945 B

3
assets/icons/ic_like.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg width="22" height="20" viewBox="0 0 22 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M16 0C13.8 0 12.2 1.2 11 2.5C9.8 1.3 8.2 0 6 0C2.5 0 0 2.9 0 6.5C0 8.3 0.7 9.9 2 11L11 19.5L20 11C21.2 9.8 22 8.3 22 6.5C22 2.9 19.5 0 16 0Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 269 B

View File

@@ -0,0 +1,3 @@
<svg width="15" height="19" viewBox="0 0 15 19" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0V18.333L4.583 15.833L7.5 18.333L10.417 15.833L15 18.333V0H0ZM11.667 6.667H3.333V4.167H11.667V6.667Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 232 B

View File

@@ -0,0 +1,3 @@
<svg width="19" height="19" viewBox="0 0 19 19" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.333 18.333L18.333 8.333V0H10L0 10L8.333 18.333Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 179 B

View File

@@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="12" cy="12" r="12" fill="black"/>
<path d="M12 4L13.7961 9.52786H19.6085L14.9062 12.9443L16.7023 18.4721L12 15.0557L7.29772 18.4721L9.09383 12.9443L4.39155 9.52786H10.2039L12 4Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 309 B

BIN
assets/icons/ic_rus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,8 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="12" cy="12" r="10" fill="black"/>
<line x1="12" x2="12" y2="24" stroke="black" stroke-width="3"/>
<line y1="-1.5" x2="24" y2="-1.5" transform="matrix(1 0 0 -1 0 11.5)" stroke="black" stroke-width="3"/>
<line y1="-1.5" x2="24" y2="-1.5" transform="matrix(0.707107 -0.707107 -0.707107 -0.707107 3.5 19.9707)" stroke="black" stroke-width="3"/>
<line x1="19.9096" y1="21.0314" x2="2.93899" y2="4.0608" stroke="black" stroke-width="3"/>
<circle cx="12" cy="12" r="8" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 592 B

View File

@@ -0,0 +1,3 @@
<svg width="24" height="16" viewBox="0 0 24 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 0H24V4.36328H22.1989C20.1906 4.36328 18.5625 5.99134 18.5625 7.99964C18.5625 10.008 20.1906 11.636 22.1989 11.636H24V16H0V11.636H1.80114C3.80945 11.636 5.4375 10.008 5.4375 7.99964C5.4375 5.99134 3.80945 4.36328 1.80114 4.36328H0V0Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 404 B

BIN
assets/icons/ic_uzb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.12 14H9.88L6.88 11H1V20H23V11H17.12L14.12 14Z" fill="black"/>
<path d="M1 4V8H8.12L11.12 11H12.88L15.88 8H23V4H1Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -138,7 +138,26 @@
"asian": "Asian",
"bakery": "Bakery",
"allCategories": "All categories",
"categoriesShort": "Food, shopping, drinks, etc."
"categoriesShort": "Food, shopping, drinks, etc.",
"yourFavourites": "Your favourites",
"restaurantRewards": "Restaurant Rewards",
"wallet": "Wallet",
"sendAGift": "Send a gift",
"businessPreferences": "Business preferences",
"businessSub": "Make work meals quicker and easier",
"help": "Help",
"promotions": "Promotions",
"uberPass": "Uber Pass",
"uberPassSub": "Join free for 1 month",
"deliverWithUber": "Deliver with Uber",
"settings": "Settings",
"home": "Home",
"browse": "Browse",
"baskets": "Baskets",
"account": "Account",
"changeLanguage": "Change language",
"language": "Language"

View File

@@ -133,7 +133,26 @@
"asian": "Азиатская кухня",
"bakery": "Пекарня",
"categoriesShort": "Еда, покупки, напитки и т.д.",
"allCategories": "Все категории"
"allCategories": "Все категории",
"yourFavourites": "Избранное",
"restaurantRewards": "Бонусы ресторанов",
"wallet": "Кошелёк",
"sendAGift": "Отправить подарок",
"businessPreferences": "Рабочие предпочтения",
"businessSub": "Сделайте рабочие обеды быстрее и проще",
"help": "Помощь",
"promotions": "Акции",
"uberPass": "Uber Pass",
"uberPassSub": "Присоединяйтесь бесплатно на 1 месяц",
"deliverWithUber": "Доставляйте с Uber",
"settings": "Настройки",
"home": "Главная",
"browse": "Категории",
"baskets": "Корзина",
"account": "Аккаунт",
"language": "Язык",
"changeLanguage": "Сменить язык"

View File

@@ -133,7 +133,26 @@
"asian": "Osiyo taomlari",
"bakery": "Qandolatxona",
"categoriesShort": "Ovqat, xaridlar, ichimliklar va boshqalar.",
"allCategories": "Barcha toifalar"
"allCategories": "Barcha toifalar",
"yourFavourites": "Sevimlilar",
"restaurantRewards": "Restoran bonuslari",
"wallet": "Hamyon",
"sendAGift": "Sovga yuborish",
"businessPreferences": "Biznes sozlamalari",
"businessSub": "Ishdagi ovqatlarni tezroq va osonroq qiling",
"help": "Yordam",
"promotions": "Aksiyalar",
"uberPass": "Uber Pass",
"uberPassSub": "1 oy bepul ulaning",
"deliverWithUber": "Uber bilan yetkazib bering",
"settings": "Sozlamalar",
"home": "Bosh sahifa",
"browse": "Kategoriya",
"baskets": "Savatcha",
"account": "Profil",
"language": "Til",
"changeLanguage": "Tilni o'zgartirish"

View File

@@ -651,6 +651,108 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Food, shopping, drinks, etc.'**
String get categoriesShort;
/// No description provided for @yourFavourites.
///
/// In en, this message translates to:
/// **'Your favourites'**
String get yourFavourites;
/// No description provided for @wallet.
///
/// In en, this message translates to:
/// **'Wallet'**
String get wallet;
/// No description provided for @sendAGift.
///
/// In en, this message translates to:
/// **'Send a gift'**
String get sendAGift;
/// No description provided for @businessPreferences.
///
/// In en, this message translates to:
/// **'Business preferences'**
String get businessPreferences;
/// No description provided for @businessSub.
///
/// In en, this message translates to:
/// **'Make work meals quicker and easier'**
String get businessSub;
/// No description provided for @help.
///
/// In en, this message translates to:
/// **'Help'**
String get help;
/// No description provided for @promotions.
///
/// In en, this message translates to:
/// **'Promotions'**
String get promotions;
/// No description provided for @uberPass.
///
/// In en, this message translates to:
/// **'Uber Pass'**
String get uberPass;
/// No description provided for @uberPassSub.
///
/// In en, this message translates to:
/// **'Join free for 1 month'**
String get uberPassSub;
/// No description provided for @deliverWithUber.
///
/// In en, this message translates to:
/// **'Deliver with Uber'**
String get deliverWithUber;
/// No description provided for @settings.
///
/// In en, this message translates to:
/// **'Settings'**
String get settings;
/// No description provided for @home.
///
/// In en, this message translates to:
/// **'Home'**
String get home;
/// No description provided for @browse.
///
/// In en, this message translates to:
/// **'Browse'**
String get browse;
/// No description provided for @baskets.
///
/// In en, this message translates to:
/// **'Baskets'**
String get baskets;
/// No description provided for @account.
///
/// In en, this message translates to:
/// **'Account'**
String get account;
/// No description provided for @changeLanguage.
///
/// In en, this message translates to:
/// **'Change language'**
String get changeLanguage;
/// No description provided for @language.
///
/// In en, this message translates to:
/// **'Language'**
String get language;
}
class _AppLocalizationsDelegate

View File

@@ -295,4 +295,55 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get categoriesShort => 'Food, shopping, drinks, etc.';
@override
String get yourFavourites => 'Your favourites';
@override
String get wallet => 'Wallet';
@override
String get sendAGift => 'Send a gift';
@override
String get businessPreferences => 'Business preferences';
@override
String get businessSub => 'Make work meals quicker and easier';
@override
String get help => 'Help';
@override
String get promotions => 'Promotions';
@override
String get uberPass => 'Uber Pass';
@override
String get uberPassSub => 'Join free for 1 month';
@override
String get deliverWithUber => 'Deliver with Uber';
@override
String get settings => 'Settings';
@override
String get home => 'Home';
@override
String get browse => 'Browse';
@override
String get baskets => 'Baskets';
@override
String get account => 'Account';
@override
String get changeLanguage => 'Change language';
@override
String get language => 'Language';
}

View File

@@ -271,7 +271,7 @@ class AppLocalizationsRu extends AppLocalizations {
String get latestDeals => 'Новые предложения';
@override
String get restaurantRewards => 'Ресторанные бонусы';
String get restaurantRewards => 'Бонусы ресторанов';
@override
String get nationwideShipping => 'Доставка по всей стране';
@@ -296,4 +296,55 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get categoriesShort => 'Еда, покупки, напитки и т.д.';
@override
String get yourFavourites => 'Избранное';
@override
String get wallet => 'Кошелёк';
@override
String get sendAGift => 'Отправить подарок';
@override
String get businessPreferences => 'Рабочие предпочтения';
@override
String get businessSub => 'Сделайте рабочие обеды быстрее и проще';
@override
String get help => 'Помощь';
@override
String get promotions => 'Акции';
@override
String get uberPass => 'Uber Pass';
@override
String get uberPassSub => 'Присоединяйтесь бесплатно на 1 месяц';
@override
String get deliverWithUber => 'Доставляйте с Uber';
@override
String get settings => 'Настройки';
@override
String get home => 'Главная';
@override
String get browse => 'Категории';
@override
String get baskets => 'Корзина';
@override
String get account => 'Аккаунт';
@override
String get changeLanguage => 'Сменить язык';
@override
String get language => 'Язык';
}

View File

@@ -271,7 +271,7 @@ class AppLocalizationsUz extends AppLocalizations {
String get latestDeals => 'Yangi chegirmalar';
@override
String get restaurantRewards => 'Restoran mukofotlari';
String get restaurantRewards => 'Restoran bonuslari';
@override
String get nationwideShipping => 'Butun mamlakat boylab yetkazib berish';
@@ -296,4 +296,55 @@ class AppLocalizationsUz extends AppLocalizations {
@override
String get categoriesShort => 'Ovqat, xaridlar, ichimliklar va boshqalar.';
@override
String get yourFavourites => 'Sevimlilar';
@override
String get wallet => 'Hamyon';
@override
String get sendAGift => 'Sovga yuborish';
@override
String get businessPreferences => 'Biznes sozlamalari';
@override
String get businessSub => 'Ishdagi ovqatlarni tezroq va osonroq qiling';
@override
String get help => 'Yordam';
@override
String get promotions => 'Aksiyalar';
@override
String get uberPass => 'Uber Pass';
@override
String get uberPassSub => '1 oy bepul ulaning';
@override
String get deliverWithUber => 'Uber bilan yetkazib bering';
@override
String get settings => 'Sozlamalar';
@override
String get home => 'Bosh sahifa';
@override
String get browse => 'Kategoriya';
@override
String get baskets => 'Savatcha';
@override
String get account => 'Profil';
@override
String get changeLanguage => 'Tilni o\'zgartirish';
@override
String get language => 'Til';
}

View File

@@ -37,7 +37,17 @@ abstract class AppIcons {
static const String icCheck = "$baseUrl/ic_check.svg";
static const String icCheck1 = "$baseUrl/ic_check1.svg";
static const String icArrowRight = "$baseUrl/ic_arrow_right.svg";
static const String icDeliver = "$baseUrl/ic_deliver.svg";
static const String icGift = "$baseUrl/ic_gift.svg";
static const String icHelp = "$baseUrl/ic_help.svg";
static const String icLike = "$baseUrl/ic_like.svg";
static const String icPromotions = "$baseUrl/ic_promotions.svg";
static const String icSettings = "$baseUrl/ic_settings.svg";
static const String icRewards = "$baseUrl/ic_rewards.svg";
static const String icUberPass = "$baseUrl/ic_uber_pass.svg";
static const String icWallet = "$baseUrl/ic_wallet.svg";
static const String icOrdersSvg = "$baseUrl/ic_orders_svg.svg";
static const String icLanguage = "$baseUrl/ic_language.svg";
///.png icons
static const String icBestOverall = "$baseUrl/ic_best.png";
@@ -47,5 +57,7 @@ abstract class AppIcons {
static const String icAllergyFriendly = "$baseUrl/ic_allergy_friendly.png";
static const String icClock = "$baseUrl/ic_clock.svg";
static const String icOrders = "$baseUrl/ic_orders.png";
static const String icUz = "$baseUrl/ic_uzb.png";
static const String icRu = "$baseUrl/ic_rus.png";
static const String icEn = "$baseUrl/ic_eng.png";
}

View File

@@ -22,6 +22,5 @@ abstract class AppImages {
static const String imgChinese = "$baseUrl/img_chinese.png";
static const String imgDesert = "$baseUrl/img_desert.png";
static const String imgPickUp = "$baseUrl/img_pick_up.png";
static const String imgAvatar = "$baseUrl/img_avatar.jpg";
}

View File

@@ -0,0 +1,21 @@
import '../../../../core/theme/app_icons.dart';
mixin AccountMixins {
final List<String> leadingIcons = [
AppIcons.icOrdersSvg,
AppIcons.icLike,
AppIcons.icRewards,
AppIcons.icWallet,
AppIcons.icGift,
AppIcons.icHelp,
AppIcons.icPromotions,
AppIcons.icUberPass,
AppIcons.icDeliver,
AppIcons.icLanguage,
AppIcons.icSettings,
];
final List<String> flags = [AppIcons.icEn, AppIcons.icUz, AppIcons.icRu];
final List<String> languages = ["English", "O'zbekcha", "Русский"];
}

View File

@@ -1,3 +1,5 @@
import 'package:food_delivery_client/feature/account/presentation/pages/account_page/widgets/w_account_body.dart';
import '../../../../../food_delivery_client.dart';
class AccountPage extends StatelessWidget {
@@ -5,38 +7,7 @@ class AccountPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<LanguageBloc, LanguageState>(
builder: (context, state) {
return WLayout(
child: Scaffold(
body: Center(
child: Column(
children: [
Text(context.loc.iCantSignIn),
TextButton(
onPressed: () {
if (state.currentLocale == Locale("uz")) {
context.read<LanguageBloc>().add(
LanguageEvent.changed(Locale('ru')),
);
} else if (state.currentLocale == Locale("ru")) {
context.read<LanguageBloc>().add(
LanguageEvent.changed(Locale('en')),
);
} else {
context.read<LanguageBloc>().add(
LanguageEvent.changed(Locale('uz')),
);
}
},
child: Text("changelang"),
),
],
),
),
),
);
},
);
return WAccountBody();
}
}

View File

@@ -0,0 +1,208 @@
import 'package:flutter/cupertino.dart';
import 'package:food_delivery_client/feature/account/presentation/mixins/account_mixins.dart';
import '../../../../../../food_delivery_client.dart';
class WAccountBody extends StatelessWidget with AccountMixins {
WAccountBody({super.key});
@override
Widget build(BuildContext context) {
final List<String> titles = [
context.loc.orders,
context.loc.yourFavourites,
context.loc.restaurantRewards,
context.loc.wallet,
context.loc.sendAGift,
context.loc.help,
context.loc.promotions,
context.loc.uberPass,
context.loc.deliverWithUber,
context.loc.changeLanguage,
context.loc.settings,
];
return WLayout(
child: Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(56),
child: WAccountAppBar().paddingSymmetric(horizontal: 19),
),
body: LayoutBuilder(
builder: (context, constraints) => ConstrainedBox(
constraints: BoxConstraints(minHeight: constraints.maxHeight),
child: ListView.builder(
shrinkWrap: true,
itemCount: leadingIcons.length,
padding: EdgeInsets.symmetric(vertical: 15),
physics: const AlwaysScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
itemBuilder: (context, index) => WAccountRowItem(
onTap: () {
if (index == 9) {
WChangeLanguage().show(context);
}
},
svgPath: leadingIcons[index],
title: titles[index],
),
),
),
),
),
);
}
}
class WAccountAppBar extends StatelessWidget {
const WAccountAppBar({super.key});
@override
Widget build(BuildContext context) {
return AppBar(
centerTitle: false,
leading: ClipRRect(
borderRadius: AppUtils.kBorderRadius40,
child: SizedBox(
child: Image.asset(
AppImages.imgAvatar,
height: 36,
width: 36,
fit: BoxFit.cover,
),
),
),
title: Text('Felix', style: AppTextStyles.size18Medium),
);
}
}
class WAccountRowItem extends StatelessWidget {
const WAccountRowItem({
super.key,
required this.svgPath,
required this.title,
this.subTitle,
this.leadingIcon,
required this.onTap,
});
final String svgPath;
final String title;
final String? subTitle;
final Widget? leadingIcon;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Ink(
child: Row(
spacing: 24,
mainAxisAlignment: MainAxisAlignment.start,
children: [
leadingIcon ??
SizedBox(
height: 24,
width: 24,
child: SvgPicture.asset(svgPath),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title, style: AppTextStyles.size14Medium),
if (subTitle != null)
Text(
subTitle!,
style: AppTextStyles.size14Medium.copyWith(
color: AppColors.c34A853,
),
),
],
),
],
).paddingSymmetric(vertical: 16, horizontal: 22),
),
);
}
}
class WChangeLanguage extends StatelessWidget with AccountMixins {
WChangeLanguage({super.key});
show(BuildContext context) {
showModalBottomSheet(
context: context,
builder: (context) => Wrap(children: [this]),
);
}
@override
Widget build(BuildContext context) {
return BlocBuilder<LanguageBloc, LanguageState>(
builder: (context, state) {
return Material(
color: AppColors.cFFFFFF,
borderRadius: AppUtils.kBorderRadiusTop20,
child: SizedBox(
width: context.w,
child: SafeArea(
child: Column(
children: [
10.verticalSpace,
SizedBox(
height: 6,
width: 100,
child: DecoratedBox(
decoration: BoxDecoration(
color: AppColors.cEEEEEE,
borderRadius: AppUtils.kBorderRadius8,
),
),
),
10.verticalSpace,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
context.loc.changeLanguage,
style: AppTextStyles.size24Medium,
),
IconButton(
onPressed: () {
context.pop();
},
icon: SvgPicture.asset(AppIcons.icClose),
),
],
).paddingSymmetric(horizontal: 16),
15.verticalSpace,
Column(
children: List.generate(3, (index) {
return AppListTile(
onPressed: () {
context.read<LanguageBloc>().add(
LanguageEvent.changed(L10n.locales[index]),
);
},
isSelected: L10n.locales[index] == state.currentLocale,
svgPath: '',
leading: SizedBox(
height: 24,
width: 24,
child: Image.asset(flags[index]),
),
title: languages[index],
titleTextStyle: AppTextStyles.size16Medium,
);
}),
),
],
),
),
),
);
},
);
}
}

View File

@@ -24,5 +24,4 @@ mixin MainPageMixin {
SvgPicture.asset(AppIcons.icAccountActive),
];
final List<String> labels = ["Home", "Browse", "Baskets", 'Account'];
}

View File

@@ -5,6 +5,12 @@ class MainPage extends StatelessWidget with MainPageMixin {
@override
Widget build(BuildContext context) {
final List<String> labels = [
context.loc.home,
context.loc.browse,
context.loc.baskets,
context.loc.account,
];
return BlocProvider(
create: (context) => sl<MainBloc>(),
child: BlocBuilder<MainBloc, MainState>(