feat: splash page done
This commit is contained in:
@@ -4,7 +4,9 @@ abstract class AppLocaleKeys {
|
||||
static const String browseSearchHistory = 'browse-search-history';
|
||||
static const String token = 'token';
|
||||
|
||||
static const String fontBlack = "fontBlack";
|
||||
static const String fontBold = "fontBold";
|
||||
static const String fontSemiBold = "fontSemiBold";
|
||||
static const String fontMedium = "fontMedium";
|
||||
static const String fontRegular = "fontRegular";
|
||||
static const String fontLight = "fontLight";
|
||||
|
||||
@@ -4,5 +4,6 @@ abstract class TimeDelayConst {
|
||||
static const Duration durationMill800 = Duration(milliseconds: 800);
|
||||
static const Duration durationMill3500 = Duration(milliseconds: 3500);
|
||||
static const Duration duration1 = Duration(seconds: 1);
|
||||
static const Duration duration2 = Duration(seconds: 2);
|
||||
static const Duration duration3 = Duration(seconds: 3);
|
||||
}
|
||||
|
||||
@@ -13,42 +13,12 @@ import 'package:dio/dio.dart' as _i361;
|
||||
import 'package:get_it/get_it.dart' as _i174;
|
||||
import 'package:injectable/injectable.dart' as _i526;
|
||||
|
||||
import '../../feature/auth/data/datasource/auth_datasource.dart' as _i246;
|
||||
import '../../feature/auth/data/repository/auth_repository_impl.dart' as _i648;
|
||||
import '../../feature/auth/domain/repository/auth_repository.dart' as _i884;
|
||||
import '../../feature/auth/domain/usecases/login_usecase.dart' as _i241;
|
||||
import '../../feature/auth/domain/usecases/register_usecase.dart' as _i607;
|
||||
import '../../feature/auth/domain/usecases/reset_password_usecase.dart'
|
||||
as _i694;
|
||||
import '../../feature/auth/domain/usecases/verify_otp_code_login_usecase.dart'
|
||||
as _i318;
|
||||
import '../../feature/auth/domain/usecases/verify_otp_code_register_usecase.dart'
|
||||
as _i406;
|
||||
import '../../feature/auth/domain/usecases/verify_phone_login_usecase.dart'
|
||||
as _i801;
|
||||
import '../../feature/auth/domain/usecases/verify_phone_register_usecase.dart'
|
||||
as _i664;
|
||||
import '../../feature/auth/presentation/blocs/login_bloc/login_bloc.dart'
|
||||
as _i1065;
|
||||
import '../../feature/auth/presentation/blocs/register_bloc/register_bloc.dart'
|
||||
as _i1050;
|
||||
import '../../feature/auth/presentation/blocs/reset_password_bloc/reset_password_bloc.dart'
|
||||
as _i97;
|
||||
import '../../feature/auth/presentation/blocs/verify_otp_bloc/verify_otp_bloc.dart'
|
||||
as _i323;
|
||||
import '../../feature/auth/presentation/blocs/verify_phone_bloc/verify_phone_bloc.dart'
|
||||
as _i224;
|
||||
import '../../feature/basket/presentation/blocs/basket_bloc.dart' as _i728;
|
||||
import '../../feature/browse/presentation/blocs/browse_bloc/browse_bloc.dart'
|
||||
as _i991;
|
||||
import '../../feature/common/presentation/blocs/language_bloc/language_bloc.dart'
|
||||
as _i942;
|
||||
import '../../feature/home/presentation/blocs/home_bloc/home_bloc.dart'
|
||||
as _i1007;
|
||||
import '../../feature/main/presentation/blocs/main_bloc/main_bloc.dart'
|
||||
as _i580;
|
||||
import '../../feature/on_boarding/presentation/blocs/splash_bloc/splash_bloc.dart'
|
||||
as _i311;
|
||||
import '../../feature/onboarding/presentation/blocs/splash_bloc/splash_bloc.dart'
|
||||
as _i28;
|
||||
import '../../food_delivery_client.dart' as _i321;
|
||||
import '../network/dio_client.dart' as _i667;
|
||||
import '../router/app_routes.dart' as _i152;
|
||||
@@ -63,78 +33,20 @@ extension GetItInjectableX on _i174.GetIt {
|
||||
}) {
|
||||
final gh = _i526.GetItHelper(this, environment, environmentFilter);
|
||||
final dioModule = _$DioModule();
|
||||
gh.factory<_i1007.HomeBloc>(() => _i1007.HomeBloc());
|
||||
gh.factory<_i728.BasketBloc>(() => _i728.BasketBloc());
|
||||
gh.factory<_i991.BrowseBloc>(() => _i991.BrowseBloc());
|
||||
gh.factory<_i580.MainBloc>(() => _i580.MainBloc());
|
||||
gh.factory<_i311.SplashBloc>(() => _i311.SplashBloc());
|
||||
gh.singleton<_i306.StorageService>(() => _i306.StorageService());
|
||||
gh.singleton<_i152.AppRoutes>(() => _i152.AppRoutes());
|
||||
gh.lazySingleton<_i667.DioClient>(() => _i667.DioClient());
|
||||
gh.factory<_i942.LanguageBloc>(
|
||||
() => _i942.LanguageBloc(gh<_i321.StorageService>()),
|
||||
);
|
||||
gh.factory<_i28.SplashBloc>(
|
||||
() => _i28.SplashBloc(gh<_i321.StorageService>()),
|
||||
);
|
||||
gh.lazySingleton<_i361.Dio>(() => dioModule.dio(gh<_i667.DioClient>()));
|
||||
gh.singleton<_i354.RequestHandlerService>(
|
||||
() => _i354.RequestHandlerService(gh<_i361.Dio>()),
|
||||
);
|
||||
gh.lazySingleton<_i246.AuthDatasource>(
|
||||
() => _i246.AuthDatasourceImpl(gh<_i354.RequestHandlerService>()),
|
||||
);
|
||||
gh.lazySingleton<_i884.AuthRepository>(
|
||||
() => _i648.AuthRepositoryImpl(
|
||||
gh<_i354.RequestHandlerService>(),
|
||||
gh<_i246.AuthDatasource>(),
|
||||
),
|
||||
);
|
||||
gh.factory<_i607.RegisterUseCase>(
|
||||
() => _i607.RegisterUseCase(gh<_i884.AuthRepository>()),
|
||||
);
|
||||
gh.factory<_i241.LoginUseCase>(
|
||||
() => _i241.LoginUseCase(gh<_i884.AuthRepository>()),
|
||||
);
|
||||
gh.factory<_i694.ResetPasswordUseCase>(
|
||||
() => _i694.ResetPasswordUseCase(gh<_i884.AuthRepository>()),
|
||||
);
|
||||
gh.factory<_i318.VerifyOtpCodeForgotPasswordUseCase>(
|
||||
() =>
|
||||
_i318.VerifyOtpCodeForgotPasswordUseCase(gh<_i884.AuthRepository>()),
|
||||
);
|
||||
gh.factory<_i801.VerifyPhoneNumberLoginUseCase>(
|
||||
() => _i801.VerifyPhoneNumberLoginUseCase(gh<_i884.AuthRepository>()),
|
||||
);
|
||||
gh.factory<_i664.VerifyPhoneRegisterUseCase>(
|
||||
() => _i664.VerifyPhoneRegisterUseCase(gh<_i884.AuthRepository>()),
|
||||
);
|
||||
gh.factory<_i406.VerifyOtpCodeRegisterUseCase>(
|
||||
() => _i406.VerifyOtpCodeRegisterUseCase(gh<_i884.AuthRepository>()),
|
||||
);
|
||||
gh.factory<_i323.VerifyOtpBloc>(
|
||||
() => _i323.VerifyOtpBloc(
|
||||
gh<_i406.VerifyOtpCodeRegisterUseCase>(),
|
||||
gh<_i318.VerifyOtpCodeForgotPasswordUseCase>(),
|
||||
gh<_i664.VerifyPhoneRegisterUseCase>(),
|
||||
gh<_i801.VerifyPhoneNumberLoginUseCase>(),
|
||||
),
|
||||
);
|
||||
gh.factory<_i224.VerifyPhoneBloc>(
|
||||
() => _i224.VerifyPhoneBloc(
|
||||
gh<_i801.VerifyPhoneNumberLoginUseCase>(),
|
||||
gh<_i664.VerifyPhoneRegisterUseCase>(),
|
||||
),
|
||||
);
|
||||
gh.factory<_i1050.RegisterBloc>(
|
||||
() => _i1050.RegisterBloc(gh<_i607.RegisterUseCase>()),
|
||||
);
|
||||
gh.factory<_i97.ResetPasswordBloc>(
|
||||
() => _i97.ResetPasswordBloc(gh<_i694.ResetPasswordUseCase>()),
|
||||
);
|
||||
gh.factory<_i1065.LoginBloc>(
|
||||
() => _i1065.LoginBloc(
|
||||
gh<_i241.LoginUseCase>(),
|
||||
gh<_i321.StorageService>(),
|
||||
),
|
||||
);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:food_delivery_client/core/l10n/app_localizations.dart';
|
||||
import 'package:food_delivery_client/core/theme/app_theme_textstyles.dart';
|
||||
import 'package:food_delivery_client/core/theme/theme_icons.dart';
|
||||
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
extension BuildContextExtensions on BuildContext {
|
||||
MediaQueryData get mq => MediaQuery.of(this);
|
||||
@@ -9,4 +11,11 @@ extension BuildContextExtensions on BuildContext {
|
||||
double get h => mq.size.height;
|
||||
|
||||
AppLocalizations get loc => AppLocalizations.of(this)!;
|
||||
|
||||
ThemeData get theme => Theme.of(this);
|
||||
|
||||
AppThemeIcons get appThemeIcons => theme.extension<AppThemeIcons>()!;
|
||||
|
||||
AppThemeTextStyles get appThemeTextStyles =>
|
||||
theme.extension<AppThemeTextStyles>()!;
|
||||
}
|
||||
|
||||
@@ -100,809 +100,41 @@ abstract class AppLocalizations {
|
||||
Locale('uz'),
|
||||
];
|
||||
|
||||
/// No description provided for @useYourTAxiAccount.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Use your uber account to get started'**
|
||||
String get useYourTAxiAccount;
|
||||
|
||||
/// No description provided for @enterYourMobileNumber.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enter your mobile number'**
|
||||
String get enterYourMobileNumber;
|
||||
|
||||
/// No description provided for @mobileNumber.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Mobile number'**
|
||||
String get mobileNumber;
|
||||
|
||||
/// No description provided for @next.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Next'**
|
||||
String get next;
|
||||
|
||||
/// No description provided for @contestToGetCallAndSms.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'By proceeding, you consent to get calls, Whatsapp or SMS messages, including by automated means, from uber and its affiliates to the number provided.'**
|
||||
String get contestToGetCallAndSms;
|
||||
|
||||
/// No description provided for @continueWithGoogle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Continue with google'**
|
||||
String get continueWithGoogle;
|
||||
|
||||
/// No description provided for @or.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'or'**
|
||||
String get or;
|
||||
|
||||
/// No description provided for @welcomeBack.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Welcome back, John'**
|
||||
String get welcomeBack;
|
||||
|
||||
/// No description provided for @pleaseEnterYourPassword.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Please enter your password'**
|
||||
String get pleaseEnterYourPassword;
|
||||
|
||||
/// No description provided for @iHaveForgotPassword.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'I\'ve forgotten my password'**
|
||||
String get iHaveForgotPassword;
|
||||
|
||||
/// No description provided for @iCantSignIn.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'I cant sign in'**
|
||||
String get iCantSignIn;
|
||||
|
||||
/// No description provided for @enter4DigitCodeSentYou.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enter the 4-digit code sent to you at {phone}'**
|
||||
String enter4DigitCodeSentYou(String phone);
|
||||
|
||||
/// No description provided for @iHavenRecievedCode.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'I haven’t recieved a code (\${time})'**
|
||||
String iHavenRecievedCode(String time);
|
||||
|
||||
/// No description provided for @delivery.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Delivery'**
|
||||
String get delivery;
|
||||
|
||||
/// No description provided for @pickUp.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Pickup'**
|
||||
String get pickUp;
|
||||
|
||||
/// No description provided for @dineIn.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Dine-in'**
|
||||
String get dineIn;
|
||||
|
||||
/// No description provided for @allCategories.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'All categories'**
|
||||
String get allCategories;
|
||||
|
||||
/// No description provided for @convenience.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Convenience'**
|
||||
String get convenience;
|
||||
|
||||
/// No description provided for @alcohol.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Alcohol'**
|
||||
String get alcohol;
|
||||
|
||||
/// No description provided for @petSupplies.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Pet Supplies'**
|
||||
String get petSupplies;
|
||||
|
||||
/// No description provided for @flowers.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Flowers'**
|
||||
String get flowers;
|
||||
|
||||
/// No description provided for @grocery.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Grocery'**
|
||||
String get grocery;
|
||||
|
||||
/// No description provided for @american.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'American'**
|
||||
String get american;
|
||||
|
||||
/// No description provided for @speciality.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Speciality'**
|
||||
String get speciality;
|
||||
|
||||
/// No description provided for @takeout.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Takeout'**
|
||||
String get takeout;
|
||||
|
||||
/// No description provided for @asian.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Asian'**
|
||||
String get asian;
|
||||
|
||||
/// No description provided for @iceCream.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Ice Cream'**
|
||||
String get iceCream;
|
||||
|
||||
/// No description provided for @halal.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Halal'**
|
||||
String get halal;
|
||||
|
||||
/// No description provided for @retails.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Retails'**
|
||||
String get retails;
|
||||
|
||||
/// No description provided for @caribbean.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Caribbean'**
|
||||
String get caribbean;
|
||||
|
||||
/// No description provided for @indian.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Indian'**
|
||||
String get indian;
|
||||
|
||||
/// No description provided for @french.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'French'**
|
||||
String get french;
|
||||
|
||||
/// No description provided for @fastFoods.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Fast Foods'**
|
||||
String get fastFoods;
|
||||
|
||||
/// No description provided for @burger.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Burger'**
|
||||
String get burger;
|
||||
|
||||
/// No description provided for @ride.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Ride'**
|
||||
String get ride;
|
||||
|
||||
/// No description provided for @chinese.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Chinese'**
|
||||
String get chinese;
|
||||
|
||||
/// No description provided for @dessert.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Dessert'**
|
||||
String get dessert;
|
||||
|
||||
/// No description provided for @more.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'More'**
|
||||
String get more;
|
||||
|
||||
/// No description provided for @orderDetails.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Order details'**
|
||||
String get orderDetails;
|
||||
|
||||
/// No description provided for @deliverNow.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Deliver now'**
|
||||
String get deliverNow;
|
||||
|
||||
/// No description provided for @schedule.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Schedule'**
|
||||
String get schedule;
|
||||
|
||||
/// No description provided for @enterNewAddress.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enter a new address'**
|
||||
String get enterNewAddress;
|
||||
|
||||
/// No description provided for @nearby.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Nearby'**
|
||||
String get nearby;
|
||||
|
||||
/// No description provided for @currentLocation.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Current location'**
|
||||
String get currentLocation;
|
||||
|
||||
/// No description provided for @enable.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enable'**
|
||||
String get enable;
|
||||
|
||||
/// No description provided for @recentLocations.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Recent locations'**
|
||||
String get recentLocations;
|
||||
|
||||
/// No description provided for @allFilters.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'All filters'**
|
||||
String get allFilters;
|
||||
|
||||
/// No description provided for @sort.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Sort'**
|
||||
String get sort;
|
||||
|
||||
/// No description provided for @pickedForYou.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Picked for you (default)'**
|
||||
String get pickedForYou;
|
||||
|
||||
/// No description provided for @mostPopular.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Most popular'**
|
||||
String get mostPopular;
|
||||
|
||||
/// No description provided for @rating.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Rating'**
|
||||
String get rating;
|
||||
|
||||
/// No description provided for @deliveryTime.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Delivery time'**
|
||||
String get deliveryTime;
|
||||
|
||||
/// No description provided for @fromUberEats.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'From {name}'**
|
||||
String fromUberEats(String name);
|
||||
|
||||
/// No description provided for @deals.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Deals'**
|
||||
String get deals;
|
||||
|
||||
/// No description provided for @bestOverall.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Best Overall'**
|
||||
String get bestOverall;
|
||||
|
||||
/// No description provided for @priceRange.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Price range'**
|
||||
String get priceRange;
|
||||
|
||||
/// No description provided for @maxDeliveryFee.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Max. Delivery Fee'**
|
||||
String get maxDeliveryFee;
|
||||
|
||||
/// No description provided for @dietary.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Dietary'**
|
||||
String get dietary;
|
||||
|
||||
/// No description provided for @vegetarian.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Vegetarian'**
|
||||
String get vegetarian;
|
||||
|
||||
/// No description provided for @vegan.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Vegan'**
|
||||
String get vegan;
|
||||
|
||||
/// No description provided for @glutenFree.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Gluten-free'**
|
||||
String get glutenFree;
|
||||
|
||||
/// No description provided for @allergyFriendly.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Allergy friendly'**
|
||||
String get allergyFriendly;
|
||||
|
||||
/// No description provided for @atLeast.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'At least'**
|
||||
String get atLeast;
|
||||
|
||||
/// No description provided for @apply.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Apply'**
|
||||
String get apply;
|
||||
|
||||
/// No description provided for @pickedForYouDefault.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Picked for you (default)'**
|
||||
String get pickedForYouDefault;
|
||||
|
||||
/// No description provided for @popular.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Most popular'**
|
||||
String get popular;
|
||||
|
||||
/// No description provided for @topRated.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Top rated'**
|
||||
String get topRated;
|
||||
|
||||
/// No description provided for @fast.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Fast'**
|
||||
String get fast;
|
||||
|
||||
/// No description provided for @featuredStores.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Featured stores'**
|
||||
String get featuredStores;
|
||||
|
||||
/// No description provided for @opensAt.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Opens at {time}'**
|
||||
String opensAt(String time);
|
||||
|
||||
/// No description provided for @spendAndSave.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Spend {spend}, save {save}'**
|
||||
String spendAndSave(String spend, String save);
|
||||
|
||||
/// No description provided for @cartsTitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Carts'**
|
||||
String get cartsTitle;
|
||||
|
||||
/// No description provided for @addItemsStartBasket.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Add items to start a basket'**
|
||||
String get addItemsStartBasket;
|
||||
|
||||
/// No description provided for @basketHint.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Once you add items from a restaurant or store, your basket will appear here.'**
|
||||
String get basketHint;
|
||||
|
||||
/// No description provided for @startShopping.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Start Shopping'**
|
||||
String get startShopping;
|
||||
|
||||
/// No description provided for @orders.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Orders'**
|
||||
String get orders;
|
||||
|
||||
/// No description provided for @recentSearches.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Recent searches'**
|
||||
String get recentSearches;
|
||||
|
||||
/// No description provided for @cafe.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Cafe'**
|
||||
String get cafe;
|
||||
|
||||
/// No description provided for @irish.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Irish'**
|
||||
String get irish;
|
||||
|
||||
/// No description provided for @topCategories.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Top Categories'**
|
||||
String get topCategories;
|
||||
|
||||
/// No description provided for @breakfastAndBrunch.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Breakfast and Brunch'**
|
||||
String get breakfastAndBrunch;
|
||||
|
||||
/// No description provided for @coffeeAndTea.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Coffee and Tea'**
|
||||
String get coffeeAndTea;
|
||||
|
||||
/// No description provided for @latestDeals.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Latest Deals'**
|
||||
String get latestDeals;
|
||||
|
||||
/// No description provided for @restaurantRewards.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Restaurant Rewards'**
|
||||
String get restaurantRewards;
|
||||
|
||||
/// No description provided for @nationwideShipping.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Nationwide Shipping'**
|
||||
String get nationwideShipping;
|
||||
|
||||
/// No description provided for @mexican.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Mexican'**
|
||||
String get mexican;
|
||||
|
||||
/// No description provided for @fastFood.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Fast Food'**
|
||||
String get fastFood;
|
||||
|
||||
/// No description provided for @healthy.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Healthy'**
|
||||
String get healthy;
|
||||
|
||||
/// No description provided for @pizza.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Pizza'**
|
||||
String get pizza;
|
||||
|
||||
/// No description provided for @sandwich.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Sandwich'**
|
||||
String get sandwich;
|
||||
|
||||
/// No description provided for @bakery.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Bakery'**
|
||||
String get bakery;
|
||||
|
||||
/// No description provided for @categoriesShort.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
/// No description provided for @login.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Login'**
|
||||
String get login;
|
||||
|
||||
/// No description provided for @phone_number.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Phone number'**
|
||||
String get phone_number;
|
||||
|
||||
/// No description provided for @enter_phone_number.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enter phone number'**
|
||||
String get enter_phone_number;
|
||||
|
||||
/// No description provided for @password.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Password'**
|
||||
String get password;
|
||||
|
||||
/// No description provided for @enter_password.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enter password'**
|
||||
String get enter_password;
|
||||
|
||||
/// No description provided for @forgot_password.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Forgot password'**
|
||||
String get forgot_password;
|
||||
|
||||
/// No description provided for @continue_str.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Continue'**
|
||||
String get continue_str;
|
||||
|
||||
/// No description provided for @dont_have_account.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Don\'t have an account?'**
|
||||
String get dont_have_account;
|
||||
|
||||
/// No description provided for @sign_up.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'SignUp'**
|
||||
String get sign_up;
|
||||
|
||||
/// No description provided for @field_cannot_be_empty.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'This field cannot be empty'**
|
||||
String get field_cannot_be_empty;
|
||||
|
||||
/// No description provided for @password_too_short.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Password must be at least 6 characters long'**
|
||||
String get password_too_short;
|
||||
|
||||
/// No description provided for @invalid_phone_format.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Invalid phone number format'**
|
||||
String get invalid_phone_format;
|
||||
|
||||
/// No description provided for @first_name.
|
||||
/// No description provided for @password_too_short.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'First name'**
|
||||
String get first_name;
|
||||
|
||||
/// No description provided for @enter_first_name.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enter first name'**
|
||||
String get enter_first_name;
|
||||
|
||||
/// No description provided for @repeat_password.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Repeat password'**
|
||||
String get repeat_password;
|
||||
|
||||
/// No description provided for @enter_repeat_password.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enter repeat password'**
|
||||
String get enter_repeat_password;
|
||||
|
||||
/// No description provided for @already_has_account.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Already have an account?'**
|
||||
String get already_has_account;
|
||||
|
||||
/// No description provided for @unexpected_error.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Unexpected error'**
|
||||
String get unexpected_error;
|
||||
|
||||
/// No description provided for @consent_message.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'By proceeding, you consent to get calls or SMS messages, including by automated means, from {appName} and its affiliates to the number provided.'**
|
||||
String consent_message(String appName);
|
||||
|
||||
/// No description provided for @otp_code_incomplete.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Code is incomplete. Please enter the full code.'**
|
||||
String get otp_code_incomplete;
|
||||
/// **'Password must be at least 6 characters long'**
|
||||
String get password_too_short;
|
||||
|
||||
/// No description provided for @passwords_do_not_match.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Passwords do not match.'**
|
||||
/// **'Passwords do not match'**
|
||||
String get passwords_do_not_match;
|
||||
|
||||
/// No description provided for @reset_password.
|
||||
/// No description provided for @otp_code_incomplete.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Reset password'**
|
||||
String get reset_password;
|
||||
/// **'OTP code is incomplete'**
|
||||
String get otp_code_incomplete;
|
||||
|
||||
/// No description provided for @new_password.
|
||||
/// No description provided for @unexpected_error.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'New password'**
|
||||
String get new_password;
|
||||
|
||||
/// No description provided for @enter_otp_code.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enter the 5-digit code sent to you at {phoneNumber}'**
|
||||
String enter_otp_code(String phoneNumber);
|
||||
|
||||
/// No description provided for @resend_otp_after.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'You can resend OTP after'**
|
||||
String get resend_otp_after;
|
||||
/// **'An unexpected error occurred. Please try again.'**
|
||||
String get unexpected_error;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
||||
@@ -8,423 +8,23 @@ import 'app_localizations.dart';
|
||||
class AppLocalizationsEn extends AppLocalizations {
|
||||
AppLocalizationsEn([String locale = 'en']) : super(locale);
|
||||
|
||||
@override
|
||||
String get useYourTAxiAccount => 'Use your uber account to get started';
|
||||
|
||||
@override
|
||||
String get enterYourMobileNumber => 'Enter your mobile number';
|
||||
|
||||
@override
|
||||
String get mobileNumber => 'Mobile number';
|
||||
|
||||
@override
|
||||
String get next => 'Next';
|
||||
|
||||
@override
|
||||
String get contestToGetCallAndSms =>
|
||||
'By proceeding, you consent to get calls, Whatsapp or SMS messages, including by automated means, from uber and its affiliates to the number provided.';
|
||||
|
||||
@override
|
||||
String get continueWithGoogle => 'Continue with google';
|
||||
|
||||
@override
|
||||
String get or => 'or';
|
||||
|
||||
@override
|
||||
String get welcomeBack => 'Welcome back, John';
|
||||
|
||||
@override
|
||||
String get pleaseEnterYourPassword => 'Please enter your password';
|
||||
|
||||
@override
|
||||
String get iHaveForgotPassword => 'I\'ve forgotten my password';
|
||||
|
||||
@override
|
||||
String get iCantSignIn => 'I cant sign in';
|
||||
|
||||
@override
|
||||
String enter4DigitCodeSentYou(String phone) {
|
||||
return 'Enter the 4-digit code sent to you at $phone';
|
||||
}
|
||||
|
||||
@override
|
||||
String iHavenRecievedCode(String time) {
|
||||
return 'I haven’t recieved a code (\$$time)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get delivery => 'Delivery';
|
||||
|
||||
@override
|
||||
String get pickUp => 'Pickup';
|
||||
|
||||
@override
|
||||
String get dineIn => 'Dine-in';
|
||||
|
||||
@override
|
||||
String get allCategories => 'All categories';
|
||||
|
||||
@override
|
||||
String get convenience => 'Convenience';
|
||||
|
||||
@override
|
||||
String get alcohol => 'Alcohol';
|
||||
|
||||
@override
|
||||
String get petSupplies => 'Pet Supplies';
|
||||
|
||||
@override
|
||||
String get flowers => 'Flowers';
|
||||
|
||||
@override
|
||||
String get grocery => 'Grocery';
|
||||
|
||||
@override
|
||||
String get american => 'American';
|
||||
|
||||
@override
|
||||
String get speciality => 'Speciality';
|
||||
|
||||
@override
|
||||
String get takeout => 'Takeout';
|
||||
|
||||
@override
|
||||
String get asian => 'Asian';
|
||||
|
||||
@override
|
||||
String get iceCream => 'Ice Cream';
|
||||
|
||||
@override
|
||||
String get halal => 'Halal';
|
||||
|
||||
@override
|
||||
String get retails => 'Retails';
|
||||
|
||||
@override
|
||||
String get caribbean => 'Caribbean';
|
||||
|
||||
@override
|
||||
String get indian => 'Indian';
|
||||
|
||||
@override
|
||||
String get french => 'French';
|
||||
|
||||
@override
|
||||
String get fastFoods => 'Fast Foods';
|
||||
|
||||
@override
|
||||
String get burger => 'Burger';
|
||||
|
||||
@override
|
||||
String get ride => 'Ride';
|
||||
|
||||
@override
|
||||
String get chinese => 'Chinese';
|
||||
|
||||
@override
|
||||
String get dessert => 'Dessert';
|
||||
|
||||
@override
|
||||
String get more => 'More';
|
||||
|
||||
@override
|
||||
String get orderDetails => 'Order details';
|
||||
|
||||
@override
|
||||
String get deliverNow => 'Deliver now';
|
||||
|
||||
@override
|
||||
String get schedule => 'Schedule';
|
||||
|
||||
@override
|
||||
String get enterNewAddress => 'Enter a new address';
|
||||
|
||||
@override
|
||||
String get nearby => 'Nearby';
|
||||
|
||||
@override
|
||||
String get currentLocation => 'Current location';
|
||||
|
||||
@override
|
||||
String get enable => 'Enable';
|
||||
|
||||
@override
|
||||
String get recentLocations => 'Recent locations';
|
||||
|
||||
@override
|
||||
String get allFilters => 'All filters';
|
||||
|
||||
@override
|
||||
String get sort => 'Sort';
|
||||
|
||||
@override
|
||||
String get pickedForYou => 'Picked for you (default)';
|
||||
|
||||
@override
|
||||
String get mostPopular => 'Most popular';
|
||||
|
||||
@override
|
||||
String get rating => 'Rating';
|
||||
|
||||
@override
|
||||
String get deliveryTime => 'Delivery time';
|
||||
|
||||
@override
|
||||
String fromUberEats(String name) {
|
||||
return 'From $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String get deals => 'Deals';
|
||||
|
||||
@override
|
||||
String get bestOverall => 'Best Overall';
|
||||
|
||||
@override
|
||||
String get priceRange => 'Price range';
|
||||
|
||||
@override
|
||||
String get maxDeliveryFee => 'Max. Delivery Fee';
|
||||
|
||||
@override
|
||||
String get dietary => 'Dietary';
|
||||
|
||||
@override
|
||||
String get vegetarian => 'Vegetarian';
|
||||
|
||||
@override
|
||||
String get vegan => 'Vegan';
|
||||
|
||||
@override
|
||||
String get glutenFree => 'Gluten-free';
|
||||
|
||||
@override
|
||||
String get allergyFriendly => 'Allergy friendly';
|
||||
|
||||
@override
|
||||
String get atLeast => 'At least';
|
||||
|
||||
@override
|
||||
String get apply => 'Apply';
|
||||
|
||||
@override
|
||||
String get pickedForYouDefault => 'Picked for you (default)';
|
||||
|
||||
@override
|
||||
String get popular => 'Most popular';
|
||||
|
||||
@override
|
||||
String get topRated => 'Top rated';
|
||||
|
||||
@override
|
||||
String get fast => 'Fast';
|
||||
|
||||
@override
|
||||
String get featuredStores => 'Featured stores';
|
||||
|
||||
@override
|
||||
String opensAt(String time) {
|
||||
return 'Opens at $time';
|
||||
}
|
||||
|
||||
@override
|
||||
String spendAndSave(String spend, String save) {
|
||||
return 'Spend $spend, save $save';
|
||||
}
|
||||
|
||||
@override
|
||||
String get cartsTitle => 'Carts';
|
||||
|
||||
@override
|
||||
String get addItemsStartBasket => 'Add items to start a basket';
|
||||
|
||||
@override
|
||||
String get basketHint =>
|
||||
'Once you add items from a restaurant or store, your basket will appear here.';
|
||||
|
||||
@override
|
||||
String get startShopping => 'Start Shopping';
|
||||
|
||||
@override
|
||||
String get orders => 'Orders';
|
||||
|
||||
@override
|
||||
String get recentSearches => 'Recent searches';
|
||||
|
||||
@override
|
||||
String get cafe => 'Cafe';
|
||||
|
||||
@override
|
||||
String get irish => 'Irish';
|
||||
|
||||
@override
|
||||
String get topCategories => 'Top Categories';
|
||||
|
||||
@override
|
||||
String get breakfastAndBrunch => 'Breakfast and Brunch';
|
||||
|
||||
@override
|
||||
String get coffeeAndTea => 'Coffee and Tea';
|
||||
|
||||
@override
|
||||
String get latestDeals => 'Latest Deals';
|
||||
|
||||
@override
|
||||
String get restaurantRewards => 'Restaurant Rewards';
|
||||
|
||||
@override
|
||||
String get nationwideShipping => 'Nationwide Shipping';
|
||||
|
||||
@override
|
||||
String get mexican => 'Mexican';
|
||||
|
||||
@override
|
||||
String get fastFood => 'Fast Food';
|
||||
|
||||
@override
|
||||
String get healthy => 'Healthy';
|
||||
|
||||
@override
|
||||
String get pizza => 'Pizza';
|
||||
|
||||
@override
|
||||
String get sandwich => 'Sandwich';
|
||||
|
||||
@override
|
||||
String get bakery => 'Bakery';
|
||||
|
||||
@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';
|
||||
|
||||
@override
|
||||
String get login => 'Login';
|
||||
|
||||
@override
|
||||
String get phone_number => 'Phone number';
|
||||
|
||||
@override
|
||||
String get enter_phone_number => 'Enter phone number';
|
||||
|
||||
@override
|
||||
String get password => 'Password';
|
||||
|
||||
@override
|
||||
String get enter_password => 'Enter password';
|
||||
|
||||
@override
|
||||
String get forgot_password => 'Forgot password';
|
||||
|
||||
@override
|
||||
String get continue_str => 'Continue';
|
||||
|
||||
@override
|
||||
String get dont_have_account => 'Don\'t have an account?';
|
||||
|
||||
@override
|
||||
String get sign_up => 'SignUp';
|
||||
|
||||
@override
|
||||
String get field_cannot_be_empty => 'This field cannot be empty';
|
||||
|
||||
@override
|
||||
String get invalid_phone_format => 'Invalid phone number format';
|
||||
|
||||
@override
|
||||
String get password_too_short =>
|
||||
'Password must be at least 6 characters long';
|
||||
|
||||
@override
|
||||
String get invalid_phone_format => 'Invalid phone number format';
|
||||
String get passwords_do_not_match => 'Passwords do not match';
|
||||
|
||||
@override
|
||||
String get first_name => 'First name';
|
||||
String get otp_code_incomplete => 'OTP code is incomplete';
|
||||
|
||||
@override
|
||||
String get enter_first_name => 'Enter first name';
|
||||
|
||||
@override
|
||||
String get repeat_password => 'Repeat password';
|
||||
|
||||
@override
|
||||
String get enter_repeat_password => 'Enter repeat password';
|
||||
|
||||
@override
|
||||
String get already_has_account => 'Already have an account?';
|
||||
|
||||
@override
|
||||
String get unexpected_error => 'Unexpected error';
|
||||
|
||||
@override
|
||||
String consent_message(String appName) {
|
||||
return 'By proceeding, you consent to get calls or SMS messages, including by automated means, from $appName and its affiliates to the number provided.';
|
||||
}
|
||||
|
||||
@override
|
||||
String get otp_code_incomplete =>
|
||||
'Code is incomplete. Please enter the full code.';
|
||||
|
||||
@override
|
||||
String get passwords_do_not_match => 'Passwords do not match.';
|
||||
|
||||
@override
|
||||
String get reset_password => 'Reset password';
|
||||
|
||||
@override
|
||||
String get new_password => 'New password';
|
||||
|
||||
@override
|
||||
String enter_otp_code(String phoneNumber) {
|
||||
return 'Enter the 5-digit code sent to you at $phoneNumber';
|
||||
}
|
||||
|
||||
@override
|
||||
String get resend_otp_after => 'You can resend OTP after';
|
||||
String get unexpected_error =>
|
||||
'An unexpected error occurred. Please try again.';
|
||||
}
|
||||
|
||||
@@ -9,422 +9,22 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
AppLocalizationsRu([String locale = 'ru']) : super(locale);
|
||||
|
||||
@override
|
||||
String get useYourTAxiAccount =>
|
||||
'Используйте свой аккаунт Uber, чтобы начать';
|
||||
|
||||
@override
|
||||
String get enterYourMobileNumber => 'Введите свой номер телефона';
|
||||
|
||||
@override
|
||||
String get mobileNumber => 'Номер телефона';
|
||||
|
||||
@override
|
||||
String get next => 'Далее';
|
||||
|
||||
@override
|
||||
String get contestToGetCallAndSms =>
|
||||
'Продолжая, вы соглашаетесь получать звонки, сообщения WhatsApp или SMS, включая автоматические, от Uber и его партнеров на указанный номер.';
|
||||
|
||||
@override
|
||||
String get continueWithGoogle => 'Продолжить через Google';
|
||||
|
||||
@override
|
||||
String get or => 'или';
|
||||
|
||||
@override
|
||||
String get welcomeBack => 'С возвращением, null';
|
||||
|
||||
@override
|
||||
String get pleaseEnterYourPassword => 'Пожалуйста, введите свой пароль';
|
||||
|
||||
@override
|
||||
String get iHaveForgotPassword => 'Я забыл пароль';
|
||||
|
||||
@override
|
||||
String get iCantSignIn => 'Не могу войти в систему';
|
||||
|
||||
@override
|
||||
String enter4DigitCodeSentYou(String phone) {
|
||||
return 'Введите 4-значный код, отправленный на номер $phone';
|
||||
}
|
||||
|
||||
@override
|
||||
String iHavenRecievedCode(String time) {
|
||||
return 'Я не получил код (\$$time)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get delivery => 'Доставка';
|
||||
|
||||
@override
|
||||
String get pickUp => 'Самовывоз';
|
||||
|
||||
@override
|
||||
String get dineIn => 'На месте';
|
||||
|
||||
@override
|
||||
String get allCategories => 'Все категории';
|
||||
|
||||
@override
|
||||
String get convenience => 'Магазин';
|
||||
|
||||
@override
|
||||
String get alcohol => 'Алкоголь';
|
||||
|
||||
@override
|
||||
String get petSupplies => 'Для питомцев';
|
||||
|
||||
@override
|
||||
String get flowers => 'Цветы';
|
||||
|
||||
@override
|
||||
String get grocery => 'Продукты';
|
||||
|
||||
@override
|
||||
String get american => 'Американская';
|
||||
|
||||
@override
|
||||
String get speciality => 'Особенная';
|
||||
|
||||
@override
|
||||
String get takeout => 'На вынос';
|
||||
|
||||
@override
|
||||
String get asian => 'Азиатская кухня';
|
||||
|
||||
@override
|
||||
String get iceCream => 'Мороженое';
|
||||
|
||||
@override
|
||||
String get halal => 'Халяль';
|
||||
|
||||
@override
|
||||
String get retails => 'Розница';
|
||||
|
||||
@override
|
||||
String get caribbean => 'Карибская';
|
||||
|
||||
@override
|
||||
String get indian => 'Индийская кухня';
|
||||
|
||||
@override
|
||||
String get french => 'Французская';
|
||||
|
||||
@override
|
||||
String get fastFoods => 'Фастфуд';
|
||||
|
||||
@override
|
||||
String get burger => 'Бургер';
|
||||
|
||||
@override
|
||||
String get ride => 'Поездка';
|
||||
|
||||
@override
|
||||
String get chinese => 'Китайская кухня';
|
||||
|
||||
@override
|
||||
String get dessert => 'Десерт';
|
||||
|
||||
@override
|
||||
String get more => 'Ещё';
|
||||
|
||||
@override
|
||||
String get orderDetails => 'Детали заказа';
|
||||
|
||||
@override
|
||||
String get deliverNow => 'Доставить сейчас';
|
||||
|
||||
@override
|
||||
String get schedule => 'Запланировать';
|
||||
|
||||
@override
|
||||
String get enterNewAddress => 'Введите новый адрес';
|
||||
|
||||
@override
|
||||
String get nearby => 'Рядом';
|
||||
|
||||
@override
|
||||
String get currentLocation => 'Текущее местоположение';
|
||||
|
||||
@override
|
||||
String get enable => 'Включить';
|
||||
|
||||
@override
|
||||
String get recentLocations => 'Недавние адреса';
|
||||
|
||||
@override
|
||||
String get allFilters => 'Все фильтры';
|
||||
|
||||
@override
|
||||
String get sort => 'Сортировка';
|
||||
|
||||
@override
|
||||
String get pickedForYou => 'Подобрано для вас (по умолчанию)';
|
||||
|
||||
@override
|
||||
String get mostPopular => 'Самые популярные';
|
||||
|
||||
@override
|
||||
String get rating => 'Рейтинг';
|
||||
|
||||
@override
|
||||
String get deliveryTime => 'Время доставки';
|
||||
|
||||
@override
|
||||
String fromUberEats(String name) {
|
||||
return 'От $name';
|
||||
}
|
||||
|
||||
@override
|
||||
String get deals => 'Скидки';
|
||||
|
||||
@override
|
||||
String get bestOverall => 'Лучшие варианты';
|
||||
|
||||
@override
|
||||
String get priceRange => 'Диапазон цен';
|
||||
|
||||
@override
|
||||
String get maxDeliveryFee => 'Макс. стоимость доставки';
|
||||
|
||||
@override
|
||||
String get dietary => 'Диета';
|
||||
|
||||
@override
|
||||
String get vegetarian => 'Вегетарианское';
|
||||
|
||||
@override
|
||||
String get vegan => 'Веганское';
|
||||
|
||||
@override
|
||||
String get glutenFree => 'Без глютена';
|
||||
|
||||
@override
|
||||
String get allergyFriendly => 'Без аллергенов';
|
||||
|
||||
@override
|
||||
String get atLeast => 'Kак минимум';
|
||||
|
||||
@override
|
||||
String get apply => 'Применить';
|
||||
|
||||
@override
|
||||
String get pickedForYouDefault => 'Выбрано для вас (по умолчанию)';
|
||||
|
||||
@override
|
||||
String get popular => 'Самые популярные';
|
||||
|
||||
@override
|
||||
String get topRated => 'Высокий рейтинг';
|
||||
|
||||
@override
|
||||
String get fast => 'Быстро';
|
||||
|
||||
@override
|
||||
String get featuredStores => 'Популярные магазины';
|
||||
|
||||
@override
|
||||
String opensAt(String time) {
|
||||
return 'Открывается в $time';
|
||||
}
|
||||
|
||||
@override
|
||||
String spendAndSave(String spend, String save) {
|
||||
return 'Потратьте $spend, сэкономьте $save';
|
||||
}
|
||||
|
||||
@override
|
||||
String get cartsTitle => 'Корзины';
|
||||
|
||||
@override
|
||||
String get addItemsStartBasket => 'Добавьте товары, чтобы создать корзину';
|
||||
|
||||
@override
|
||||
String get basketHint =>
|
||||
'Когда вы добавите товары из ресторана или магазина, ваша корзина появится здесь.';
|
||||
|
||||
@override
|
||||
String get startShopping => 'Начать покупки';
|
||||
|
||||
@override
|
||||
String get orders => 'Заказы';
|
||||
|
||||
@override
|
||||
String get recentSearches => 'Недавние запросы';
|
||||
|
||||
@override
|
||||
String get cafe => 'Кафе';
|
||||
|
||||
@override
|
||||
String get irish => 'Ирландская кухня';
|
||||
|
||||
@override
|
||||
String get topCategories => 'Популярные категории';
|
||||
|
||||
@override
|
||||
String get breakfastAndBrunch => 'Завтрак и бранч';
|
||||
|
||||
@override
|
||||
String get coffeeAndTea => 'Кофе и чай';
|
||||
|
||||
@override
|
||||
String get latestDeals => 'Новые предложения';
|
||||
|
||||
@override
|
||||
String get restaurantRewards => 'Бонусы ресторанов';
|
||||
|
||||
@override
|
||||
String get nationwideShipping => 'Доставка по всей стране';
|
||||
|
||||
@override
|
||||
String get mexican => 'Мексиканская кухня';
|
||||
|
||||
@override
|
||||
String get fastFood => 'Фастфуд';
|
||||
|
||||
@override
|
||||
String get healthy => 'Здоровая еда';
|
||||
|
||||
@override
|
||||
String get pizza => 'Пицца';
|
||||
|
||||
@override
|
||||
String get sandwich => 'Сэндвич';
|
||||
|
||||
@override
|
||||
String get bakery => 'Пекарня';
|
||||
|
||||
@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 => 'Язык';
|
||||
|
||||
@override
|
||||
String get login => 'Вход';
|
||||
|
||||
@override
|
||||
String get phone_number => 'Номер телефона';
|
||||
|
||||
@override
|
||||
String get enter_phone_number => 'Введите номер телефона';
|
||||
|
||||
@override
|
||||
String get password => 'Пароль';
|
||||
|
||||
@override
|
||||
String get enter_password => 'Введите пароль';
|
||||
|
||||
@override
|
||||
String get forgot_password => 'Забыли пароль';
|
||||
|
||||
@override
|
||||
String get continue_str => 'Продолжить';
|
||||
|
||||
@override
|
||||
String get dont_have_account => 'У вас нет аккаунта?';
|
||||
|
||||
@override
|
||||
String get sign_up => 'Зарегистрироваться';
|
||||
|
||||
@override
|
||||
String get field_cannot_be_empty => 'Это поле не может быть пустым';
|
||||
|
||||
@override
|
||||
String get password_too_short => 'Пароль не может быть короче 6 символов';
|
||||
String get field_cannot_be_empty => 'Поле не может быть пустым';
|
||||
|
||||
@override
|
||||
String get invalid_phone_format => 'Неверный формат номера телефона';
|
||||
|
||||
@override
|
||||
String get first_name => 'Имя';
|
||||
String get password_too_short =>
|
||||
'Пароль должен содержать не менее 6 символов';
|
||||
|
||||
@override
|
||||
String get enter_first_name => 'Введите имя';
|
||||
String get passwords_do_not_match => 'Пароли не совпадают';
|
||||
|
||||
@override
|
||||
String get repeat_password => 'Повторите пароль';
|
||||
String get otp_code_incomplete => 'Код подтверждения введён не полностью';
|
||||
|
||||
@override
|
||||
String get enter_repeat_password => 'Введите пароль ещё раз';
|
||||
|
||||
@override
|
||||
String get already_has_account => 'Уже есть аккаунт?';
|
||||
|
||||
@override
|
||||
String get unexpected_error => 'Неожиданная ошибка';
|
||||
|
||||
@override
|
||||
String consent_message(String appName) {
|
||||
return 'Продолжая, вы соглашаетесь получать звонки или SMS-сообщения, включая автоматические, от $appName и его партнёров на указанный номер.';
|
||||
}
|
||||
|
||||
@override
|
||||
String get otp_code_incomplete =>
|
||||
'Код неполный. Пожалуйста, введите полный код.';
|
||||
|
||||
@override
|
||||
String get passwords_do_not_match => 'Пароли не совпадают.';
|
||||
|
||||
@override
|
||||
String get reset_password => 'Восстановить пароль';
|
||||
|
||||
@override
|
||||
String get new_password => 'Новый пароль';
|
||||
|
||||
@override
|
||||
String enter_otp_code(String phoneNumber) {
|
||||
return 'Введите 5-значный код, отправленный на номер $phoneNumber';
|
||||
}
|
||||
|
||||
@override
|
||||
String get resend_otp_after => 'Вы можете повторно отправить код через';
|
||||
String get unexpected_error =>
|
||||
'Произошла непредвиденная ошибка. Пожалуйста, попробуйте снова.';
|
||||
}
|
||||
|
||||
@@ -9,423 +9,22 @@ class AppLocalizationsUz extends AppLocalizations {
|
||||
AppLocalizationsUz([String locale = 'uz']) : super(locale);
|
||||
|
||||
@override
|
||||
String get useYourTAxiAccount =>
|
||||
'Boshlash uchun Uber hisobingizdan foydalaning';
|
||||
String get field_cannot_be_empty => 'Maydon bo‘sh bo‘lishi mumkin emas';
|
||||
|
||||
@override
|
||||
String get enterYourMobileNumber => 'Telefon raqamingizni kiriting';
|
||||
|
||||
@override
|
||||
String get mobileNumber => 'Telefon raqami';
|
||||
|
||||
@override
|
||||
String get next => 'Keyingi';
|
||||
|
||||
@override
|
||||
String get contestToGetCallAndSms =>
|
||||
'Davom etish orqali siz Uber va uning hamkorlaridan avtomatlashtirilgan qo‘ng‘iroqlar, WhatsApp yoki SMS xabarlarini olishga rozilik bildirasiz.';
|
||||
|
||||
@override
|
||||
String get continueWithGoogle => 'Google orqali davom etish';
|
||||
|
||||
@override
|
||||
String get or => 'yoki';
|
||||
|
||||
@override
|
||||
String get welcomeBack => 'Xush kelibsiz, null';
|
||||
|
||||
@override
|
||||
String get pleaseEnterYourPassword => 'Iltimos, parolingizni kiriting';
|
||||
|
||||
@override
|
||||
String get iHaveForgotPassword => 'Parolimni unutdim';
|
||||
|
||||
@override
|
||||
String get iCantSignIn => 'Kirishda muammo bor';
|
||||
|
||||
@override
|
||||
String enter4DigitCodeSentYou(String phone) {
|
||||
return 'Sizga $phone raqamiga yuborilgan 4 xonali kodni kiriting';
|
||||
}
|
||||
|
||||
@override
|
||||
String iHavenRecievedCode(String time) {
|
||||
return 'Men hali kodni olmabman (\$$time)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get delivery => 'Yetkazish';
|
||||
|
||||
@override
|
||||
String get pickUp => 'Olib ketish';
|
||||
|
||||
@override
|
||||
String get dineIn => 'Joyida';
|
||||
|
||||
@override
|
||||
String get allCategories => 'Barcha toifalar';
|
||||
|
||||
@override
|
||||
String get convenience => 'Do‘kon';
|
||||
|
||||
@override
|
||||
String get alcohol => 'Alkogol';
|
||||
|
||||
@override
|
||||
String get petSupplies => 'Uy hayvoni uchun';
|
||||
|
||||
@override
|
||||
String get flowers => 'Gullar';
|
||||
|
||||
@override
|
||||
String get grocery => 'Bozor';
|
||||
|
||||
@override
|
||||
String get american => 'Amerika';
|
||||
|
||||
@override
|
||||
String get speciality => 'Maxsus';
|
||||
|
||||
@override
|
||||
String get takeout => 'Olib ketish';
|
||||
|
||||
@override
|
||||
String get asian => 'Osiyo taomlari';
|
||||
|
||||
@override
|
||||
String get iceCream => 'Muzqaymoq';
|
||||
|
||||
@override
|
||||
String get halal => 'Halol';
|
||||
|
||||
@override
|
||||
String get retails => 'Do‘konlar';
|
||||
|
||||
@override
|
||||
String get caribbean => 'Karib';
|
||||
|
||||
@override
|
||||
String get indian => 'Hind taomlari';
|
||||
|
||||
@override
|
||||
String get french => 'Fransuz';
|
||||
|
||||
@override
|
||||
String get fastFoods => 'Fast-fud';
|
||||
|
||||
@override
|
||||
String get burger => 'Burger';
|
||||
|
||||
@override
|
||||
String get ride => 'Yo‘l';
|
||||
|
||||
@override
|
||||
String get chinese => 'Xitoy taomlari';
|
||||
|
||||
@override
|
||||
String get dessert => 'Desert';
|
||||
|
||||
@override
|
||||
String get more => 'Ko\'proq';
|
||||
|
||||
@override
|
||||
String get orderDetails => 'Buyurtma tafsilotlari';
|
||||
|
||||
@override
|
||||
String get deliverNow => 'Hozir yetkazish';
|
||||
|
||||
@override
|
||||
String get schedule => 'Rejalashtirish';
|
||||
|
||||
@override
|
||||
String get enterNewAddress => 'Yangi manzil kiriting';
|
||||
|
||||
@override
|
||||
String get nearby => 'Yaqin joylar';
|
||||
|
||||
@override
|
||||
String get currentLocation => 'Joriy joylashuv';
|
||||
|
||||
@override
|
||||
String get enable => 'Yoqqish';
|
||||
|
||||
@override
|
||||
String get recentLocations => 'Yaqinda ishlatilgan manzillar';
|
||||
|
||||
@override
|
||||
String get allFilters => 'Barcha filtrlar';
|
||||
|
||||
@override
|
||||
String get sort => 'Saralash';
|
||||
|
||||
@override
|
||||
String get pickedForYou => 'Siz uchun';
|
||||
|
||||
@override
|
||||
String get mostPopular => 'Eng ommabop';
|
||||
|
||||
@override
|
||||
String get rating => 'Reyting';
|
||||
|
||||
@override
|
||||
String get deliveryTime => 'Yetkazib berish vaqti';
|
||||
|
||||
@override
|
||||
String fromUberEats(String name) {
|
||||
return '$name tomonidan';
|
||||
}
|
||||
|
||||
@override
|
||||
String get deals => 'Aksiyalar';
|
||||
|
||||
@override
|
||||
String get bestOverall => 'Eng yaxshilari';
|
||||
|
||||
@override
|
||||
String get priceRange => 'Narx oralig‘i';
|
||||
|
||||
@override
|
||||
String get maxDeliveryFee => 'Maks. yetkazish narxi';
|
||||
|
||||
@override
|
||||
String get dietary => 'Parhez';
|
||||
|
||||
@override
|
||||
String get vegetarian => 'Vegetarian';
|
||||
|
||||
@override
|
||||
String get vegan => 'Vegan';
|
||||
|
||||
@override
|
||||
String get glutenFree => 'Glutensiz';
|
||||
|
||||
@override
|
||||
String get allergyFriendly => 'Allergiyaga mos';
|
||||
|
||||
@override
|
||||
String get atLeast => 'Kаmida';
|
||||
|
||||
@override
|
||||
String get apply => 'Qo‘llash';
|
||||
|
||||
@override
|
||||
String get pickedForYouDefault => 'Siz uchun tanlangan (standart)';
|
||||
|
||||
@override
|
||||
String get popular => 'Eng ommabop';
|
||||
|
||||
@override
|
||||
String get topRated => 'Yuqori reytingli';
|
||||
|
||||
@override
|
||||
String get fast => 'Tezkor';
|
||||
|
||||
@override
|
||||
String get featuredStores => 'Mashhur do‘konlar';
|
||||
|
||||
@override
|
||||
String opensAt(String time) {
|
||||
return 'Soat $time dan ochiladi';
|
||||
}
|
||||
|
||||
@override
|
||||
String spendAndSave(String spend, String save) {
|
||||
return '$spend sarflang, $save tejang';
|
||||
}
|
||||
|
||||
@override
|
||||
String get cartsTitle => 'Savatlar';
|
||||
|
||||
@override
|
||||
String get addItemsStartBasket => 'Savatni boshlash uchun mahsulot qo‘shing';
|
||||
|
||||
@override
|
||||
String get basketHint =>
|
||||
'Restorandan yoki do\'kondan mahsulot qo‘shsangiz, savatingiz shu yerda paydo bo‘ladi.';
|
||||
|
||||
@override
|
||||
String get startShopping => 'Xaridni boshlash';
|
||||
|
||||
@override
|
||||
String get orders => 'Buyurtmalar';
|
||||
|
||||
@override
|
||||
String get recentSearches => 'Yaqinda qidirilganlar';
|
||||
|
||||
@override
|
||||
String get cafe => 'Kafe';
|
||||
|
||||
@override
|
||||
String get irish => 'Irlandcha';
|
||||
|
||||
@override
|
||||
String get topCategories => 'Eng ommabop toifalar';
|
||||
|
||||
@override
|
||||
String get breakfastAndBrunch => 'Nonushta va bransh';
|
||||
|
||||
@override
|
||||
String get coffeeAndTea => 'Qahva va choy';
|
||||
|
||||
@override
|
||||
String get latestDeals => 'Yangi chegirmalar';
|
||||
|
||||
@override
|
||||
String get restaurantRewards => 'Restoran bonuslari';
|
||||
|
||||
@override
|
||||
String get nationwideShipping => 'Butun mamlakat bo‘ylab yetkazib berish';
|
||||
|
||||
@override
|
||||
String get mexican => 'Meksika taomlari';
|
||||
|
||||
@override
|
||||
String get fastFood => 'Tezkor ovqatlar';
|
||||
|
||||
@override
|
||||
String get healthy => 'Sog‘lom ovqatlar';
|
||||
|
||||
@override
|
||||
String get pizza => 'Pitsa';
|
||||
|
||||
@override
|
||||
String get sandwich => 'Sendvich';
|
||||
|
||||
@override
|
||||
String get bakery => 'Qandolatxona';
|
||||
|
||||
@override
|
||||
String get categoriesShort => 'Ovqat, xaridlar, ichimliklar va boshqalar.';
|
||||
|
||||
@override
|
||||
String get yourFavourites => 'Sevimlilar';
|
||||
|
||||
@override
|
||||
String get wallet => 'Hamyon';
|
||||
|
||||
@override
|
||||
String get sendAGift => 'Sovg‘a 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';
|
||||
|
||||
@override
|
||||
String get login => 'Kirish';
|
||||
|
||||
@override
|
||||
String get phone_number => 'Telefon raqami';
|
||||
|
||||
@override
|
||||
String get enter_phone_number => 'Telefon raqamingizni kiriting';
|
||||
|
||||
@override
|
||||
String get password => 'Parol';
|
||||
|
||||
@override
|
||||
String get enter_password => 'Parolni kiriting';
|
||||
|
||||
@override
|
||||
String get forgot_password => 'Parolni unutdingizmi';
|
||||
|
||||
@override
|
||||
String get continue_str => 'Davom etish';
|
||||
|
||||
@override
|
||||
String get dont_have_account => 'Hisobingiz yo‘qmi?';
|
||||
|
||||
@override
|
||||
String get sign_up => 'Ro‘yxatdan o‘tish';
|
||||
|
||||
@override
|
||||
String get field_cannot_be_empty => 'Bu maydon bo\'sh bo\'lishi mumkin emas';
|
||||
String get invalid_phone_format => 'Telefon raqami formati noto‘g‘ri';
|
||||
|
||||
@override
|
||||
String get password_too_short =>
|
||||
'Parol 6 ta belgidan kam bo\'lishi mumkin emas';
|
||||
'Parol kamida 6 ta belgidan iborat bo‘lishi kerak';
|
||||
|
||||
@override
|
||||
String get invalid_phone_format => 'Noto\'g\'ri telefon raqam formati';
|
||||
String get passwords_do_not_match => 'Parollar mos emas';
|
||||
|
||||
@override
|
||||
String get first_name => 'Ism';
|
||||
String get otp_code_incomplete => 'OTP kodi to‘liq kiritilmagan';
|
||||
|
||||
@override
|
||||
String get enter_first_name => 'Ismingizni kiriting';
|
||||
|
||||
@override
|
||||
String get repeat_password => 'Parolni takrorlang';
|
||||
|
||||
@override
|
||||
String get enter_repeat_password => 'Parolni qayta kiriting';
|
||||
|
||||
@override
|
||||
String get already_has_account => 'Akkountingiz bormi?';
|
||||
|
||||
@override
|
||||
String get unexpected_error => 'Kutilmagan xatolik';
|
||||
|
||||
@override
|
||||
String consent_message(String appName) {
|
||||
return 'Davom etish orqali siz $appName va uning hamkorlaridan siz kiritgan raqamga, shu jumladan avtomatik vositalar orqali, qo‘ng‘iroqlar yoki SMS xabarlar olishingizga rozilik bildirasiz.';
|
||||
}
|
||||
|
||||
@override
|
||||
String get otp_code_incomplete =>
|
||||
'Kod yetarli emas. Iltimos, to‘liq kodni kiriting.';
|
||||
|
||||
@override
|
||||
String get passwords_do_not_match => 'Parollar mos kelmadi.';
|
||||
|
||||
@override
|
||||
String get reset_password => 'Parolni qayta tiklash';
|
||||
|
||||
@override
|
||||
String get new_password => 'Yangi parol';
|
||||
|
||||
@override
|
||||
String enter_otp_code(String phoneNumber) {
|
||||
return '$phoneNumber raqamiga yuborilgan 5 xonali kodni kiriting';
|
||||
}
|
||||
|
||||
@override
|
||||
String get resend_otp_after => 'OTP kodni qayta yuborish mumkin bo‘ladi';
|
||||
String get unexpected_error =>
|
||||
'Kutilmagan xatolik yuz berdi. Iltimos, qayta urinib ko‘ring.';
|
||||
}
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_otp_code_login_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/pages/forgot_password_page/forgot_password_page.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/pages/login_page/login_page.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/pages/register_page/register_page.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/pages/reset_password_page/reset_password_page.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/pages/verify_otp_code_page/verify_otp_code_page.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/pages/verify_phone_number_page/verify_phone_page.dart';
|
||||
import 'package:food_delivery_client/feature/home/presentation/pages/restaurants_by_category_page/restaurants_by_category_page.dart';
|
||||
import 'package:food_delivery_client/feature/onboarding/presentation/pages/onboarding_page/onboarding_page.dart';
|
||||
import 'package:food_delivery_client/feature/onboarding/presentation/pages/splash_page/splash_page.dart';
|
||||
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
@@ -18,67 +12,13 @@ class AppRoutes {
|
||||
navigatorKey: navigatorKey,
|
||||
initialLocation: Routes.splash,
|
||||
routes: [
|
||||
GoRoute(path: Routes.splash, builder: (context, state) => SplashPage()),
|
||||
GoRoute(
|
||||
path: Routes.login,
|
||||
pageBuilder: (context, state) => CupertinoPage(child: LoginPage()),
|
||||
),
|
||||
|
||||
GoRoute(
|
||||
path: Routes.register,
|
||||
pageBuilder: (context, state) => CupertinoPage(
|
||||
child: RegisterPage(phoneNumber: state.extra as String),
|
||||
),
|
||||
path: Routes.splash,
|
||||
pageBuilder: (context, state) => CupertinoPage(child: SplashPage()),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.forgotPassword,
|
||||
pageBuilder: (context, state) =>
|
||||
CupertinoPage(child: ForgotPasswordPage()),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.verifyPhoneNumber,
|
||||
pageBuilder: (context, state) => CupertinoPage(
|
||||
child: VerifyPhoneNumberPage(isRegister: state.extra as bool),
|
||||
),
|
||||
),
|
||||
|
||||
GoRoute(
|
||||
path: Routes.verifyOtpCode,
|
||||
pageBuilder: (context, state) => CupertinoPage(
|
||||
child: VerifyOtpCodePage(params: state.extra as OtpCodePageParams),
|
||||
),
|
||||
),
|
||||
|
||||
GoRoute(
|
||||
path: Routes.resetPassword,
|
||||
pageBuilder: (context, state) => CupertinoPage(
|
||||
child: ResetPasswordPage(phoneNumber: state.extra as String),
|
||||
),
|
||||
),
|
||||
|
||||
GoRoute(
|
||||
path: Routes.main,
|
||||
pageBuilder: (context, state) => CupertinoPage(child: MainPage()),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.categories,
|
||||
pageBuilder: (context, state) => CupertinoPage(child: CategoriesPage()),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.filters,
|
||||
pageBuilder: (context, state) => CupertinoPage(
|
||||
child: FiltersPage(homeBloc: state.extra as HomeBloc),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.restaurantsByCategory,
|
||||
pageBuilder: (context, state) => CupertinoPage(
|
||||
child: RestaurantsByCategoryPage(categoryName: state.extra as String),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.browse,
|
||||
pageBuilder: (context, state) => CupertinoPage(child: BrowsePage()),
|
||||
path: Routes.onBoarding,
|
||||
pageBuilder: (context, state) => CupertinoPage(child: OnboardingPage()),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
abstract class Routes {
|
||||
static const String splash = '/splash';
|
||||
static const String onBoarding = '/onboarding';
|
||||
static const String login = '/login';
|
||||
static const String register = '/register';
|
||||
static const String main = '/main';
|
||||
|
||||
@@ -28,5 +28,24 @@ abstract class AppColors {
|
||||
static const Color c7F7F7F = Color(0xFF7F7F7F);
|
||||
static const Color c888888 = Color(0xFF888888);
|
||||
|
||||
|
||||
/*
|
||||
New figma colors
|
||||
*/
|
||||
static const Color c0A0D13 = Color(0xFF0A0D13);
|
||||
static const Color cFF6F00 = Color(0xFFFF6F00);
|
||||
static const Color cFF9D3F = Color(0xFFFF9D3F);
|
||||
static const Color cFFB966 = Color(0xFFFFB966);
|
||||
static const Color cFFB669 = Color(0xFFFFB699);
|
||||
static const Color cFFEDCC = Color(0xFFFFEDCC);
|
||||
static const Color c2C3131 = Color(0xFF2C3131);
|
||||
static const Color c626262 = Color(0xFF626262);
|
||||
static const Color cA9A9A9 = Color(0xFFA9A9A9);
|
||||
static const Color cCACACA = Color(0xFFCACACA);
|
||||
static const Color cE9E9E9 = Color(0xFFE9E9E9);
|
||||
static const Color c292F3D = Color(0xFF292F3D);
|
||||
static const Color c131720 = Color(0xFF131720);
|
||||
static const Color cBD3325 = Color(0xFFBD3325);
|
||||
static const Color c9EA5B7 = Color(0xFF9EA5B7);
|
||||
static const Color c479B36 = Color(0xFF479B36);
|
||||
static const Color cFFAB40 = Color(0xFFFFAB40);
|
||||
}
|
||||
|
||||
@@ -1,64 +1,15 @@
|
||||
abstract class AppIcons {
|
||||
//baseurl
|
||||
static const String baseUrl = 'assets/icons';
|
||||
|
||||
//icons
|
||||
static const String icHome = "$baseUrl/ic_home.svg";
|
||||
static const String icBrowse = "$baseUrl/ic_browse.svg";
|
||||
static const String icBasket = "$baseUrl/ic_basket.svg";
|
||||
static const String icAccount = "$baseUrl/ic_account.svg";
|
||||
static const String icHomeActive = "$baseUrl/ic_home_active.svg";
|
||||
static const String icBrowseActive = "$baseUrl/ic_browse_active.svg";
|
||||
static const String icBasketActive = "$baseUrl/ic_basket_active.svg";
|
||||
static const String icAccountActive = "$baseUrl/ic_account_active.svg";
|
||||
static const String icBack = "$baseUrl/ic_back.svg";
|
||||
static const String icDislike = "$baseUrl/ic_dislike.svg";
|
||||
static const String icDislikeGrey = "$baseUrl/ic_dislike_grey.svg";
|
||||
static const String icEat = "$baseUrl/ic_eat.svg";
|
||||
static const String icEye = "$baseUrl/ic_eye.svg";
|
||||
static const String icFilter = "$baseUrl/ic_filter.svg";
|
||||
static const String icNext = "$baseUrl/ic_next.svg";
|
||||
static const String icNextGrey = "$baseUrl/ic_next_grey.svg";
|
||||
static const String icOval = "$baseUrl/ic_oval.svg";
|
||||
static const String icUber = "$baseUrl/ic_uber.svg";
|
||||
static const String icLocation = "$baseUrl/ic_location.svg";
|
||||
static const String icArrowBottom = "$baseUrl/ic_arrow_btm.svg";
|
||||
static const String icEmptyBasket = "$baseUrl/ic_empty_basket.svg";
|
||||
|
||||
static const String icPicked = "$baseUrl/ic_picked.svg";
|
||||
static const String icMostPopular = "$baseUrl/ic_popular.svg";
|
||||
static const String icStar = "$baseUrl/ic_rating.svg";
|
||||
static const String icDeliveryTime = "$baseUrl/ic_delivery_time.svg";
|
||||
static const String icDeals = "$baseUrl/ic_deals.svg";
|
||||
static const String icClose = "$baseUrl/ic_close.svg";
|
||||
static const String icCurrentLocation = "$baseUrl/ic_current_loc.svg";
|
||||
static const String icEdit = "$baseUrl/ic_edit.svg";
|
||||
static const String icSearch = "$baseUrl/ic_search.svg";
|
||||
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";
|
||||
static const String icArrowRightLight = "$baseUrl/ic_arrow_right_light.svg";
|
||||
|
||||
///.png icons
|
||||
static const String icBestOverall = "$baseUrl/ic_best.png";
|
||||
static const String icVegetarian = "$baseUrl/ic_vegetarian.png";
|
||||
static const String icVegen = "$baseUrl/ic_vegen.png";
|
||||
static const String icGlutenFree = "$baseUrl/ic_gluten_free.png";
|
||||
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";
|
||||
static const String baseUrl = "assets/icons/common";
|
||||
static const String icLogo = "$baseUrl/ic_logo.svg";
|
||||
}
|
||||
|
||||
abstract class AppLightSvgs {
|
||||
static const String baseUrl = "assets/icons/light";
|
||||
|
||||
static const String icSplash = "$baseUrl/ic_splash.svg";
|
||||
}
|
||||
|
||||
abstract class AppDarkSvgs {
|
||||
static const String baseUrl = "assets/icons/dark";
|
||||
static const String icSplash = "$baseUrl/ic_splash.svg";
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import 'package:food_delivery_client/core/theme/app_theme_textstyles.dart';
|
||||
import 'package:food_delivery_client/core/theme/theme_icons.dart';
|
||||
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
abstract class AppTheme {
|
||||
static ThemeData get lightTheme => ThemeData.light().copyWith(
|
||||
brightness: Brightness.light,
|
||||
extensions: [AppThemeIcons.light, AppThemeTextStyles.light],
|
||||
|
||||
// colorScheme: ColorScheme(
|
||||
// brightness: Brightness.light,
|
||||
@@ -22,6 +26,93 @@ abstract class AppTheme {
|
||||
surfaceTintColor: AppColors.cTransparent,
|
||||
),
|
||||
scaffoldBackgroundColor: AppColors.cFFFFFF,
|
||||
progressIndicatorTheme: ProgressIndicatorThemeData(
|
||||
color: AppColors.cFFFFFF,
|
||||
circularTrackColor: AppColors.cFFFFFF,
|
||||
linearTrackColor: AppColors.cFFFFFF,
|
||||
borderRadius: BorderRadiusGeometry.circular(30),
|
||||
),
|
||||
|
||||
pageTransitionsTheme: PageTransitionsTheme(
|
||||
builders: {
|
||||
TargetPlatform.android: CupertinoPageTransitionsBuilder(),
|
||||
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
||||
},
|
||||
),
|
||||
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
||||
elevation: 0,
|
||||
showSelectedLabels: true,
|
||||
showUnselectedLabels: true,
|
||||
backgroundColor: AppColors.cFFFFFF,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
unselectedItemColor: AppColors.cB5B5B5,
|
||||
selectedItemColor: AppColors.c000000,
|
||||
selectedLabelStyle: AppTextStyles.size10Regular.copyWith(
|
||||
color: Colors.red,
|
||||
),
|
||||
unselectedLabelStyle: AppTextStyles.size10Regular.copyWith(
|
||||
color: AppColors.c000000,
|
||||
),
|
||||
// unselectedLabelStyle: AppTextStyles.size14Medium.copyWith(
|
||||
// color: AppColors.c888888,
|
||||
// fontFamily: "fontNorms",
|
||||
// ),
|
||||
),
|
||||
// inputDecorationTheme: InputDecorationTheme(
|
||||
// filled: true,
|
||||
// fillColor: AppColors.cMainBg,
|
||||
// hintStyle: AppTextStyles.size15Medium.copyWith(color: AppColors.c888888),
|
||||
// contentPadding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.h),
|
||||
// errorStyle: AppTextStyles.size12Medium.copyWith(color: AppColors.cRed),
|
||||
// errorBorder: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cRed, width: 1.5.r),
|
||||
// ),
|
||||
// focusedBorder: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cFF9914, width: 1.5.r),
|
||||
// ),
|
||||
// enabledBorder: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cEDEDED, width: 1.5.r),
|
||||
// ),
|
||||
// focusedErrorBorder: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cRed, width: 1.5.r),
|
||||
// ),
|
||||
// disabledBorder: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cEDEDED, width: 1.5.r),
|
||||
// ),
|
||||
// border: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cEDEDED, width: 1.5.r),
|
||||
// ),
|
||||
// ),
|
||||
);
|
||||
|
||||
static ThemeData get darkTheme => ThemeData.light().copyWith(
|
||||
brightness: Brightness.dark,
|
||||
extensions: [AppThemeIcons.dark, AppThemeTextStyles.dark],
|
||||
|
||||
// colorScheme: ColorScheme(
|
||||
// brightness: Brightness.light,
|
||||
// primary: AppColors.cFFFFFF,
|
||||
// onPrimary:AppColors.cFFFFFF,
|
||||
// secondary: AppColors.cFFFFFF,
|
||||
// onSecondary: AppColors.cFFFFFF,
|
||||
// error:AppColors.cRed,
|
||||
// onError: AppColors.cRed,
|
||||
// surface: AppColors.cFFFFFF,
|
||||
// onSurface: AppColors.cFFFFFF,
|
||||
// ),
|
||||
appBarTheme: AppBarTheme(
|
||||
elevation: 0,
|
||||
backgroundColor: AppColors.cFFFFFF,
|
||||
foregroundColor: AppColors.cFFFFFF,
|
||||
surfaceTintColor: AppColors.cTransparent,
|
||||
),
|
||||
scaffoldBackgroundColor: AppColors.c0A0D13,
|
||||
|
||||
progressIndicatorTheme: ProgressIndicatorThemeData(
|
||||
color: AppColors.cFFFFFF,
|
||||
|
||||
157
lib/core/theme/app_theme_textstyles.dart
Normal file
157
lib/core/theme/app_theme_textstyles.dart
Normal file
@@ -0,0 +1,157 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:food_delivery_client/core/constants/app_locale_keys.dart';
|
||||
import 'package:food_delivery_client/core/core.dart';
|
||||
|
||||
class AppThemeTextStyles extends ThemeExtension<AppThemeTextStyles> {
|
||||
//Regular fonts
|
||||
final TextStyle size14Regular;
|
||||
|
||||
//Medium
|
||||
|
||||
final TextStyle size16Medium;
|
||||
|
||||
//SemiBold
|
||||
|
||||
final TextStyle size16SemiBold;
|
||||
final TextStyle size24SemiBold;
|
||||
|
||||
//Bold
|
||||
|
||||
final TextStyle size14Bold;
|
||||
final TextStyle size24Bold;
|
||||
|
||||
//Black
|
||||
final TextStyle size64Black;
|
||||
|
||||
AppThemeTextStyles({
|
||||
required this.size14Regular,
|
||||
required this.size16Medium,
|
||||
required this.size16SemiBold,
|
||||
required this.size24SemiBold,
|
||||
required this.size14Bold,
|
||||
required this.size24Bold,
|
||||
required this.size64Black,
|
||||
});
|
||||
|
||||
static const String _fontBlack = AppLocaleKeys.fontBlack;
|
||||
static const String _fontBold = AppLocaleKeys.fontBold;
|
||||
static const String _fontSemiBold = AppLocaleKeys.fontSemiBold;
|
||||
static const String _fontMedium = AppLocaleKeys.fontMedium;
|
||||
static const String _fontRegular = AppLocaleKeys.fontRegular;
|
||||
|
||||
static AppThemeTextStyles light = AppThemeTextStyles(
|
||||
size14Regular: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontFamily: _fontRegular,
|
||||
),
|
||||
size16Medium: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: _fontMedium,
|
||||
),
|
||||
size16SemiBold: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: _fontSemiBold,
|
||||
),
|
||||
size24SemiBold: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: _fontSemiBold,
|
||||
),
|
||||
size14Bold: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: _fontBold,
|
||||
),
|
||||
size24Bold: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: _fontBold,
|
||||
),
|
||||
size64Black: TextStyle(
|
||||
fontSize: 64,
|
||||
fontWeight: FontWeight.w900,
|
||||
fontFamily: _fontBlack,
|
||||
color: AppColors.cFFFFFF,
|
||||
),
|
||||
);
|
||||
|
||||
static AppThemeTextStyles dark = AppThemeTextStyles(
|
||||
size14Regular: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontFamily: _fontRegular,
|
||||
),
|
||||
size16Medium: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: _fontMedium,
|
||||
),
|
||||
size16SemiBold: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: _fontSemiBold,
|
||||
),
|
||||
size24SemiBold: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: _fontSemiBold,
|
||||
),
|
||||
size14Bold: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: _fontBold,
|
||||
),
|
||||
size24Bold: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: _fontBold,
|
||||
),
|
||||
size64Black: TextStyle(
|
||||
fontSize: 64,
|
||||
fontWeight: FontWeight.w900,
|
||||
fontFamily: _fontBlack,
|
||||
color: AppColors.cFFFFFF,
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
ThemeExtension<AppThemeTextStyles> copyWith({
|
||||
TextStyle? size14Regular,
|
||||
TextStyle? size16Medium,
|
||||
TextStyle? size16SemiBold,
|
||||
TextStyle? size24SemiBold,
|
||||
TextStyle? size14Bold,
|
||||
TextStyle? size24Bold,
|
||||
TextStyle? size64Black,
|
||||
}) {
|
||||
return AppThemeTextStyles(
|
||||
size14Regular: size14Regular ?? this.size14Regular,
|
||||
size16Medium: size16Medium ?? this.size16Medium,
|
||||
size16SemiBold: size16SemiBold ?? this.size16SemiBold,
|
||||
size24SemiBold: size24SemiBold ?? this.size24SemiBold,
|
||||
size14Bold: size14Bold ?? this.size14Bold,
|
||||
size24Bold: size24Bold ?? this.size24Bold,
|
||||
size64Black: size64Black ?? this.size64Black,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
ThemeExtension<AppThemeTextStyles> lerp(
|
||||
covariant ThemeExtension<AppThemeTextStyles>? other,
|
||||
double t,
|
||||
) {
|
||||
if (other is! AppThemeTextStyles) return this;
|
||||
return AppThemeTextStyles(
|
||||
size14Regular: TextStyle.lerp(size14Regular, other.size14Regular, t)!,
|
||||
size16Medium: TextStyle.lerp(size16Medium, other.size16Medium, t)!,
|
||||
size16SemiBold: TextStyle.lerp(size16SemiBold, other.size16SemiBold, t)!,
|
||||
size24SemiBold: TextStyle.lerp(size24SemiBold, other.size24SemiBold, t)!,
|
||||
size14Bold: TextStyle.lerp(size14Bold, other.size14Bold, t)!,
|
||||
size24Bold: TextStyle.lerp(size24Bold, other.size24Bold, t)!,
|
||||
size64Black: TextStyle.lerp(size64Black, other.size64Black, t)!,
|
||||
);
|
||||
}
|
||||
}
|
||||
26
lib/core/theme/theme_icons.dart
Normal file
26
lib/core/theme/theme_icons.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:food_delivery_client/core/core.dart';
|
||||
|
||||
class AppThemeIcons extends ThemeExtension<AppThemeIcons> {
|
||||
final String icSplash;
|
||||
|
||||
AppThemeIcons({required this.icSplash});
|
||||
|
||||
static AppThemeIcons light = AppThemeIcons(icSplash: AppLightSvgs.icSplash);
|
||||
|
||||
static AppThemeIcons dark = AppThemeIcons(icSplash: AppDarkSvgs.icSplash);
|
||||
|
||||
@override
|
||||
ThemeExtension<AppThemeIcons> copyWith({String? icSplash}) {
|
||||
return AppThemeIcons(icSplash: icSplash ?? this.icSplash);
|
||||
}
|
||||
|
||||
@override
|
||||
ThemeExtension<AppThemeIcons> lerp(
|
||||
covariant ThemeExtension<AppThemeIcons>? other,
|
||||
double t,
|
||||
) {
|
||||
if (other is! AppThemeIcons) return this;
|
||||
return t < 0.5 ? this : other;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export 'presentation/pages/account_page/account_page.dart';
|
||||
@@ -1,21 +0,0 @@
|
||||
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", "Русский"];
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
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 {
|
||||
const AccountPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WAccountBody();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
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:5),
|
||||
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,
|
||||
),
|
||||
),
|
||||
).paddingAll(8),
|
||||
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.size20Medium,
|
||||
),
|
||||
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.size14Medium,
|
||||
);
|
||||
}),
|
||||
),
|
||||
10.verticalSpace
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
import 'package:food_delivery_client/core/services/request_handler_service.dart';
|
||||
import 'package:food_delivery_client/feature/auth/data/models/response/login_response.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/register_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/reset_password_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_otp_code_login_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_phone_login_usecase.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
abstract class AuthDatasource {
|
||||
Future<LoginResponseModel> login({
|
||||
required String phoneNumber,
|
||||
required String password,
|
||||
});
|
||||
|
||||
Future<SuccessModel> verifyPhoneResetPassword({
|
||||
required VerifyPhoneNumberParams params,
|
||||
});
|
||||
|
||||
Future<SuccessModel> verifyOtpCodeResetPassword({
|
||||
required VerifyOtpCodeParams params,
|
||||
});
|
||||
|
||||
Future<SuccessModel> resetPassword({required ResetPasswordParams params});
|
||||
|
||||
Future<SuccessModel> verifyPhoneRegister({
|
||||
required VerifyPhoneNumberParams params,
|
||||
});
|
||||
|
||||
Future<SuccessModel> verifyOtpCodeRegister({
|
||||
required VerifyOtpCodeParams params,
|
||||
});
|
||||
|
||||
Future<SuccessModel> register({required RegisterParams params});
|
||||
}
|
||||
|
||||
@LazySingleton(as: AuthDatasource)
|
||||
class AuthDatasourceImpl implements AuthDatasource {
|
||||
final RequestHandlerService _requestHandlerService;
|
||||
|
||||
AuthDatasourceImpl(this._requestHandlerService);
|
||||
|
||||
@override
|
||||
Future<LoginResponseModel> login({
|
||||
required String phoneNumber,
|
||||
required String password,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequest(
|
||||
path: ApiConst.login,
|
||||
method: RequestMethodEnum.post,
|
||||
data: {"password": password, "phoneNumber": phoneNumber},
|
||||
fromJson: (response) async => LoginResponseModel.fromJson(response.data),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<SuccessModel> register({required RegisterParams params}) async {
|
||||
return _requestHandlerService.handleRequest(
|
||||
path: ApiConst.register,
|
||||
method: RequestMethodEnum.post,
|
||||
|
||||
data: {
|
||||
"firstName": params.firstName,
|
||||
"lastName": params.lastName,
|
||||
"password": params.password,
|
||||
"phoneNumber": params.phoneNumber,
|
||||
},
|
||||
|
||||
fromJson: (response) async {
|
||||
return SuccessModel.fromJson(response.data);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<SuccessModel> resetPassword({
|
||||
required ResetPasswordParams params,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequest(
|
||||
path: ApiConst.resetPassword,
|
||||
method: RequestMethodEnum.post,
|
||||
data: {
|
||||
"newPassword": params.newPassword,
|
||||
"phoneNumber": params.phoneNumber,
|
||||
},
|
||||
|
||||
fromJson: (response) async => SuccessModel.fromJson(response.data),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<SuccessModel> verifyOtpCodeRegister({
|
||||
required VerifyOtpCodeParams params,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequest(
|
||||
path: ApiConst.verifyCode,
|
||||
method: RequestMethodEnum.post,
|
||||
data: {"code": params.otpCode, "phoneNumber": params.phoneNumber},
|
||||
fromJson: (response) async => SuccessModel.fromJson(response.data),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<SuccessModel> verifyOtpCodeResetPassword({
|
||||
required VerifyOtpCodeParams params,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequest(
|
||||
path: ApiConst.forgotPassword,
|
||||
method: RequestMethodEnum.post,
|
||||
data: {"code": params.otpCode, "phoneNumber": params.phoneNumber},
|
||||
fromJson: (response) async => SuccessModel.fromJson(response.data),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<SuccessModel> verifyPhoneRegister({
|
||||
required VerifyPhoneNumberParams params,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequest(
|
||||
path: ApiConst.verifyPhone,
|
||||
method: RequestMethodEnum.post,
|
||||
|
||||
data: {"phoneNumber": params.phoneNumber},
|
||||
fromJson: (response) async => SuccessModel.fromJson(response.data),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<SuccessModel> verifyPhoneResetPassword({
|
||||
required VerifyPhoneNumberParams params,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequest(
|
||||
path: ApiConst.sendCode,
|
||||
method: RequestMethodEnum.post,
|
||||
data: {"phoneNumber": params.phoneNumber},
|
||||
fromJson: (response) async => SuccessModel.fromJson(response.data),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class LoginResponseModel extends Equatable {
|
||||
final String token;
|
||||
|
||||
const LoginResponseModel({required this.token});
|
||||
|
||||
factory LoginResponseModel.fromJson(Map<String, dynamic> json) {
|
||||
return LoginResponseModel(
|
||||
token: json['token'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'token': token,
|
||||
};
|
||||
|
||||
LoginResponseModel copyWith({String? token}) {
|
||||
return LoginResponseModel(
|
||||
token: token ?? this.token,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [token];
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:food_delivery_client/core/services/request_handler_service.dart';
|
||||
import 'package:food_delivery_client/feature/auth/data/datasource/auth_datasource.dart';
|
||||
import 'package:food_delivery_client/feature/auth/data/models/response/login_response.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
import '../../domain/repository/auth_repository.dart';
|
||||
import '../../domain/usecases/register_usecase.dart';
|
||||
import '../../domain/usecases/reset_password_usecase.dart';
|
||||
import '../../domain/usecases/verify_otp_code_login_usecase.dart';
|
||||
import '../../domain/usecases/verify_phone_login_usecase.dart';
|
||||
|
||||
|
||||
@LazySingleton(as: AuthRepository)
|
||||
class AuthRepositoryImpl implements AuthRepository {
|
||||
final RequestHandlerService _requestHandlerService;
|
||||
final AuthDatasource _authDatasource;
|
||||
|
||||
AuthRepositoryImpl(this._requestHandlerService, this._authDatasource);
|
||||
|
||||
@override
|
||||
Future<Either<Failure, LoginResponseModel>> login({
|
||||
required String phoneNumber,
|
||||
required String password,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequestInRepository(
|
||||
onRequest: () async {
|
||||
return _authDatasource.login(
|
||||
phoneNumber: phoneNumber,
|
||||
password: password,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> register({
|
||||
required RegisterParams params,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequestInRepository(
|
||||
onRequest: () async => _authDatasource.register(params: params),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> resetPassword({
|
||||
required ResetPasswordParams params,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequestInRepository(
|
||||
onRequest: () => _authDatasource.resetPassword(params: params),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> verifyOtpCodeRegister({
|
||||
required VerifyOtpCodeParams params,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequestInRepository(
|
||||
onRequest: () => _authDatasource.verifyOtpCodeRegister(params: params),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> verifyOtpCodeResetPassword({
|
||||
required VerifyOtpCodeParams params,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequestInRepository(
|
||||
onRequest: () =>
|
||||
_authDatasource.verifyOtpCodeResetPassword(params: params),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> verifyPhoneRegister({
|
||||
required VerifyPhoneNumberParams params,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequestInRepository(
|
||||
onRequest: () => _authDatasource.verifyPhoneRegister(params: params),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> verifyPhoneResetPassword({
|
||||
required VerifyPhoneNumberParams params,
|
||||
}) async {
|
||||
return _requestHandlerService.handleRequestInRepository(
|
||||
onRequest: () => _authDatasource.verifyPhoneResetPassword(params: params),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:food_delivery_client/core/services/request_handler_service.dart';
|
||||
import 'package:food_delivery_client/feature/auth/data/datasource/auth_datasource.dart';
|
||||
import 'package:food_delivery_client/feature/auth/data/models/response/login_response.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
import '../usecases/register_usecase.dart';
|
||||
import '../usecases/reset_password_usecase.dart';
|
||||
import '../usecases/verify_otp_code_login_usecase.dart';
|
||||
import '../usecases/verify_phone_login_usecase.dart';
|
||||
|
||||
abstract class AuthRepository {
|
||||
Future<Either<Failure, LoginResponseModel>> login({
|
||||
required String phoneNumber,
|
||||
required String password,
|
||||
});
|
||||
|
||||
Future<Either<Failure, SuccessModel>> verifyPhoneResetPassword({
|
||||
required VerifyPhoneNumberParams params,
|
||||
});
|
||||
|
||||
Future<Either<Failure, SuccessModel>> verifyOtpCodeResetPassword({
|
||||
required VerifyOtpCodeParams params,
|
||||
});
|
||||
|
||||
Future<Either<Failure, SuccessModel>> resetPassword({
|
||||
required ResetPasswordParams params,
|
||||
});
|
||||
|
||||
Future<Either<Failure, SuccessModel>> verifyPhoneRegister({
|
||||
required VerifyPhoneNumberParams params,
|
||||
});
|
||||
|
||||
Future<Either<Failure, SuccessModel>> verifyOtpCodeRegister({
|
||||
required VerifyOtpCodeParams params,
|
||||
});
|
||||
|
||||
Future<Either<Failure, SuccessModel>> register({
|
||||
required RegisterParams params,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:food_delivery_client/core/usecase/usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/data/models/response/login_response.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/repository/auth_repository.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
@injectable
|
||||
class LoginUseCase implements UseCase<LoginResponseModel, LoginParams> {
|
||||
final AuthRepository _authRepository;
|
||||
|
||||
LoginUseCase(this._authRepository);
|
||||
|
||||
@override
|
||||
Future<Either<Failure, LoginResponseModel>> call(LoginParams params) async {
|
||||
return _authRepository.login(
|
||||
phoneNumber: params.phoneNumber,
|
||||
password: params.password,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class LoginParams {
|
||||
final String phoneNumber;
|
||||
final String password;
|
||||
|
||||
LoginParams({required this.phoneNumber, required this.password});
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:food_delivery_client/core/exceptions/failure.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/repository/auth_repository.dart';
|
||||
import 'package:food_delivery_client/feature/common/common.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
import '../../../../core/usecase/usecase.dart';
|
||||
@injectable
|
||||
class RegisterUseCase implements UseCase<SuccessModel, RegisterParams> {
|
||||
final AuthRepository _authRepository;
|
||||
|
||||
RegisterUseCase(this._authRepository);
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> call(RegisterParams params) async {
|
||||
return _authRepository.register(params: params);
|
||||
}
|
||||
}
|
||||
|
||||
class RegisterParams {
|
||||
final String firstName;
|
||||
final String lastName;
|
||||
final String phoneNumber;
|
||||
final String password;
|
||||
|
||||
RegisterParams({
|
||||
required this.firstName,
|
||||
required this.lastName,
|
||||
required this.phoneNumber,
|
||||
required this.password,
|
||||
});
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:food_delivery_client/core/exceptions/failure.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/repository/auth_repository.dart';
|
||||
import 'package:food_delivery_client/feature/common/common.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
import '../../../../core/usecase/usecase.dart';
|
||||
@injectable
|
||||
class ResetPasswordUseCase
|
||||
implements UseCase<SuccessModel, ResetPasswordParams> {
|
||||
final AuthRepository _authRepository;
|
||||
|
||||
ResetPasswordUseCase(this._authRepository);
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> call(ResetPasswordParams params) async {
|
||||
return _authRepository.resetPassword(params: params);
|
||||
}
|
||||
}
|
||||
|
||||
class ResetPasswordParams {
|
||||
final String newPassword;
|
||||
final String phoneNumber;
|
||||
|
||||
ResetPasswordParams({required this.newPassword, required this.phoneNumber});
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
|
||||
import 'package:food_delivery_client/feature/auth/domain/repository/auth_repository.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
import '../../../../core/usecase/usecase.dart';
|
||||
|
||||
@injectable
|
||||
class VerifyOtpCodeForgotPasswordUseCase
|
||||
implements UseCase<SuccessModel, VerifyOtpCodeParams> {
|
||||
final AuthRepository _authRepository;
|
||||
|
||||
VerifyOtpCodeForgotPasswordUseCase(this._authRepository);
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> call(VerifyOtpCodeParams params) async {
|
||||
return _authRepository.verifyOtpCodeResetPassword(params: params);
|
||||
}
|
||||
}
|
||||
|
||||
class VerifyOtpCodeParams {
|
||||
final dynamic otpCode;
|
||||
final String phoneNumber;
|
||||
|
||||
VerifyOtpCodeParams({required this.otpCode, required this.phoneNumber});
|
||||
}
|
||||
|
||||
class OtpCodePageParams {
|
||||
final String phoneNumber;
|
||||
final bool isRegister;
|
||||
|
||||
OtpCodePageParams({required this.phoneNumber, required this.isRegister});
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/repository/auth_repository.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_otp_code_login_usecase.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
import '../../../../core/usecase/usecase.dart';
|
||||
|
||||
@injectable
|
||||
class VerifyOtpCodeRegisterUseCase
|
||||
implements UseCase<SuccessModel, VerifyOtpCodeParams> {
|
||||
final AuthRepository _authRepository;
|
||||
|
||||
VerifyOtpCodeRegisterUseCase(this._authRepository);
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> call(VerifyOtpCodeParams params) async {
|
||||
return _authRepository.verifyOtpCodeRegister(params: params);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:food_delivery_client/core/exceptions/failure.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/repository/auth_repository.dart';
|
||||
import 'package:food_delivery_client/feature/common/common.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
import '../../../../core/usecase/usecase.dart';
|
||||
@injectable
|
||||
class VerifyPhoneNumberLoginUseCase
|
||||
implements UseCase<SuccessModel, VerifyPhoneNumberParams> {
|
||||
final AuthRepository _authRepository;
|
||||
|
||||
VerifyPhoneNumberLoginUseCase(this._authRepository);
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> call(
|
||||
VerifyPhoneNumberParams params,
|
||||
) async {
|
||||
return _authRepository.verifyPhoneResetPassword(params: params);
|
||||
}
|
||||
}
|
||||
|
||||
class VerifyPhoneNumberParams {
|
||||
final String phoneNumber;
|
||||
|
||||
VerifyPhoneNumberParams({required this.phoneNumber});
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/repository/auth_repository.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_phone_login_usecase.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
import '../../../../core/usecase/usecase.dart';
|
||||
|
||||
@injectable
|
||||
class VerifyPhoneRegisterUseCase
|
||||
implements UseCase<SuccessModel, VerifyPhoneNumberParams> {
|
||||
final AuthRepository _authRepository;
|
||||
|
||||
VerifyPhoneRegisterUseCase(this._authRepository);
|
||||
|
||||
@override
|
||||
Future<Either<Failure, SuccessModel>> call(
|
||||
VerifyPhoneNumberParams params,
|
||||
) async {
|
||||
return _authRepository.verifyPhoneRegister(params: params);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/login_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/common/presentation/widgets/w_toastification.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
part 'login_event.dart';
|
||||
|
||||
part 'login_state.dart';
|
||||
|
||||
part 'login_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class LoginBloc extends Bloc<LoginEvent, LoginState> {
|
||||
final LoginUseCase _loginUseCase;
|
||||
final StorageService _storageService;
|
||||
|
||||
LoginBloc(this._loginUseCase, this._storageService)
|
||||
: super(const LoginState()) {
|
||||
on<_Login>(_onLogin);
|
||||
}
|
||||
|
||||
Future<void> _onLogin(_Login event, Emitter<LoginState> emit) async {
|
||||
emit(state.copyWith(status: RequestStatus.loading));
|
||||
|
||||
final response = await _loginUseCase.call(event.params);
|
||||
|
||||
response.fold(
|
||||
(l) {
|
||||
log("${l.errorMessage}");
|
||||
showErrorToast(l.errorMessage);
|
||||
emit(state.copyWith(status: RequestStatus.error));
|
||||
},
|
||||
(r) {
|
||||
showSuccessToast("Login success");
|
||||
_storageService.setString(key: AppLocaleKeys.token, value: r.token);
|
||||
final token = _storageService.getString(key: AppLocaleKeys.token);
|
||||
log('Token:$token');
|
||||
emit(state.copyWith(status: RequestStatus.loaded));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,535 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'login_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$LoginEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LoginEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $LoginEventCopyWith<$Res> {
|
||||
$LoginEventCopyWith(LoginEvent _, $Res Function(LoginEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [LoginEvent].
|
||||
extension LoginEventPatterns on LoginEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Checked value)? checked,TResult Function( _Login value)? login,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Checked() when checked != null:
|
||||
return checked(_that);case _Login() when login != null:
|
||||
return login(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Checked value) checked,required TResult Function( _Login value) login,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Checked():
|
||||
return checked(_that);case _Login():
|
||||
return login(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Checked value)? checked,TResult? Function( _Login value)? login,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Checked() when checked != null:
|
||||
return checked(_that);case _Login() when login != null:
|
||||
return login(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? checked,TResult Function( LoginParams params)? login,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Checked() when checked != null:
|
||||
return checked();case _Login() when login != null:
|
||||
return login(_that.params);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() checked,required TResult Function( LoginParams params) login,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Checked():
|
||||
return checked();case _Login():
|
||||
return login(_that.params);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? checked,TResult? Function( LoginParams params)? login,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Checked() when checked != null:
|
||||
return checked();case _Login() when login != null:
|
||||
return login(_that.params);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Checked implements LoginEvent {
|
||||
const _Checked();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Checked);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginEvent.checked()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Login implements LoginEvent {
|
||||
const _Login(this.params);
|
||||
|
||||
|
||||
final LoginParams params;
|
||||
|
||||
/// Create a copy of LoginEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LoginCopyWith<_Login> get copyWith => __$LoginCopyWithImpl<_Login>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Login&&(identical(other.params, params) || other.params == params));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,params);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginEvent.login(params: $params)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LoginCopyWith<$Res> implements $LoginEventCopyWith<$Res> {
|
||||
factory _$LoginCopyWith(_Login value, $Res Function(_Login) _then) = __$LoginCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
LoginParams params
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$LoginCopyWithImpl<$Res>
|
||||
implements _$LoginCopyWith<$Res> {
|
||||
__$LoginCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Login _self;
|
||||
final $Res Function(_Login) _then;
|
||||
|
||||
/// Create a copy of LoginEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? params = null,}) {
|
||||
return _then(_Login(
|
||||
null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable
|
||||
as LoginParams,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LoginState {
|
||||
|
||||
RequestStatus get status;
|
||||
/// Create a copy of LoginState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$LoginStateCopyWith<LoginState> get copyWith => _$LoginStateCopyWithImpl<LoginState>(this as LoginState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LoginState&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginState(status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $LoginStateCopyWith<$Res> {
|
||||
factory $LoginStateCopyWith(LoginState value, $Res Function(LoginState) _then) = _$LoginStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
RequestStatus status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$LoginStateCopyWithImpl<$Res>
|
||||
implements $LoginStateCopyWith<$Res> {
|
||||
_$LoginStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final LoginState _self;
|
||||
final $Res Function(LoginState) _then;
|
||||
|
||||
/// Create a copy of LoginState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? status = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [LoginState].
|
||||
extension LoginStatePatterns on LoginState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _LoginState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LoginState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _LoginState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LoginState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _LoginState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LoginState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( RequestStatus status)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LoginState() when $default != null:
|
||||
return $default(_that.status);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( RequestStatus status) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LoginState():
|
||||
return $default(_that.status);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( RequestStatus status)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LoginState() when $default != null:
|
||||
return $default(_that.status);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _LoginState implements LoginState {
|
||||
const _LoginState({this.status = RequestStatus.initial});
|
||||
|
||||
|
||||
@override@JsonKey() final RequestStatus status;
|
||||
|
||||
/// Create a copy of LoginState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LoginStateCopyWith<_LoginState> get copyWith => __$LoginStateCopyWithImpl<_LoginState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LoginState&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginState(status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LoginStateCopyWith<$Res> implements $LoginStateCopyWith<$Res> {
|
||||
factory _$LoginStateCopyWith(_LoginState value, $Res Function(_LoginState) _then) = __$LoginStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
RequestStatus status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$LoginStateCopyWithImpl<$Res>
|
||||
implements _$LoginStateCopyWith<$Res> {
|
||||
__$LoginStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _LoginState _self;
|
||||
final $Res Function(_LoginState) _then;
|
||||
|
||||
/// Create a copy of LoginState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? status = null,}) {
|
||||
return _then(_LoginState(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,8 +0,0 @@
|
||||
part of 'login_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class LoginEvent with _$LoginEvent {
|
||||
const factory LoginEvent.checked() = _Checked;
|
||||
|
||||
const factory LoginEvent.login(LoginParams params) = _Login;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
part of 'login_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class LoginState with _$LoginState {
|
||||
const factory LoginState({
|
||||
@Default(RequestStatus.initial) RequestStatus status,
|
||||
}) = _LoginState;
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/register_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/common/presentation/widgets/w_toastification.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
part 'register_event.dart';
|
||||
|
||||
part 'register_state.dart';
|
||||
|
||||
part 'register_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class RegisterBloc extends Bloc<RegisterEvent, RegisterState> {
|
||||
final RegisterUseCase _registerUseCase;
|
||||
|
||||
RegisterBloc(this._registerUseCase) : super(const RegisterState()) {
|
||||
on<_Loaded>(_onLoaded);
|
||||
}
|
||||
|
||||
Future<void> _onLoaded(_Loaded event, Emitter<RegisterState> emit) async {
|
||||
emit(state.copyWith(status: RequestStatus.loading));
|
||||
|
||||
final response = await _registerUseCase.call(event.params);
|
||||
|
||||
response.fold(
|
||||
(l) {
|
||||
showErrorToast(l.errorMessage);
|
||||
emit(state.copyWith(status: RequestStatus.error));
|
||||
},
|
||||
(r) {
|
||||
showSuccessToast(r.message);
|
||||
emit(state.copyWith(status: RequestStatus.loaded));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,535 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'register_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$RegisterEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is RegisterEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RegisterEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $RegisterEventCopyWith<$Res> {
|
||||
$RegisterEventCopyWith(RegisterEvent _, $Res Function(RegisterEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [RegisterEvent].
|
||||
extension RegisterEventPatterns on RegisterEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,TResult Function( _Loaded value)? loaded,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Loaded() when loaded != null:
|
||||
return loaded(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,required TResult Function( _Loaded value) loaded,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _Loaded():
|
||||
return loaded(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,TResult? Function( _Loaded value)? loaded,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Loaded() when loaded != null:
|
||||
return loaded(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,TResult Function( RegisterParams params)? loaded,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Loaded() when loaded != null:
|
||||
return loaded(_that.params);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,required TResult Function( RegisterParams params) loaded,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _Loaded():
|
||||
return loaded(_that.params);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,TResult? Function( RegisterParams params)? loaded,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Loaded() when loaded != null:
|
||||
return loaded(_that.params);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements RegisterEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RegisterEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Loaded implements RegisterEvent {
|
||||
const _Loaded(this.params);
|
||||
|
||||
|
||||
final RegisterParams params;
|
||||
|
||||
/// Create a copy of RegisterEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LoadedCopyWith<_Loaded> get copyWith => __$LoadedCopyWithImpl<_Loaded>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loaded&&(identical(other.params, params) || other.params == params));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,params);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RegisterEvent.loaded(params: $params)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LoadedCopyWith<$Res> implements $RegisterEventCopyWith<$Res> {
|
||||
factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
RegisterParams params
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$LoadedCopyWithImpl<$Res>
|
||||
implements _$LoadedCopyWith<$Res> {
|
||||
__$LoadedCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Loaded _self;
|
||||
final $Res Function(_Loaded) _then;
|
||||
|
||||
/// Create a copy of RegisterEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? params = null,}) {
|
||||
return _then(_Loaded(
|
||||
null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable
|
||||
as RegisterParams,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$RegisterState {
|
||||
|
||||
RequestStatus get status;
|
||||
/// Create a copy of RegisterState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$RegisterStateCopyWith<RegisterState> get copyWith => _$RegisterStateCopyWithImpl<RegisterState>(this as RegisterState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is RegisterState&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RegisterState(status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $RegisterStateCopyWith<$Res> {
|
||||
factory $RegisterStateCopyWith(RegisterState value, $Res Function(RegisterState) _then) = _$RegisterStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
RequestStatus status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$RegisterStateCopyWithImpl<$Res>
|
||||
implements $RegisterStateCopyWith<$Res> {
|
||||
_$RegisterStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final RegisterState _self;
|
||||
final $Res Function(RegisterState) _then;
|
||||
|
||||
/// Create a copy of RegisterState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? status = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [RegisterState].
|
||||
extension RegisterStatePatterns on RegisterState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _RegisterState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RegisterState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _RegisterState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RegisterState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _RegisterState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RegisterState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( RequestStatus status)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RegisterState() when $default != null:
|
||||
return $default(_that.status);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( RequestStatus status) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RegisterState():
|
||||
return $default(_that.status);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( RequestStatus status)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RegisterState() when $default != null:
|
||||
return $default(_that.status);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _RegisterState implements RegisterState {
|
||||
const _RegisterState({this.status = RequestStatus.initial});
|
||||
|
||||
|
||||
@override@JsonKey() final RequestStatus status;
|
||||
|
||||
/// Create a copy of RegisterState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$RegisterStateCopyWith<_RegisterState> get copyWith => __$RegisterStateCopyWithImpl<_RegisterState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _RegisterState&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RegisterState(status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$RegisterStateCopyWith<$Res> implements $RegisterStateCopyWith<$Res> {
|
||||
factory _$RegisterStateCopyWith(_RegisterState value, $Res Function(_RegisterState) _then) = __$RegisterStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
RequestStatus status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$RegisterStateCopyWithImpl<$Res>
|
||||
implements _$RegisterStateCopyWith<$Res> {
|
||||
__$RegisterStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _RegisterState _self;
|
||||
final $Res Function(_RegisterState) _then;
|
||||
|
||||
/// Create a copy of RegisterState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? status = null,}) {
|
||||
return _then(_RegisterState(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,8 +0,0 @@
|
||||
part of 'register_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class RegisterEvent with _$RegisterEvent {
|
||||
const factory RegisterEvent.started() = _Started;
|
||||
const factory RegisterEvent.loaded(RegisterParams params) = _Loaded;
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
part of 'register_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class RegisterState with _$RegisterState {
|
||||
const factory RegisterState({
|
||||
@Default(RequestStatus.initial) RequestStatus status,
|
||||
}) = _RegisterState;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/reset_password_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/common/presentation/widgets/w_toastification.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
part 'reset_password_event.dart';
|
||||
|
||||
part 'reset_password_state.dart';
|
||||
|
||||
part 'reset_password_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class ResetPasswordBloc extends Bloc<ResetPasswordEvent, ResetPasswordState> {
|
||||
final ResetPasswordUseCase _passwordUseCase;
|
||||
|
||||
ResetPasswordBloc(this._passwordUseCase) : super(const ResetPasswordState()) {
|
||||
on<_Loaded>(_onLoaded);
|
||||
}
|
||||
|
||||
Future<void> _onLoaded(
|
||||
_Loaded event,
|
||||
Emitter<ResetPasswordState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(status: RequestStatus.loading));
|
||||
final response = await _passwordUseCase.call(event.params);
|
||||
response.fold(
|
||||
(l) {
|
||||
showErrorToast(l.errorMessage);
|
||||
emit(state.copyWith(status: RequestStatus.error));
|
||||
},
|
||||
(r) {
|
||||
showSuccessToast(r.message);
|
||||
emit(state.copyWith(status: RequestStatus.loaded));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,535 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'reset_password_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$ResetPasswordEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ResetPasswordEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ResetPasswordEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $ResetPasswordEventCopyWith<$Res> {
|
||||
$ResetPasswordEventCopyWith(ResetPasswordEvent _, $Res Function(ResetPasswordEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [ResetPasswordEvent].
|
||||
extension ResetPasswordEventPatterns on ResetPasswordEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,TResult Function( _Loaded value)? loaded,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Loaded() when loaded != null:
|
||||
return loaded(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,required TResult Function( _Loaded value) loaded,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _Loaded():
|
||||
return loaded(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,TResult? Function( _Loaded value)? loaded,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Loaded() when loaded != null:
|
||||
return loaded(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,TResult Function( ResetPasswordParams params)? loaded,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Loaded() when loaded != null:
|
||||
return loaded(_that.params);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,required TResult Function( ResetPasswordParams params) loaded,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _Loaded():
|
||||
return loaded(_that.params);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,TResult? Function( ResetPasswordParams params)? loaded,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Loaded() when loaded != null:
|
||||
return loaded(_that.params);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements ResetPasswordEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ResetPasswordEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Loaded implements ResetPasswordEvent {
|
||||
const _Loaded(this.params);
|
||||
|
||||
|
||||
final ResetPasswordParams params;
|
||||
|
||||
/// Create a copy of ResetPasswordEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LoadedCopyWith<_Loaded> get copyWith => __$LoadedCopyWithImpl<_Loaded>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loaded&&(identical(other.params, params) || other.params == params));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,params);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ResetPasswordEvent.loaded(params: $params)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LoadedCopyWith<$Res> implements $ResetPasswordEventCopyWith<$Res> {
|
||||
factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
ResetPasswordParams params
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$LoadedCopyWithImpl<$Res>
|
||||
implements _$LoadedCopyWith<$Res> {
|
||||
__$LoadedCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Loaded _self;
|
||||
final $Res Function(_Loaded) _then;
|
||||
|
||||
/// Create a copy of ResetPasswordEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? params = null,}) {
|
||||
return _then(_Loaded(
|
||||
null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable
|
||||
as ResetPasswordParams,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ResetPasswordState {
|
||||
|
||||
RequestStatus get status;
|
||||
/// Create a copy of ResetPasswordState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$ResetPasswordStateCopyWith<ResetPasswordState> get copyWith => _$ResetPasswordStateCopyWithImpl<ResetPasswordState>(this as ResetPasswordState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ResetPasswordState&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ResetPasswordState(status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $ResetPasswordStateCopyWith<$Res> {
|
||||
factory $ResetPasswordStateCopyWith(ResetPasswordState value, $Res Function(ResetPasswordState) _then) = _$ResetPasswordStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
RequestStatus status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ResetPasswordStateCopyWithImpl<$Res>
|
||||
implements $ResetPasswordStateCopyWith<$Res> {
|
||||
_$ResetPasswordStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final ResetPasswordState _self;
|
||||
final $Res Function(ResetPasswordState) _then;
|
||||
|
||||
/// Create a copy of ResetPasswordState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? status = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [ResetPasswordState].
|
||||
extension ResetPasswordStatePatterns on ResetPasswordState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ResetPasswordState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ResetPasswordState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ResetPasswordState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ResetPasswordState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ResetPasswordState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _ResetPasswordState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( RequestStatus status)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ResetPasswordState() when $default != null:
|
||||
return $default(_that.status);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( RequestStatus status) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ResetPasswordState():
|
||||
return $default(_that.status);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( RequestStatus status)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ResetPasswordState() when $default != null:
|
||||
return $default(_that.status);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _ResetPasswordState implements ResetPasswordState {
|
||||
const _ResetPasswordState({this.status = RequestStatus.initial});
|
||||
|
||||
|
||||
@override@JsonKey() final RequestStatus status;
|
||||
|
||||
/// Create a copy of ResetPasswordState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ResetPasswordStateCopyWith<_ResetPasswordState> get copyWith => __$ResetPasswordStateCopyWithImpl<_ResetPasswordState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ResetPasswordState&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ResetPasswordState(status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ResetPasswordStateCopyWith<$Res> implements $ResetPasswordStateCopyWith<$Res> {
|
||||
factory _$ResetPasswordStateCopyWith(_ResetPasswordState value, $Res Function(_ResetPasswordState) _then) = __$ResetPasswordStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
RequestStatus status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ResetPasswordStateCopyWithImpl<$Res>
|
||||
implements _$ResetPasswordStateCopyWith<$Res> {
|
||||
__$ResetPasswordStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ResetPasswordState _self;
|
||||
final $Res Function(_ResetPasswordState) _then;
|
||||
|
||||
/// Create a copy of ResetPasswordState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? status = null,}) {
|
||||
return _then(_ResetPasswordState(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,8 +0,0 @@
|
||||
part of 'reset_password_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class ResetPasswordEvent with _$ResetPasswordEvent {
|
||||
const factory ResetPasswordEvent.started() = _Started;
|
||||
|
||||
const factory ResetPasswordEvent.loaded(ResetPasswordParams params) = _Loaded;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
part of 'reset_password_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class ResetPasswordState with _$ResetPasswordState {
|
||||
const factory ResetPasswordState({
|
||||
@Default(RequestStatus.initial) RequestStatus status,
|
||||
}) = _ResetPasswordState;
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_otp_code_login_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_otp_code_register_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_phone_login_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_phone_register_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/common/presentation/widgets/w_toastification.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
part 'verify_otp_event.dart';
|
||||
|
||||
part 'verify_otp_state.dart';
|
||||
|
||||
part 'verify_otp_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class VerifyOtpBloc extends Bloc<VerifyOtpEvent, VerifyOtpState> {
|
||||
final VerifyOtpCodeRegisterUseCase _registerUseCase;
|
||||
final VerifyOtpCodeForgotPasswordUseCase _passwordUseCase;
|
||||
final VerifyPhoneRegisterUseCase _phoneRegisterUseCase;
|
||||
final VerifyPhoneNumberLoginUseCase _phoneNumberLoginUseCase;
|
||||
|
||||
VerifyOtpBloc(
|
||||
this._registerUseCase,
|
||||
this._passwordUseCase,
|
||||
this._phoneRegisterUseCase,
|
||||
this._phoneNumberLoginUseCase,
|
||||
) : super(const VerifyOtpState()) {
|
||||
Timer? timer1;
|
||||
|
||||
on<_CancelTimer>((event, emit) {
|
||||
timer1?.cancel();
|
||||
});
|
||||
|
||||
on<_Started>((event, emit) {
|
||||
int seconds = state.time;
|
||||
emit(state.copyWith(time: seconds));
|
||||
timer1 = Timer.periodic(TimeDelayConst.duration1, (timer) {
|
||||
if (seconds == 0) {
|
||||
timer.cancel();
|
||||
} else {
|
||||
seconds--;
|
||||
add(VerifyOtpEvent.ticked(seconds));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
on<_Ticked>(_onTicked);
|
||||
on<_VerifyOtpReset>(_onVerifyOtpReset);
|
||||
on<_VerifyOtpRegister>(_onVerifyOtpRegister);
|
||||
on<_ResendRegister>(_onResendVerifyPhoneRegister);
|
||||
on<_ResendForgot>(_onResendVerifyPhoneForgot);
|
||||
}
|
||||
|
||||
void _onTicked(_Ticked event, Emitter<VerifyOtpState> emit) {
|
||||
emit(state.copyWith(time: event.seconds));
|
||||
}
|
||||
|
||||
Future<void> _onVerifyOtpReset(
|
||||
_VerifyOtpReset event,
|
||||
Emitter<VerifyOtpState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(status: RequestStatus.loading));
|
||||
final response = await _passwordUseCase.call(event.params);
|
||||
|
||||
response.fold(
|
||||
(l) {
|
||||
showErrorToast(l.errorMessage);
|
||||
emit(state.copyWith(status: RequestStatus.error));
|
||||
},
|
||||
(r) {
|
||||
showSuccessToast(r.message);
|
||||
emit(state.copyWith(status: RequestStatus.loaded));
|
||||
add(VerifyOtpEvent.cancelTimer());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _onVerifyOtpRegister(
|
||||
_VerifyOtpRegister event,
|
||||
Emitter<VerifyOtpState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(status: RequestStatus.loading));
|
||||
final response = await _registerUseCase.call(event.params);
|
||||
|
||||
response.fold(
|
||||
(l) {
|
||||
showErrorToast(l.errorMessage);
|
||||
emit(state.copyWith(status: RequestStatus.error));
|
||||
},
|
||||
(r) {
|
||||
showSuccessToast(r.message);
|
||||
emit(state.copyWith(status: RequestStatus.loaded));
|
||||
add(VerifyOtpEvent.cancelTimer());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _onResendVerifyPhoneRegister(
|
||||
_ResendRegister event,
|
||||
Emitter<VerifyOtpState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(resendStatus: RequestStatus.loading));
|
||||
final response = await _phoneRegisterUseCase.call(
|
||||
VerifyPhoneNumberParams(phoneNumber: event.phoneNUmber),
|
||||
);
|
||||
|
||||
response.fold(
|
||||
(l) {
|
||||
showErrorToast(l.errorMessage);
|
||||
emit(state.copyWith(resendStatus: RequestStatus.error));
|
||||
},
|
||||
(r) {
|
||||
emit(state.copyWith(resendStatus: RequestStatus.loaded));
|
||||
add(VerifyOtpEvent.ticked(120));
|
||||
add(VerifyOtpEvent.started());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _onResendVerifyPhoneForgot(
|
||||
_ResendForgot event,
|
||||
Emitter<VerifyOtpState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(resendStatus: RequestStatus.loading));
|
||||
final response = await _phoneNumberLoginUseCase.call(
|
||||
VerifyPhoneNumberParams(phoneNumber: event.phoneNUmber),
|
||||
);
|
||||
|
||||
response.fold(
|
||||
(l) {
|
||||
showErrorToast(l.errorMessage);
|
||||
emit(state.copyWith(resendStatus: RequestStatus.error));
|
||||
},
|
||||
(r) {
|
||||
emit(state.copyWith(resendStatus: RequestStatus.loaded));
|
||||
add(VerifyOtpEvent.ticked(120));
|
||||
add(VerifyOtpEvent.started());
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,867 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'verify_otp_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$VerifyOtpEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is VerifyOtpEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyOtpEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $VerifyOtpEventCopyWith<$Res> {
|
||||
$VerifyOtpEventCopyWith(VerifyOtpEvent _, $Res Function(VerifyOtpEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [VerifyOtpEvent].
|
||||
extension VerifyOtpEventPatterns on VerifyOtpEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,TResult Function( _CancelTimer value)? cancelTimer,TResult Function( _ResendRegister value)? resendRegister,TResult Function( _ResendForgot value)? resendForgot,TResult Function( _Ticked value)? ticked,TResult Function( _VerifyOtpReset value)? verifyOtpReset,TResult Function( _VerifyOtpRegister value)? verifyOtpRegister,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _CancelTimer() when cancelTimer != null:
|
||||
return cancelTimer(_that);case _ResendRegister() when resendRegister != null:
|
||||
return resendRegister(_that);case _ResendForgot() when resendForgot != null:
|
||||
return resendForgot(_that);case _Ticked() when ticked != null:
|
||||
return ticked(_that);case _VerifyOtpReset() when verifyOtpReset != null:
|
||||
return verifyOtpReset(_that);case _VerifyOtpRegister() when verifyOtpRegister != null:
|
||||
return verifyOtpRegister(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,required TResult Function( _CancelTimer value) cancelTimer,required TResult Function( _ResendRegister value) resendRegister,required TResult Function( _ResendForgot value) resendForgot,required TResult Function( _Ticked value) ticked,required TResult Function( _VerifyOtpReset value) verifyOtpReset,required TResult Function( _VerifyOtpRegister value) verifyOtpRegister,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _CancelTimer():
|
||||
return cancelTimer(_that);case _ResendRegister():
|
||||
return resendRegister(_that);case _ResendForgot():
|
||||
return resendForgot(_that);case _Ticked():
|
||||
return ticked(_that);case _VerifyOtpReset():
|
||||
return verifyOtpReset(_that);case _VerifyOtpRegister():
|
||||
return verifyOtpRegister(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,TResult? Function( _CancelTimer value)? cancelTimer,TResult? Function( _ResendRegister value)? resendRegister,TResult? Function( _ResendForgot value)? resendForgot,TResult? Function( _Ticked value)? ticked,TResult? Function( _VerifyOtpReset value)? verifyOtpReset,TResult? Function( _VerifyOtpRegister value)? verifyOtpRegister,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _CancelTimer() when cancelTimer != null:
|
||||
return cancelTimer(_that);case _ResendRegister() when resendRegister != null:
|
||||
return resendRegister(_that);case _ResendForgot() when resendForgot != null:
|
||||
return resendForgot(_that);case _Ticked() when ticked != null:
|
||||
return ticked(_that);case _VerifyOtpReset() when verifyOtpReset != null:
|
||||
return verifyOtpReset(_that);case _VerifyOtpRegister() when verifyOtpRegister != null:
|
||||
return verifyOtpRegister(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,TResult Function()? cancelTimer,TResult Function( String phoneNUmber)? resendRegister,TResult Function( String phoneNUmber)? resendForgot,TResult Function( int seconds)? ticked,TResult Function( VerifyOtpCodeParams params)? verifyOtpReset,TResult Function( VerifyOtpCodeParams params)? verifyOtpRegister,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _CancelTimer() when cancelTimer != null:
|
||||
return cancelTimer();case _ResendRegister() when resendRegister != null:
|
||||
return resendRegister(_that.phoneNUmber);case _ResendForgot() when resendForgot != null:
|
||||
return resendForgot(_that.phoneNUmber);case _Ticked() when ticked != null:
|
||||
return ticked(_that.seconds);case _VerifyOtpReset() when verifyOtpReset != null:
|
||||
return verifyOtpReset(_that.params);case _VerifyOtpRegister() when verifyOtpRegister != null:
|
||||
return verifyOtpRegister(_that.params);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,required TResult Function() cancelTimer,required TResult Function( String phoneNUmber) resendRegister,required TResult Function( String phoneNUmber) resendForgot,required TResult Function( int seconds) ticked,required TResult Function( VerifyOtpCodeParams params) verifyOtpReset,required TResult Function( VerifyOtpCodeParams params) verifyOtpRegister,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _CancelTimer():
|
||||
return cancelTimer();case _ResendRegister():
|
||||
return resendRegister(_that.phoneNUmber);case _ResendForgot():
|
||||
return resendForgot(_that.phoneNUmber);case _Ticked():
|
||||
return ticked(_that.seconds);case _VerifyOtpReset():
|
||||
return verifyOtpReset(_that.params);case _VerifyOtpRegister():
|
||||
return verifyOtpRegister(_that.params);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,TResult? Function()? cancelTimer,TResult? Function( String phoneNUmber)? resendRegister,TResult? Function( String phoneNUmber)? resendForgot,TResult? Function( int seconds)? ticked,TResult? Function( VerifyOtpCodeParams params)? verifyOtpReset,TResult? Function( VerifyOtpCodeParams params)? verifyOtpRegister,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _CancelTimer() when cancelTimer != null:
|
||||
return cancelTimer();case _ResendRegister() when resendRegister != null:
|
||||
return resendRegister(_that.phoneNUmber);case _ResendForgot() when resendForgot != null:
|
||||
return resendForgot(_that.phoneNUmber);case _Ticked() when ticked != null:
|
||||
return ticked(_that.seconds);case _VerifyOtpReset() when verifyOtpReset != null:
|
||||
return verifyOtpReset(_that.params);case _VerifyOtpRegister() when verifyOtpRegister != null:
|
||||
return verifyOtpRegister(_that.params);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements VerifyOtpEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyOtpEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _CancelTimer implements VerifyOtpEvent {
|
||||
const _CancelTimer();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CancelTimer);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyOtpEvent.cancelTimer()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _ResendRegister implements VerifyOtpEvent {
|
||||
const _ResendRegister(this.phoneNUmber);
|
||||
|
||||
|
||||
final String phoneNUmber;
|
||||
|
||||
/// Create a copy of VerifyOtpEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ResendRegisterCopyWith<_ResendRegister> get copyWith => __$ResendRegisterCopyWithImpl<_ResendRegister>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ResendRegister&&(identical(other.phoneNUmber, phoneNUmber) || other.phoneNUmber == phoneNUmber));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,phoneNUmber);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyOtpEvent.resendRegister(phoneNUmber: $phoneNUmber)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ResendRegisterCopyWith<$Res> implements $VerifyOtpEventCopyWith<$Res> {
|
||||
factory _$ResendRegisterCopyWith(_ResendRegister value, $Res Function(_ResendRegister) _then) = __$ResendRegisterCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String phoneNUmber
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ResendRegisterCopyWithImpl<$Res>
|
||||
implements _$ResendRegisterCopyWith<$Res> {
|
||||
__$ResendRegisterCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ResendRegister _self;
|
||||
final $Res Function(_ResendRegister) _then;
|
||||
|
||||
/// Create a copy of VerifyOtpEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? phoneNUmber = null,}) {
|
||||
return _then(_ResendRegister(
|
||||
null == phoneNUmber ? _self.phoneNUmber : phoneNUmber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _ResendForgot implements VerifyOtpEvent {
|
||||
const _ResendForgot(this.phoneNUmber);
|
||||
|
||||
|
||||
final String phoneNUmber;
|
||||
|
||||
/// Create a copy of VerifyOtpEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ResendForgotCopyWith<_ResendForgot> get copyWith => __$ResendForgotCopyWithImpl<_ResendForgot>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ResendForgot&&(identical(other.phoneNUmber, phoneNUmber) || other.phoneNUmber == phoneNUmber));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,phoneNUmber);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyOtpEvent.resendForgot(phoneNUmber: $phoneNUmber)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ResendForgotCopyWith<$Res> implements $VerifyOtpEventCopyWith<$Res> {
|
||||
factory _$ResendForgotCopyWith(_ResendForgot value, $Res Function(_ResendForgot) _then) = __$ResendForgotCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String phoneNUmber
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ResendForgotCopyWithImpl<$Res>
|
||||
implements _$ResendForgotCopyWith<$Res> {
|
||||
__$ResendForgotCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ResendForgot _self;
|
||||
final $Res Function(_ResendForgot) _then;
|
||||
|
||||
/// Create a copy of VerifyOtpEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? phoneNUmber = null,}) {
|
||||
return _then(_ResendForgot(
|
||||
null == phoneNUmber ? _self.phoneNUmber : phoneNUmber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Ticked implements VerifyOtpEvent {
|
||||
const _Ticked(this.seconds);
|
||||
|
||||
|
||||
final int seconds;
|
||||
|
||||
/// Create a copy of VerifyOtpEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$TickedCopyWith<_Ticked> get copyWith => __$TickedCopyWithImpl<_Ticked>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Ticked&&(identical(other.seconds, seconds) || other.seconds == seconds));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,seconds);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyOtpEvent.ticked(seconds: $seconds)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$TickedCopyWith<$Res> implements $VerifyOtpEventCopyWith<$Res> {
|
||||
factory _$TickedCopyWith(_Ticked value, $Res Function(_Ticked) _then) = __$TickedCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int seconds
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$TickedCopyWithImpl<$Res>
|
||||
implements _$TickedCopyWith<$Res> {
|
||||
__$TickedCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Ticked _self;
|
||||
final $Res Function(_Ticked) _then;
|
||||
|
||||
/// Create a copy of VerifyOtpEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? seconds = null,}) {
|
||||
return _then(_Ticked(
|
||||
null == seconds ? _self.seconds : seconds // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _VerifyOtpReset implements VerifyOtpEvent {
|
||||
const _VerifyOtpReset(this.params);
|
||||
|
||||
|
||||
final VerifyOtpCodeParams params;
|
||||
|
||||
/// Create a copy of VerifyOtpEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$VerifyOtpResetCopyWith<_VerifyOtpReset> get copyWith => __$VerifyOtpResetCopyWithImpl<_VerifyOtpReset>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VerifyOtpReset&&(identical(other.params, params) || other.params == params));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,params);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyOtpEvent.verifyOtpReset(params: $params)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$VerifyOtpResetCopyWith<$Res> implements $VerifyOtpEventCopyWith<$Res> {
|
||||
factory _$VerifyOtpResetCopyWith(_VerifyOtpReset value, $Res Function(_VerifyOtpReset) _then) = __$VerifyOtpResetCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
VerifyOtpCodeParams params
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$VerifyOtpResetCopyWithImpl<$Res>
|
||||
implements _$VerifyOtpResetCopyWith<$Res> {
|
||||
__$VerifyOtpResetCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _VerifyOtpReset _self;
|
||||
final $Res Function(_VerifyOtpReset) _then;
|
||||
|
||||
/// Create a copy of VerifyOtpEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? params = null,}) {
|
||||
return _then(_VerifyOtpReset(
|
||||
null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable
|
||||
as VerifyOtpCodeParams,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _VerifyOtpRegister implements VerifyOtpEvent {
|
||||
const _VerifyOtpRegister(this.params);
|
||||
|
||||
|
||||
final VerifyOtpCodeParams params;
|
||||
|
||||
/// Create a copy of VerifyOtpEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$VerifyOtpRegisterCopyWith<_VerifyOtpRegister> get copyWith => __$VerifyOtpRegisterCopyWithImpl<_VerifyOtpRegister>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VerifyOtpRegister&&(identical(other.params, params) || other.params == params));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,params);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyOtpEvent.verifyOtpRegister(params: $params)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$VerifyOtpRegisterCopyWith<$Res> implements $VerifyOtpEventCopyWith<$Res> {
|
||||
factory _$VerifyOtpRegisterCopyWith(_VerifyOtpRegister value, $Res Function(_VerifyOtpRegister) _then) = __$VerifyOtpRegisterCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
VerifyOtpCodeParams params
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$VerifyOtpRegisterCopyWithImpl<$Res>
|
||||
implements _$VerifyOtpRegisterCopyWith<$Res> {
|
||||
__$VerifyOtpRegisterCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _VerifyOtpRegister _self;
|
||||
final $Res Function(_VerifyOtpRegister) _then;
|
||||
|
||||
/// Create a copy of VerifyOtpEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? params = null,}) {
|
||||
return _then(_VerifyOtpRegister(
|
||||
null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable
|
||||
as VerifyOtpCodeParams,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$VerifyOtpState {
|
||||
|
||||
RequestStatus get status; RequestStatus get resendStatus; int get time;
|
||||
/// Create a copy of VerifyOtpState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$VerifyOtpStateCopyWith<VerifyOtpState> get copyWith => _$VerifyOtpStateCopyWithImpl<VerifyOtpState>(this as VerifyOtpState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is VerifyOtpState&&(identical(other.status, status) || other.status == status)&&(identical(other.resendStatus, resendStatus) || other.resendStatus == resendStatus)&&(identical(other.time, time) || other.time == time));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status,resendStatus,time);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyOtpState(status: $status, resendStatus: $resendStatus, time: $time)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $VerifyOtpStateCopyWith<$Res> {
|
||||
factory $VerifyOtpStateCopyWith(VerifyOtpState value, $Res Function(VerifyOtpState) _then) = _$VerifyOtpStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
RequestStatus status, RequestStatus resendStatus, int time
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$VerifyOtpStateCopyWithImpl<$Res>
|
||||
implements $VerifyOtpStateCopyWith<$Res> {
|
||||
_$VerifyOtpStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final VerifyOtpState _self;
|
||||
final $Res Function(VerifyOtpState) _then;
|
||||
|
||||
/// Create a copy of VerifyOtpState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? status = null,Object? resendStatus = null,Object? time = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,resendStatus: null == resendStatus ? _self.resendStatus : resendStatus // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,time: null == time ? _self.time : time // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [VerifyOtpState].
|
||||
extension VerifyOtpStatePatterns on VerifyOtpState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _VerifyOtpState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyOtpState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _VerifyOtpState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyOtpState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _VerifyOtpState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyOtpState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( RequestStatus status, RequestStatus resendStatus, int time)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyOtpState() when $default != null:
|
||||
return $default(_that.status,_that.resendStatus,_that.time);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( RequestStatus status, RequestStatus resendStatus, int time) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyOtpState():
|
||||
return $default(_that.status,_that.resendStatus,_that.time);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( RequestStatus status, RequestStatus resendStatus, int time)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyOtpState() when $default != null:
|
||||
return $default(_that.status,_that.resendStatus,_that.time);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _VerifyOtpState implements VerifyOtpState {
|
||||
const _VerifyOtpState({this.status = RequestStatus.initial, this.resendStatus = RequestStatus.initial, this.time = 120});
|
||||
|
||||
|
||||
@override@JsonKey() final RequestStatus status;
|
||||
@override@JsonKey() final RequestStatus resendStatus;
|
||||
@override@JsonKey() final int time;
|
||||
|
||||
/// Create a copy of VerifyOtpState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$VerifyOtpStateCopyWith<_VerifyOtpState> get copyWith => __$VerifyOtpStateCopyWithImpl<_VerifyOtpState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VerifyOtpState&&(identical(other.status, status) || other.status == status)&&(identical(other.resendStatus, resendStatus) || other.resendStatus == resendStatus)&&(identical(other.time, time) || other.time == time));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status,resendStatus,time);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyOtpState(status: $status, resendStatus: $resendStatus, time: $time)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$VerifyOtpStateCopyWith<$Res> implements $VerifyOtpStateCopyWith<$Res> {
|
||||
factory _$VerifyOtpStateCopyWith(_VerifyOtpState value, $Res Function(_VerifyOtpState) _then) = __$VerifyOtpStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
RequestStatus status, RequestStatus resendStatus, int time
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$VerifyOtpStateCopyWithImpl<$Res>
|
||||
implements _$VerifyOtpStateCopyWith<$Res> {
|
||||
__$VerifyOtpStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _VerifyOtpState _self;
|
||||
final $Res Function(_VerifyOtpState) _then;
|
||||
|
||||
/// Create a copy of VerifyOtpState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? status = null,Object? resendStatus = null,Object? time = null,}) {
|
||||
return _then(_VerifyOtpState(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,resendStatus: null == resendStatus ? _self.resendStatus : resendStatus // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,time: null == time ? _self.time : time // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,19 +0,0 @@
|
||||
part of 'verify_otp_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class VerifyOtpEvent with _$VerifyOtpEvent {
|
||||
const factory VerifyOtpEvent.started() = _Started;
|
||||
const factory VerifyOtpEvent.cancelTimer() = _CancelTimer;
|
||||
const factory VerifyOtpEvent.resendRegister(String phoneNUmber) =
|
||||
_ResendRegister;
|
||||
|
||||
const factory VerifyOtpEvent.resendForgot(String phoneNUmber) = _ResendForgot;
|
||||
|
||||
const factory VerifyOtpEvent.ticked(int seconds) = _Ticked;
|
||||
|
||||
const factory VerifyOtpEvent.verifyOtpReset(VerifyOtpCodeParams params) =
|
||||
_VerifyOtpReset;
|
||||
|
||||
const factory VerifyOtpEvent.verifyOtpRegister(VerifyOtpCodeParams params) =
|
||||
_VerifyOtpRegister;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
part of 'verify_otp_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class VerifyOtpState with _$VerifyOtpState {
|
||||
const factory VerifyOtpState({
|
||||
@Default(RequestStatus.initial) RequestStatus status,
|
||||
@Default(RequestStatus.initial) RequestStatus resendStatus,
|
||||
@Default(120) int time,
|
||||
}) = _VerifyOtpState;
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_phone_login_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_phone_register_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/common/presentation/widgets/w_toastification.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
part 'verify_phone_event.dart';
|
||||
|
||||
part 'verify_phone_state.dart';
|
||||
|
||||
part 'verify_phone_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class VerifyPhoneBloc extends Bloc<VerifyPhoneEvent, VerifyPhoneState> {
|
||||
final VerifyPhoneNumberLoginUseCase _loginUseCase;
|
||||
final VerifyPhoneRegisterUseCase _registerUseCase;
|
||||
|
||||
VerifyPhoneBloc(this._loginUseCase, this._registerUseCase)
|
||||
: super(const VerifyPhoneState()) {
|
||||
on<_VerifyPhoneRegister>(_onVerifyPhoneNumberRegister);
|
||||
on<_VerifyPhoneReset>(_onVerifyPhoneReset);
|
||||
}
|
||||
|
||||
Future<void> _onVerifyPhoneNumberRegister(
|
||||
_VerifyPhoneRegister event,
|
||||
Emitter<VerifyPhoneState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(status: RequestStatus.loading));
|
||||
final response = await _registerUseCase.call(event.params);
|
||||
|
||||
response.fold(
|
||||
(l) {
|
||||
showErrorToast(l.errorMessage);
|
||||
emit(state.copyWith(status: RequestStatus.error));
|
||||
},
|
||||
(r) {
|
||||
showSuccessToast(r.message);
|
||||
emit(state.copyWith(status: RequestStatus.loaded));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _onVerifyPhoneReset(
|
||||
_VerifyPhoneReset event,
|
||||
Emitter<VerifyPhoneState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(status: RequestStatus.loading));
|
||||
final response = await _loginUseCase.call(event.params);
|
||||
|
||||
response.fold(
|
||||
(l) {
|
||||
showErrorToast(l.errorMessage);
|
||||
emit(state.copyWith(status: RequestStatus.error));
|
||||
},
|
||||
(r) {
|
||||
showSuccessToast(r.message);
|
||||
emit(state.copyWith(status: RequestStatus.loaded));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,607 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'verify_phone_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$VerifyPhoneEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is VerifyPhoneEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyPhoneEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $VerifyPhoneEventCopyWith<$Res> {
|
||||
$VerifyPhoneEventCopyWith(VerifyPhoneEvent _, $Res Function(VerifyPhoneEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [VerifyPhoneEvent].
|
||||
extension VerifyPhoneEventPatterns on VerifyPhoneEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,TResult Function( _VerifyPhoneRegister value)? verifyPhoneRegister,TResult Function( _VerifyPhoneReset value)? verifyPhoneReset,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _VerifyPhoneRegister() when verifyPhoneRegister != null:
|
||||
return verifyPhoneRegister(_that);case _VerifyPhoneReset() when verifyPhoneReset != null:
|
||||
return verifyPhoneReset(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,required TResult Function( _VerifyPhoneRegister value) verifyPhoneRegister,required TResult Function( _VerifyPhoneReset value) verifyPhoneReset,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _VerifyPhoneRegister():
|
||||
return verifyPhoneRegister(_that);case _VerifyPhoneReset():
|
||||
return verifyPhoneReset(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,TResult? Function( _VerifyPhoneRegister value)? verifyPhoneRegister,TResult? Function( _VerifyPhoneReset value)? verifyPhoneReset,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _VerifyPhoneRegister() when verifyPhoneRegister != null:
|
||||
return verifyPhoneRegister(_that);case _VerifyPhoneReset() when verifyPhoneReset != null:
|
||||
return verifyPhoneReset(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,TResult Function( VerifyPhoneNumberParams params)? verifyPhoneRegister,TResult Function( VerifyPhoneNumberParams params)? verifyPhoneReset,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _VerifyPhoneRegister() when verifyPhoneRegister != null:
|
||||
return verifyPhoneRegister(_that.params);case _VerifyPhoneReset() when verifyPhoneReset != null:
|
||||
return verifyPhoneReset(_that.params);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,required TResult Function( VerifyPhoneNumberParams params) verifyPhoneRegister,required TResult Function( VerifyPhoneNumberParams params) verifyPhoneReset,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _VerifyPhoneRegister():
|
||||
return verifyPhoneRegister(_that.params);case _VerifyPhoneReset():
|
||||
return verifyPhoneReset(_that.params);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,TResult? Function( VerifyPhoneNumberParams params)? verifyPhoneRegister,TResult? Function( VerifyPhoneNumberParams params)? verifyPhoneReset,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _VerifyPhoneRegister() when verifyPhoneRegister != null:
|
||||
return verifyPhoneRegister(_that.params);case _VerifyPhoneReset() when verifyPhoneReset != null:
|
||||
return verifyPhoneReset(_that.params);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements VerifyPhoneEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyPhoneEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _VerifyPhoneRegister implements VerifyPhoneEvent {
|
||||
const _VerifyPhoneRegister(this.params);
|
||||
|
||||
|
||||
final VerifyPhoneNumberParams params;
|
||||
|
||||
/// Create a copy of VerifyPhoneEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$VerifyPhoneRegisterCopyWith<_VerifyPhoneRegister> get copyWith => __$VerifyPhoneRegisterCopyWithImpl<_VerifyPhoneRegister>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VerifyPhoneRegister&&(identical(other.params, params) || other.params == params));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,params);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyPhoneEvent.verifyPhoneRegister(params: $params)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$VerifyPhoneRegisterCopyWith<$Res> implements $VerifyPhoneEventCopyWith<$Res> {
|
||||
factory _$VerifyPhoneRegisterCopyWith(_VerifyPhoneRegister value, $Res Function(_VerifyPhoneRegister) _then) = __$VerifyPhoneRegisterCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
VerifyPhoneNumberParams params
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$VerifyPhoneRegisterCopyWithImpl<$Res>
|
||||
implements _$VerifyPhoneRegisterCopyWith<$Res> {
|
||||
__$VerifyPhoneRegisterCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _VerifyPhoneRegister _self;
|
||||
final $Res Function(_VerifyPhoneRegister) _then;
|
||||
|
||||
/// Create a copy of VerifyPhoneEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? params = null,}) {
|
||||
return _then(_VerifyPhoneRegister(
|
||||
null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable
|
||||
as VerifyPhoneNumberParams,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _VerifyPhoneReset implements VerifyPhoneEvent {
|
||||
const _VerifyPhoneReset(this.params);
|
||||
|
||||
|
||||
final VerifyPhoneNumberParams params;
|
||||
|
||||
/// Create a copy of VerifyPhoneEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$VerifyPhoneResetCopyWith<_VerifyPhoneReset> get copyWith => __$VerifyPhoneResetCopyWithImpl<_VerifyPhoneReset>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VerifyPhoneReset&&(identical(other.params, params) || other.params == params));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,params);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyPhoneEvent.verifyPhoneReset(params: $params)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$VerifyPhoneResetCopyWith<$Res> implements $VerifyPhoneEventCopyWith<$Res> {
|
||||
factory _$VerifyPhoneResetCopyWith(_VerifyPhoneReset value, $Res Function(_VerifyPhoneReset) _then) = __$VerifyPhoneResetCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
VerifyPhoneNumberParams params
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$VerifyPhoneResetCopyWithImpl<$Res>
|
||||
implements _$VerifyPhoneResetCopyWith<$Res> {
|
||||
__$VerifyPhoneResetCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _VerifyPhoneReset _self;
|
||||
final $Res Function(_VerifyPhoneReset) _then;
|
||||
|
||||
/// Create a copy of VerifyPhoneEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? params = null,}) {
|
||||
return _then(_VerifyPhoneReset(
|
||||
null == params ? _self.params : params // ignore: cast_nullable_to_non_nullable
|
||||
as VerifyPhoneNumberParams,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$VerifyPhoneState {
|
||||
|
||||
RequestStatus get status;
|
||||
/// Create a copy of VerifyPhoneState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$VerifyPhoneStateCopyWith<VerifyPhoneState> get copyWith => _$VerifyPhoneStateCopyWithImpl<VerifyPhoneState>(this as VerifyPhoneState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is VerifyPhoneState&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyPhoneState(status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $VerifyPhoneStateCopyWith<$Res> {
|
||||
factory $VerifyPhoneStateCopyWith(VerifyPhoneState value, $Res Function(VerifyPhoneState) _then) = _$VerifyPhoneStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
RequestStatus status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$VerifyPhoneStateCopyWithImpl<$Res>
|
||||
implements $VerifyPhoneStateCopyWith<$Res> {
|
||||
_$VerifyPhoneStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final VerifyPhoneState _self;
|
||||
final $Res Function(VerifyPhoneState) _then;
|
||||
|
||||
/// Create a copy of VerifyPhoneState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? status = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [VerifyPhoneState].
|
||||
extension VerifyPhoneStatePatterns on VerifyPhoneState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _VerifyPhoneState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyPhoneState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _VerifyPhoneState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyPhoneState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _VerifyPhoneState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyPhoneState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( RequestStatus status)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyPhoneState() when $default != null:
|
||||
return $default(_that.status);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( RequestStatus status) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyPhoneState():
|
||||
return $default(_that.status);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( RequestStatus status)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _VerifyPhoneState() when $default != null:
|
||||
return $default(_that.status);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _VerifyPhoneState implements VerifyPhoneState {
|
||||
const _VerifyPhoneState({this.status = RequestStatus.initial});
|
||||
|
||||
|
||||
@override@JsonKey() final RequestStatus status;
|
||||
|
||||
/// Create a copy of VerifyPhoneState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$VerifyPhoneStateCopyWith<_VerifyPhoneState> get copyWith => __$VerifyPhoneStateCopyWithImpl<_VerifyPhoneState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VerifyPhoneState&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyPhoneState(status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$VerifyPhoneStateCopyWith<$Res> implements $VerifyPhoneStateCopyWith<$Res> {
|
||||
factory _$VerifyPhoneStateCopyWith(_VerifyPhoneState value, $Res Function(_VerifyPhoneState) _then) = __$VerifyPhoneStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
RequestStatus status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$VerifyPhoneStateCopyWithImpl<$Res>
|
||||
implements _$VerifyPhoneStateCopyWith<$Res> {
|
||||
__$VerifyPhoneStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _VerifyPhoneState _self;
|
||||
final $Res Function(_VerifyPhoneState) _then;
|
||||
|
||||
/// Create a copy of VerifyPhoneState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? status = null,}) {
|
||||
return _then(_VerifyPhoneState(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,14 +0,0 @@
|
||||
part of 'verify_phone_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class VerifyPhoneEvent with _$VerifyPhoneEvent {
|
||||
const factory VerifyPhoneEvent.started() = _Started;
|
||||
|
||||
const factory VerifyPhoneEvent.verifyPhoneRegister(
|
||||
VerifyPhoneNumberParams params,
|
||||
) = _VerifyPhoneRegister;
|
||||
|
||||
const factory VerifyPhoneEvent.verifyPhoneReset(
|
||||
VerifyPhoneNumberParams params,
|
||||
) = _VerifyPhoneReset;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
part of 'verify_phone_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class VerifyPhoneState with _$VerifyPhoneState {
|
||||
const factory VerifyPhoneState({
|
||||
@Default(RequestStatus.initial) RequestStatus status,
|
||||
}) = _VerifyPhoneState;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class ForgotPasswordPage extends StatelessWidget {
|
||||
const ForgotPasswordPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WLayout(
|
||||
child: Scaffold(body: Column(children: [Text('Forgot password')])),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
import 'package:food_delivery_client/feature/auth/presentation/blocs/login_bloc/login_bloc.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/pages/login_page/widgets/login_body.dart';
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class LoginPage extends StatelessWidget {
|
||||
const LoginPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => sl<LoginBloc>(),
|
||||
child: WLayout(
|
||||
top: false,
|
||||
child: Scaffold(resizeToAvoidBottomInset: true, body: WLoginBody()),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
import 'package:food_delivery_client/core/helpers/formatters.dart';
|
||||
import 'package:food_delivery_client/core/helpers/validator_helpers.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/widgets/w_auth_background.dart';
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
import '../../../../domain/usecases/login_usecase.dart';
|
||||
import '../../../blocs/login_bloc/login_bloc.dart';
|
||||
|
||||
class WLoginBody extends StatefulWidget {
|
||||
const WLoginBody({super.key});
|
||||
|
||||
@override
|
||||
State<WLoginBody> createState() => _WLoginBodyState();
|
||||
}
|
||||
|
||||
class _WLoginBodyState extends State<WLoginBody> {
|
||||
late final TextEditingController _phoneController;
|
||||
late final TextEditingController _passwordController;
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_phoneController = TextEditingController();
|
||||
_passwordController = TextEditingController();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_phoneController.dispose();
|
||||
_passwordController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocConsumer<LoginBloc, LoginState>(
|
||||
listener: (context, state) {
|
||||
if (state.status.isLoaded()) {
|
||||
context.go(Routes.main);
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
child: WAuthBackground(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
25.verticalSpace,
|
||||
Align(
|
||||
alignment: AlignmentGeometry.center,
|
||||
child: Text(
|
||||
context.loc.login,
|
||||
style: AppTextStyles.size24Bold,
|
||||
),
|
||||
),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
context.loc.phone_number,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
hintText: context.loc.enter_phone_number,
|
||||
prefixIcon: Text(
|
||||
"+ 998",
|
||||
style: AppTextStyles.size16Regular.copyWith(fontSize: 16),
|
||||
),
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
controller: _phoneController,
|
||||
keyBoardType: TextInputType.number,
|
||||
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
Formatters.phoneFormatter,
|
||||
LengthLimitingTextInputFormatter(12),
|
||||
],
|
||||
validator: (value) {
|
||||
return Validators.validatePhoneNumber(
|
||||
_phoneController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
10.verticalSpace,
|
||||
Text(
|
||||
context.loc.password,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
height: 50,
|
||||
obscureText: true,
|
||||
hintText: context.loc.enter_password,
|
||||
keyBoardType: TextInputType.text,
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
controller: _passwordController,
|
||||
validator: (value) {
|
||||
return Validators.validatePassword(
|
||||
_passwordController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentGeometry.centerRight,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
context.push(Routes.verifyPhoneNumber, extra: false);
|
||||
},
|
||||
child: Text(
|
||||
context.loc.forgot_password,
|
||||
style: AppTextStyles.size14Medium.copyWith(
|
||||
color: AppColors.c34A853,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
40.verticalSpace,
|
||||
AppButton(
|
||||
name: context.loc.continue_str,
|
||||
isLoading: state.status.isLoading(),
|
||||
trailing: SvgPicture.asset(
|
||||
AppIcons.icArrowRightLight,
|
||||
).paddingOnly(left: 10),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
context.read<LoginBloc>().add(
|
||||
LoginEvent.login(
|
||||
LoginParams(
|
||||
phoneNumber:
|
||||
"+998${_phoneController.text.trim().replaceAll(" ", "")}",
|
||||
password: _passwordController.text.trim(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
borderRadius: 15,
|
||||
backgroundColor: AppColors.c34A853,
|
||||
),
|
||||
20.verticalSpace,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
context.loc.dont_have_account,
|
||||
style: AppTextStyles.size14Medium,
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.push(Routes.verifyPhoneNumber, extra: true);
|
||||
},
|
||||
child: Text(
|
||||
context.loc.sign_up,
|
||||
style: AppTextStyles.size15Bold.copyWith(
|
||||
color: AppColors.c34A853,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
20.verticalSpace,
|
||||
],
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import 'package:food_delivery_client/feature/auth/presentation/pages/register_page/widgets/w_register_body.dart';
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
import '../../blocs/register_bloc/register_bloc.dart';
|
||||
|
||||
class RegisterPage extends StatelessWidget {
|
||||
const RegisterPage({super.key, required this.phoneNumber});
|
||||
|
||||
final String phoneNumber;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => sl<RegisterBloc>(),
|
||||
child: BlocBuilder<RegisterBloc, RegisterState>(
|
||||
builder: (context, state) {
|
||||
return WLayout(
|
||||
top: false,
|
||||
child: Scaffold(body: WRegisterBody(phoneNumber: phoneNumber)),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,230 +0,0 @@
|
||||
import 'package:food_delivery_client/core/helpers/validator_helpers.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/register_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/widgets/w_auth_background.dart';
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
import '../../../blocs/register_bloc/register_bloc.dart';
|
||||
|
||||
class WRegisterBody extends StatefulWidget {
|
||||
const WRegisterBody({super.key, required this.phoneNumber});
|
||||
|
||||
final String phoneNumber;
|
||||
|
||||
@override
|
||||
State<WRegisterBody> createState() => _WRegisterBodyState();
|
||||
}
|
||||
|
||||
class _WRegisterBodyState extends State<WRegisterBody> {
|
||||
late TextEditingController _firstNameController;
|
||||
late TextEditingController _lastNameController;
|
||||
late TextEditingController _phoneNumberController;
|
||||
late TextEditingController _passwordController;
|
||||
late TextEditingController _repeatPasswordController;
|
||||
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_firstNameController = TextEditingController();
|
||||
_lastNameController = TextEditingController();
|
||||
_phoneNumberController = TextEditingController();
|
||||
_passwordController = TextEditingController();
|
||||
_repeatPasswordController = TextEditingController();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_firstNameController.dispose();
|
||||
_lastNameController.dispose();
|
||||
_phoneNumberController.dispose();
|
||||
_passwordController.dispose();
|
||||
_repeatPasswordController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocConsumer<RegisterBloc, RegisterState>(
|
||||
listener: (context, state) {
|
||||
if (state.status.isLoaded()) {
|
||||
context.go(Routes.login);
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
child: WAuthBackground(
|
||||
child: SizedBox(
|
||||
width: context.w,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
20.verticalSpace,
|
||||
Align(
|
||||
alignment: AlignmentGeometry.center,
|
||||
child: Text(
|
||||
context.loc.sign_up,
|
||||
style: AppTextStyles.size24Bold,
|
||||
),
|
||||
),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
context.loc.first_name,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
hintText: context.loc.enter_first_name,
|
||||
controller: _firstNameController,
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
keyBoardType: TextInputType.name,
|
||||
validator: (value) {
|
||||
return Validators.validateFields(
|
||||
_firstNameController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
10.verticalSpace,
|
||||
Text(
|
||||
'Last name',
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
hintText: "Enter LastName",
|
||||
controller: _lastNameController,
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
keyBoardType: TextInputType.text,
|
||||
validator: (value) {
|
||||
return Validators.validateFields(
|
||||
_lastNameController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
10.verticalSpace,
|
||||
/* Text(
|
||||
context.loc.phone_number,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
hintText: context.loc.enter_phone_number,
|
||||
controller: _phoneNumberController,
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
keyBoardType: TextInputType.phone,
|
||||
prefixIcon: Text("+ 998", style: AppTextStyles.size16Regular),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
Formatters.phoneFormatter,
|
||||
LengthLimitingTextInputFormatter(12),
|
||||
],
|
||||
validator: (value) {
|
||||
return Validators.validatePhoneNumber(
|
||||
_phoneNumberController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
*/
|
||||
10.verticalSpace,
|
||||
Text(
|
||||
context.loc.enter_password,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
obscureText: true,
|
||||
hintText: context.loc.password,
|
||||
controller: _passwordController,
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
keyBoardType: TextInputType.visiblePassword,
|
||||
validator: (value) {
|
||||
return Validators.validatePassword(
|
||||
_passwordController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
10.verticalSpace,
|
||||
|
||||
Text(
|
||||
context.loc.repeat_password,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
obscureText: true,
|
||||
hintText: context.loc.enter_repeat_password,
|
||||
controller: _repeatPasswordController,
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
keyBoardType: TextInputType.visiblePassword,
|
||||
validator: (value) {
|
||||
return Validators.validateRepeatPassword(
|
||||
_repeatPasswordController.text.trim(),
|
||||
_passwordController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
20.verticalSpace,
|
||||
AppButton(
|
||||
isLoading: state.status.isLoading(),
|
||||
name: context.loc.continue_str,
|
||||
borderRadius: 15,
|
||||
backgroundColor: AppColors.c34A853,
|
||||
trailing: SvgPicture.asset(
|
||||
AppIcons.icArrowRightLight,
|
||||
).paddingOnly(left: 8),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
context.read<RegisterBloc>().add(
|
||||
RegisterEvent.loaded(
|
||||
RegisterParams(
|
||||
phoneNumber: widget.phoneNumber,
|
||||
password: _passwordController.text.trim(),
|
||||
firstName: _firstNameController.text.trim(),
|
||||
lastName: _lastNameController.text.trim(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
20.verticalSpace,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
context.loc.already_has_account,
|
||||
style: AppTextStyles.size14Medium,
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pushReplacement(Routes.login);
|
||||
},
|
||||
child: Text(
|
||||
context.loc.login,
|
||||
style: AppTextStyles.size15Bold.copyWith(
|
||||
color: AppColors.c34A853,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
import 'package:food_delivery_client/core/helpers/validator_helpers.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/reset_password_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/blocs/reset_password_bloc/reset_password_bloc.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/widgets/w_auth_background.dart';
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class ResetPasswordPage extends StatefulWidget {
|
||||
const ResetPasswordPage({super.key, required this.phoneNumber});
|
||||
|
||||
final String phoneNumber;
|
||||
|
||||
@override
|
||||
State<ResetPasswordPage> createState() => _ResetPasswordPageState();
|
||||
}
|
||||
|
||||
class _ResetPasswordPageState extends State<ResetPasswordPage> {
|
||||
late TextEditingController _passwordController;
|
||||
late TextEditingController _repeatPasswordController;
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_passwordController = TextEditingController();
|
||||
_repeatPasswordController = TextEditingController();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_passwordController.dispose();
|
||||
_repeatPasswordController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => sl<ResetPasswordBloc>(),
|
||||
child: BlocConsumer<ResetPasswordBloc, ResetPasswordState>(
|
||||
listener: (context, state) {
|
||||
if (state.status.isLoaded()) {
|
||||
context.go(Routes.login);
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
child: WLayout(
|
||||
top: false,
|
||||
child: Scaffold(
|
||||
body: WAuthBackground(
|
||||
child: SizedBox(
|
||||
width: context.w,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
25.verticalSpace,
|
||||
Text(
|
||||
context.loc.reset_password,
|
||||
style: AppTextStyles.size20Medium,
|
||||
),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
context.loc.new_password,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
obscureText: true,
|
||||
controller: _passwordController,
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
hintText: context.loc.enter_password,
|
||||
keyBoardType: TextInputType.visiblePassword,
|
||||
validator: (value) {
|
||||
return Validators.validatePassword(
|
||||
_passwordController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
context.loc.password,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6A6E7F,
|
||||
),
|
||||
),
|
||||
5.verticalSpace,
|
||||
AppTextFormField(
|
||||
obscureText: true,
|
||||
controller: _repeatPasswordController,
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
hintText: context.loc.enter_password,
|
||||
keyBoardType: TextInputType.visiblePassword,
|
||||
validator: (value) {
|
||||
return Validators.validateRepeatPassword(
|
||||
_repeatPasswordController.text.trim(),
|
||||
_passwordController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
25.verticalSpace,
|
||||
AppButton(
|
||||
name: context.loc.continue_str,
|
||||
trailing: SvgPicture.asset(
|
||||
AppIcons.icArrowRightLight,
|
||||
).paddingOnly(left: 8),
|
||||
isLoading: state.status.isLoading(),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
context.read<ResetPasswordBloc>().add(
|
||||
ResetPasswordEvent.loaded(
|
||||
ResetPasswordParams(
|
||||
phoneNumber: widget.phoneNumber,
|
||||
newPassword: _passwordController.text
|
||||
.trim(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
backgroundColor: AppColors.c34A853,
|
||||
borderRadius: 15,
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,193 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:food_delivery_client/core/helpers/time_formatters.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_otp_code_login_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/blocs/verify_otp_bloc/verify_otp_bloc.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/widgets/w_auth_background.dart';
|
||||
import 'package:pinput/pinput.dart';
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class VerifyOtpCodePage extends StatefulWidget {
|
||||
const VerifyOtpCodePage({super.key, required this.params});
|
||||
|
||||
final OtpCodePageParams params;
|
||||
|
||||
@override
|
||||
State<VerifyOtpCodePage> createState() => _VerifyOtpCodePageState();
|
||||
}
|
||||
|
||||
class _VerifyOtpCodePageState extends State<VerifyOtpCodePage> {
|
||||
late TextEditingController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = TextEditingController();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
final defaultPinTheme = PinTheme(
|
||||
height: 56,
|
||||
width: 56,
|
||||
textStyle: AppTextStyles.size18Medium,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
border: Border.all(color: Color.fromRGBO(234, 239, 243, 1)),
|
||||
color: Color.fromRGBO(234, 234, 243, 1),
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => sl<VerifyOtpBloc>()..add(VerifyOtpEvent.started()),
|
||||
child: BlocConsumer<VerifyOtpBloc, VerifyOtpState>(
|
||||
listener: (context, state) {
|
||||
if (state.status.isLoaded()) {
|
||||
if (widget.params.isRegister) {
|
||||
context.push(Routes.register, extra: widget.params.phoneNumber);
|
||||
} else {
|
||||
context.push(
|
||||
Routes.resetPassword,
|
||||
extra: widget.params.phoneNumber,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return WLayout(
|
||||
top: false,
|
||||
child: Scaffold(
|
||||
body: WAuthBackground(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
40.verticalSpace,
|
||||
Text(
|
||||
context.loc.enter_otp_code(widget.params.phoneNumber),
|
||||
style: AppTextStyles.size20Medium,
|
||||
),
|
||||
20.verticalSpace,
|
||||
Pinput(
|
||||
length: 5,
|
||||
enabled: true,
|
||||
controller: _controller,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
autofocus: true,
|
||||
showCursor: true,
|
||||
defaultPinTheme: defaultPinTheme,
|
||||
|
||||
focusedPinTheme: defaultPinTheme.copyWith(
|
||||
decoration: defaultPinTheme.decoration!.copyWith(
|
||||
color: Color.fromRGBO(234, 239, 243, 1),
|
||||
),
|
||||
),
|
||||
submittedPinTheme: defaultPinTheme.copyWith(
|
||||
decoration: defaultPinTheme.decoration!.copyWith(
|
||||
color: Color.fromRGBO(234, 239, 243, 1),
|
||||
),
|
||||
),
|
||||
onChanged: (value) {
|
||||
if (value.length == 5 && state.time > 0) {}
|
||||
},
|
||||
),
|
||||
10.verticalSpace,
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
context.loc.resend_otp_after,
|
||||
style: AppTextStyles.size14Regular,
|
||||
),
|
||||
|
||||
if (state.time != 0)
|
||||
Text(
|
||||
TimeFormatters.formatMinutesToTime(state.time),
|
||||
),
|
||||
|
||||
if (state.time == 0)
|
||||
state.resendStatus.isLoading()
|
||||
? CircularProgressIndicator.adaptive()
|
||||
: IconButton(
|
||||
onPressed: () {
|
||||
if (widget.params.isRegister) {
|
||||
context.read<VerifyOtpBloc>().add(
|
||||
VerifyOtpEvent.resendRegister(
|
||||
widget.params.phoneNumber,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
context.read<VerifyOtpBloc>().add(
|
||||
VerifyOtpEvent.resendForgot(
|
||||
widget.params.phoneNumber,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: Icon(
|
||||
CupertinoIcons.restart,
|
||||
color: AppColors.c000000,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
20.verticalSpace,
|
||||
AppButton(
|
||||
name: context.loc.continue_str,
|
||||
onPressed: () {
|
||||
if (_controller.text.trim().length == 5 &&
|
||||
state.time > 0) {
|
||||
if (widget.params.isRegister) {
|
||||
context.read<VerifyOtpBloc>().add(
|
||||
VerifyOtpEvent.verifyOtpRegister(
|
||||
VerifyOtpCodeParams(
|
||||
phoneNumber: widget.params.phoneNumber,
|
||||
otpCode: _controller.text.trim().substring(
|
||||
0,
|
||||
4,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
context.read<VerifyOtpBloc>().add(
|
||||
VerifyOtpEvent.verifyOtpReset(
|
||||
VerifyOtpCodeParams(
|
||||
phoneNumber: widget.params.phoneNumber,
|
||||
otpCode: int.tryParse(
|
||||
_controller.text.trim().substring(0, 4),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
isLoading: state.status.isLoading(),
|
||||
backgroundColor: AppColors.c34A853,
|
||||
borderRadius: 15,
|
||||
trailing: SvgPicture.asset(
|
||||
AppIcons.icArrowRightLight,
|
||||
).paddingOnly(left: 8),
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
import 'package:food_delivery_client/core/helpers/formatters.dart';
|
||||
import 'package:food_delivery_client/core/helpers/validator_helpers.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_otp_code_login_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/domain/usecases/verify_phone_login_usecase.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/blocs/verify_phone_bloc/verify_phone_bloc.dart';
|
||||
import 'package:food_delivery_client/feature/auth/presentation/widgets/w_auth_background.dart';
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class VerifyPhoneNumberPage extends StatefulWidget {
|
||||
const VerifyPhoneNumberPage({super.key, required this.isRegister});
|
||||
|
||||
final bool isRegister;
|
||||
|
||||
@override
|
||||
State<VerifyPhoneNumberPage> createState() => _VerifyPhoneNumberPageState();
|
||||
}
|
||||
|
||||
class _VerifyPhoneNumberPageState extends State<VerifyPhoneNumberPage> {
|
||||
late TextEditingController _phoneNumberController;
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_phoneNumberController = TextEditingController();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_phoneNumberController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => sl<VerifyPhoneBloc>(),
|
||||
child: BlocConsumer<VerifyPhoneBloc, VerifyPhoneState>(
|
||||
listener: (context, state) {
|
||||
if (state.status.isLoaded()) {
|
||||
context.push(
|
||||
Routes.verifyOtpCode,
|
||||
extra: OtpCodePageParams(
|
||||
phoneNumber:
|
||||
"+998${_phoneNumberController.text.trim().replaceAll(" ", "")}",
|
||||
isRegister: widget.isRegister,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
child: WLayout(
|
||||
top: false,
|
||||
child: Scaffold(
|
||||
body: WAuthBackground(
|
||||
child: SizedBox(
|
||||
width: context.w,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
50.verticalSpace,
|
||||
Text(
|
||||
context.loc.enter_phone_number,
|
||||
style: AppTextStyles.size20Medium,
|
||||
),
|
||||
20.verticalSpace,
|
||||
AppTextFormField(
|
||||
controller: _phoneNumberController,
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
hintText: context.loc.phone_number,
|
||||
keyBoardType: TextInputType.phone,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
Formatters.phoneFormatter,
|
||||
LengthLimitingTextInputFormatter(12),
|
||||
],
|
||||
|
||||
prefixIcon: Text(
|
||||
"+ 998",
|
||||
style: AppTextStyles.size16Regular,
|
||||
),
|
||||
validator: (value) {
|
||||
return Validators.validatePhoneNumber(
|
||||
_phoneNumberController.text.trim(),
|
||||
);
|
||||
},
|
||||
),
|
||||
25.verticalSpace,
|
||||
AppButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState?.validate() ?? false) {
|
||||
|
||||
|
||||
if (widget.isRegister) {
|
||||
context.read<VerifyPhoneBloc>().add(
|
||||
VerifyPhoneEvent.verifyPhoneRegister(
|
||||
VerifyPhoneNumberParams(
|
||||
phoneNumber:
|
||||
"+998${_phoneNumberController.text.trim().replaceAll(" ", "")}",
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
context.read<VerifyPhoneBloc>().add(
|
||||
VerifyPhoneEvent.verifyPhoneReset(
|
||||
VerifyPhoneNumberParams(
|
||||
phoneNumber:
|
||||
"+998${_phoneNumberController.text.trim().replaceAll(" ", "")}",
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
isLoading: state.status.isLoading(),
|
||||
name: context.loc.continue_str,
|
||||
borderRadius: 15,
|
||||
backgroundColor: AppColors.c34A853,
|
||||
),
|
||||
10.verticalSpace,
|
||||
Text(
|
||||
context.loc.consent_message("Felix Eats"),
|
||||
style: AppTextStyles.size12Medium.copyWith(
|
||||
color: AppColors.c888888,
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 16),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WAuthBackground extends StatelessWidget {
|
||||
const WAuthBackground({super.key, required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: context.h * .3,
|
||||
child: Image.asset(AppImages.imgBurger2, fit: BoxFit.cover),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
keyboardDismissBehavior:
|
||||
ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: context.h * .2),
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cFFFFFF,
|
||||
borderRadius: AppUtils.kBorderRadiusTop20,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
export 'presentation/pages/basket_page/basket_page.dart';
|
||||
export 'package:food_delivery_client/feature/basket/presentation/pages/basket_page/widgets/w_basket_empty.dart';
|
||||
export 'package:food_delivery_client/feature/basket/presentation/pages/basket_page/widgets/w_basket_header.dart';
|
||||
export 'presentation/blocs/basket_bloc.dart';
|
||||
export 'package:food_delivery_client/feature/basket/presentation/pages/basket_page/widgets/w_basket_body.dart';
|
||||
export 'package:food_delivery_client/feature/basket/presentation/pages/basket_page/widgets/w_basket_carts.dart';
|
||||
export 'package:food_delivery_client/feature/basket/presentation/pages/basket_page/widgets/w_basket_loading.dart';
|
||||
export 'package:food_delivery_client/feature/basket/presentation/pages/basket_page/widgets/w_order_item.dart';
|
||||
@@ -1,20 +0,0 @@
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
part 'basket_event.dart';
|
||||
|
||||
part 'basket_state.dart';
|
||||
|
||||
part 'basket_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class BasketBloc extends Bloc<BasketEvent, BasketState> {
|
||||
BasketBloc() : super(const BasketState()) {
|
||||
on<_Started>(_onStarted);
|
||||
}
|
||||
|
||||
_onStarted(_Started event, Emitter<BasketState> emit) async {
|
||||
emit(state.copyWith(status: RequestStatus.loading));
|
||||
await Future.delayed(TimeDelayConst.duration3);
|
||||
emit(state.copyWith(status: RequestStatus.loaded, orders: []));
|
||||
}
|
||||
}
|
||||
@@ -1,472 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'basket_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$BasketEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is BasketEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BasketEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $BasketEventCopyWith<$Res> {
|
||||
$BasketEventCopyWith(BasketEvent _, $Res Function(BasketEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [BasketEvent].
|
||||
extension BasketEventPatterns on BasketEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements BasketEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BasketEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$BasketState {
|
||||
|
||||
RequestStatus get status; List get orders;
|
||||
/// Create a copy of BasketState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$BasketStateCopyWith<BasketState> get copyWith => _$BasketStateCopyWithImpl<BasketState>(this as BasketState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is BasketState&&(identical(other.status, status) || other.status == status)&&const DeepCollectionEquality().equals(other.orders, orders));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status,const DeepCollectionEquality().hash(orders));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BasketState(status: $status, orders: $orders)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $BasketStateCopyWith<$Res> {
|
||||
factory $BasketStateCopyWith(BasketState value, $Res Function(BasketState) _then) = _$BasketStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
RequestStatus status, List orders
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$BasketStateCopyWithImpl<$Res>
|
||||
implements $BasketStateCopyWith<$Res> {
|
||||
_$BasketStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final BasketState _self;
|
||||
final $Res Function(BasketState) _then;
|
||||
|
||||
/// Create a copy of BasketState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? status = null,Object? orders = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,orders: null == orders ? _self.orders : orders // ignore: cast_nullable_to_non_nullable
|
||||
as List,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [BasketState].
|
||||
extension BasketStatePatterns on BasketState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _BasketState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BasketState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _BasketState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BasketState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _BasketState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BasketState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( RequestStatus status, List orders)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BasketState() when $default != null:
|
||||
return $default(_that.status,_that.orders);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( RequestStatus status, List orders) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BasketState():
|
||||
return $default(_that.status,_that.orders);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( RequestStatus status, List orders)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BasketState() when $default != null:
|
||||
return $default(_that.status,_that.orders);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _BasketState implements BasketState {
|
||||
const _BasketState({this.status = RequestStatus.initial, final List orders = const []}): _orders = orders;
|
||||
|
||||
|
||||
@override@JsonKey() final RequestStatus status;
|
||||
final List _orders;
|
||||
@override@JsonKey() List get orders {
|
||||
if (_orders is EqualUnmodifiableListView) return _orders;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_orders);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of BasketState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$BasketStateCopyWith<_BasketState> get copyWith => __$BasketStateCopyWithImpl<_BasketState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _BasketState&&(identical(other.status, status) || other.status == status)&&const DeepCollectionEquality().equals(other._orders, _orders));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status,const DeepCollectionEquality().hash(_orders));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BasketState(status: $status, orders: $orders)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$BasketStateCopyWith<$Res> implements $BasketStateCopyWith<$Res> {
|
||||
factory _$BasketStateCopyWith(_BasketState value, $Res Function(_BasketState) _then) = __$BasketStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
RequestStatus status, List orders
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$BasketStateCopyWithImpl<$Res>
|
||||
implements _$BasketStateCopyWith<$Res> {
|
||||
__$BasketStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _BasketState _self;
|
||||
final $Res Function(_BasketState) _then;
|
||||
|
||||
/// Create a copy of BasketState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? status = null,Object? orders = null,}) {
|
||||
return _then(_BasketState(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,orders: null == orders ? _self._orders : orders // ignore: cast_nullable_to_non_nullable
|
||||
as List,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,6 +0,0 @@
|
||||
part of 'basket_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class BasketEvent with _$BasketEvent {
|
||||
const factory BasketEvent.started() = _Started;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
part of 'basket_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class BasketState with _$BasketState {
|
||||
const factory BasketState({
|
||||
@Default(RequestStatus.initial) RequestStatus status,
|
||||
@Default([]) List orders,
|
||||
}) = _BasketState;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class BasketPage extends StatelessWidget {
|
||||
const BasketPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => sl<BasketBloc>()..add(BasketEvent.started()),
|
||||
child: BlocBuilder<BasketBloc, BasketState>(
|
||||
builder: (context, state) {
|
||||
return WLayout(child: Scaffold(body: WBasketBody()));
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WBasketBody extends StatelessWidget {
|
||||
const WBasketBody({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<BasketBloc, BasketState>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
children: [
|
||||
WBasketHeader(),
|
||||
if (state.status.isLoading()) WBasketLoading(),
|
||||
if (state.status.isLoaded())
|
||||
if (state.orders.isEmpty) WBasketEmpty() else WBasketCarts(),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WBasketCarts extends StatelessWidget {
|
||||
const WBasketCarts({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<BasketBloc, BasketState>(
|
||||
builder: (context, state) {
|
||||
return Expanded(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
context.read<BasketBloc>().add(BasketEvent.started());
|
||||
await Future.delayed(TimeDelayConst.duration3);
|
||||
},
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: 10,
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) => OrderItem(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WBasketEmpty extends StatelessWidget {
|
||||
const WBasketEmpty({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<MainBloc, MainState>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
70.verticalSpace,
|
||||
SvgPicture.asset(AppIcons.icEmptyBasket),
|
||||
Text(
|
||||
context.loc.addItemsStartBasket,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppTextStyles.size20Medium,
|
||||
),
|
||||
12.verticalSpace,
|
||||
Text(
|
||||
context.loc.basketHint,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppTextStyles.size16Regular.copyWith(
|
||||
color: AppColors.c545454,
|
||||
height: 24 / 16,
|
||||
),
|
||||
),
|
||||
38.verticalSpace,
|
||||
AppButton(
|
||||
name: context.loc.startShopping,
|
||||
onPressed: () {
|
||||
context.read<MainBloc>().add(MainEvent.loaded(0));
|
||||
},
|
||||
height: 45,
|
||||
width: 250,
|
||||
|
||||
borderRadius: 99,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
).paddingSymmetric(horizontal: 35);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WBasketHeader extends StatelessWidget {
|
||||
const WBasketHeader({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
8.verticalSpace,
|
||||
Align(
|
||||
alignment: AlignmentGeometry.centerRight,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(99),
|
||||
onTap: () {},
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cEEEEEE,
|
||||
borderRadius: BorderRadius.circular(99),
|
||||
),
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Image.asset(
|
||||
AppIcons.icOrders,
|
||||
height: 20,
|
||||
width: 20,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
Text(context.loc.orders, style: AppTextStyles.size14Medium),
|
||||
],
|
||||
).paddingSymmetric(vertical: 10, horizontal: 16),
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentGeometry.centerLeft,
|
||||
child: Text(context.loc.cartsTitle, style: AppTextStyles.size36Bold),
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 15);
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WBasketLoading extends StatelessWidget {
|
||||
const WBasketLoading({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: 10,
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) =>
|
||||
Skeletonizer(enabled: true, child: OrderItemSkeletonizer()),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class OrderItemSkeletonizer extends StatelessWidget {
|
||||
const OrderItemSkeletonizer({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
child: Ink(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: AppUtils.kBorderRadius40,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: AppLocaleKeys.imageUrl,
|
||||
height: 70,
|
||||
width: 70,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
16.horizontalSpace,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Begs & Megs", style: AppTextStyles.size16Medium),
|
||||
Text(
|
||||
AppLocaleKeys.lorem,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Deliver to San Franciscao Bay Area",
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios_outlined,
|
||||
color: AppColors.cFFFFFF,
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(vertical: 10, horizontal: 18),
|
||||
10.verticalSpace,
|
||||
WDivider(indent: 120, endIndent: 20, height: 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class OrderItem extends StatelessWidget {
|
||||
const OrderItem({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
child: Ink(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: AppUtils.kBorderRadius40,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: AppLocaleKeys.imageUrl,
|
||||
height: 70,
|
||||
width: 70,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
16.horizontalSpace,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocaleKeys.lorem,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: AppTextStyles.size16Medium,
|
||||
),
|
||||
Row(
|
||||
spacing: 5,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
AppLocaleKeys.lorem,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(Icons.circle, size: 5, color: AppColors.c6B6B6B),
|
||||
Expanded(
|
||||
child: Text(
|
||||
AppLocaleKeys.lorem,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
AppLocaleKeys.lorem,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
10.horizontalSpace,
|
||||
SvgPicture.asset(AppIcons.icArrowRight),
|
||||
],
|
||||
).paddingSymmetric(vertical: 10, horizontal: 18),
|
||||
10.verticalSpace,
|
||||
WDivider(indent: 120, endIndent: 20, height: 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
export 'presentation/pages/browse_page/browse_page.dart';
|
||||
export 'package:food_delivery_client/feature/browse/presentation/pages/browse_page/widgets/w_browse_body.dart';
|
||||
export 'package:food_delivery_client/feature/browse/presentation/pages/browse_page/widgets/w_browse_item.dart';
|
||||
export "presentation/blocs/browse_bloc/browse_bloc.dart";
|
||||
export 'package:food_delivery_client/feature/browse/presentation/pages/browse_page/widgets/w_all_categories_skeletonizer.dart';
|
||||
export 'package:food_delivery_client/feature/browse/presentation/pages/browse_page/widgets/w_browse_skeletonizer.dart';
|
||||
export 'package:food_delivery_client/feature/browse/presentation/pages/browse_page/widgets/w_all_categories.dart';
|
||||
export 'package:food_delivery_client/feature/browse/presentation/pages/browse_page/widgets/w_top_categories.dart';
|
||||
export 'package:food_delivery_client/feature/common/presentation/widgets/app_text_form_field.dart';
|
||||
export 'package:food_delivery_client/feature/browse/presentation/pages/browse_page/widgets/w_top_categories_skeletonizer.dart';
|
||||
@@ -1,48 +0,0 @@
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
part 'browse_event.dart';
|
||||
|
||||
part 'browse_state.dart';
|
||||
|
||||
part 'browse_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class BrowseBloc extends Bloc<BrowseEvent, BrowseState> {
|
||||
BrowseBloc() : super(const BrowseState()) {
|
||||
on<_GetTopCategories>(_onGetTopCategories);
|
||||
on<_GetAllCategories>(_onGetAllCategories);
|
||||
on<_GetSearchHistory>(_onGetSearchHistory);
|
||||
on<_FocusChanged>(_onFocusChanged);
|
||||
}
|
||||
|
||||
Future<void> _onGetTopCategories(
|
||||
_GetTopCategories event,
|
||||
Emitter<BrowseState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(topCategorySt: RequestStatus.loading));
|
||||
await Future.delayed(TimeDelayConst.duration3);
|
||||
emit(state.copyWith(topCategorySt: RequestStatus.loaded));
|
||||
}
|
||||
|
||||
Future<void> _onGetAllCategories(
|
||||
_GetAllCategories event,
|
||||
Emitter<BrowseState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(allCategorySt: RequestStatus.loading));
|
||||
await Future.delayed(TimeDelayConst.duration3);
|
||||
emit(state.copyWith(allCategorySt: RequestStatus.loaded));
|
||||
}
|
||||
|
||||
Future<void> _onGetSearchHistory(
|
||||
_GetSearchHistory event,
|
||||
Emitter<BrowseState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(searchHistorySt: RequestStatus.loading));
|
||||
await Future.delayed(TimeDelayConst.duration3);
|
||||
emit(state.copyWith(searchHistorySt: RequestStatus.loading));
|
||||
}
|
||||
|
||||
void _onFocusChanged(_FocusChanged event, Emitter<BrowseState> emit) {
|
||||
emit(state.copyWith(isActive: event.isActive ?? !(state.isActive)));
|
||||
}
|
||||
}
|
||||
@@ -1,667 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'browse_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$BrowseEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is BrowseEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BrowseEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $BrowseEventCopyWith<$Res> {
|
||||
$BrowseEventCopyWith(BrowseEvent _, $Res Function(BrowseEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [BrowseEvent].
|
||||
extension BrowseEventPatterns on BrowseEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,TResult Function( _GetTopCategories value)? getTopCategories,TResult Function( _GetAllCategories value)? getAllCategories,TResult Function( _GetSearchHistory value)? getSearchHistory,TResult Function( _FocusChanged value)? focusChanged,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _GetTopCategories() when getTopCategories != null:
|
||||
return getTopCategories(_that);case _GetAllCategories() when getAllCategories != null:
|
||||
return getAllCategories(_that);case _GetSearchHistory() when getSearchHistory != null:
|
||||
return getSearchHistory(_that);case _FocusChanged() when focusChanged != null:
|
||||
return focusChanged(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,required TResult Function( _GetTopCategories value) getTopCategories,required TResult Function( _GetAllCategories value) getAllCategories,required TResult Function( _GetSearchHistory value) getSearchHistory,required TResult Function( _FocusChanged value) focusChanged,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _GetTopCategories():
|
||||
return getTopCategories(_that);case _GetAllCategories():
|
||||
return getAllCategories(_that);case _GetSearchHistory():
|
||||
return getSearchHistory(_that);case _FocusChanged():
|
||||
return focusChanged(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,TResult? Function( _GetTopCategories value)? getTopCategories,TResult? Function( _GetAllCategories value)? getAllCategories,TResult? Function( _GetSearchHistory value)? getSearchHistory,TResult? Function( _FocusChanged value)? focusChanged,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _GetTopCategories() when getTopCategories != null:
|
||||
return getTopCategories(_that);case _GetAllCategories() when getAllCategories != null:
|
||||
return getAllCategories(_that);case _GetSearchHistory() when getSearchHistory != null:
|
||||
return getSearchHistory(_that);case _FocusChanged() when focusChanged != null:
|
||||
return focusChanged(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,TResult Function()? getTopCategories,TResult Function()? getAllCategories,TResult Function()? getSearchHistory,TResult Function( bool? isActive)? focusChanged,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _GetTopCategories() when getTopCategories != null:
|
||||
return getTopCategories();case _GetAllCategories() when getAllCategories != null:
|
||||
return getAllCategories();case _GetSearchHistory() when getSearchHistory != null:
|
||||
return getSearchHistory();case _FocusChanged() when focusChanged != null:
|
||||
return focusChanged(_that.isActive);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,required TResult Function() getTopCategories,required TResult Function() getAllCategories,required TResult Function() getSearchHistory,required TResult Function( bool? isActive) focusChanged,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _GetTopCategories():
|
||||
return getTopCategories();case _GetAllCategories():
|
||||
return getAllCategories();case _GetSearchHistory():
|
||||
return getSearchHistory();case _FocusChanged():
|
||||
return focusChanged(_that.isActive);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,TResult? Function()? getTopCategories,TResult? Function()? getAllCategories,TResult? Function()? getSearchHistory,TResult? Function( bool? isActive)? focusChanged,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _GetTopCategories() when getTopCategories != null:
|
||||
return getTopCategories();case _GetAllCategories() when getAllCategories != null:
|
||||
return getAllCategories();case _GetSearchHistory() when getSearchHistory != null:
|
||||
return getSearchHistory();case _FocusChanged() when focusChanged != null:
|
||||
return focusChanged(_that.isActive);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements BrowseEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BrowseEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _GetTopCategories implements BrowseEvent {
|
||||
const _GetTopCategories();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetTopCategories);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BrowseEvent.getTopCategories()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _GetAllCategories implements BrowseEvent {
|
||||
const _GetAllCategories();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetAllCategories);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BrowseEvent.getAllCategories()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _GetSearchHistory implements BrowseEvent {
|
||||
const _GetSearchHistory();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetSearchHistory);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BrowseEvent.getSearchHistory()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _FocusChanged implements BrowseEvent {
|
||||
const _FocusChanged(this.isActive);
|
||||
|
||||
|
||||
final bool? isActive;
|
||||
|
||||
/// Create a copy of BrowseEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$FocusChangedCopyWith<_FocusChanged> get copyWith => __$FocusChangedCopyWithImpl<_FocusChanged>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _FocusChanged&&(identical(other.isActive, isActive) || other.isActive == isActive));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isActive);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BrowseEvent.focusChanged(isActive: $isActive)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$FocusChangedCopyWith<$Res> implements $BrowseEventCopyWith<$Res> {
|
||||
factory _$FocusChangedCopyWith(_FocusChanged value, $Res Function(_FocusChanged) _then) = __$FocusChangedCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool? isActive
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$FocusChangedCopyWithImpl<$Res>
|
||||
implements _$FocusChangedCopyWith<$Res> {
|
||||
__$FocusChangedCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _FocusChanged _self;
|
||||
final $Res Function(_FocusChanged) _then;
|
||||
|
||||
/// Create a copy of BrowseEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? isActive = freezed,}) {
|
||||
return _then(_FocusChanged(
|
||||
freezed == isActive ? _self.isActive : isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$BrowseState {
|
||||
|
||||
RequestStatus get topCategorySt; RequestStatus get allCategorySt; RequestStatus get searchHistorySt; List<String> get searchHistory; bool get isActive;
|
||||
/// Create a copy of BrowseState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$BrowseStateCopyWith<BrowseState> get copyWith => _$BrowseStateCopyWithImpl<BrowseState>(this as BrowseState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is BrowseState&&(identical(other.topCategorySt, topCategorySt) || other.topCategorySt == topCategorySt)&&(identical(other.allCategorySt, allCategorySt) || other.allCategorySt == allCategorySt)&&(identical(other.searchHistorySt, searchHistorySt) || other.searchHistorySt == searchHistorySt)&&const DeepCollectionEquality().equals(other.searchHistory, searchHistory)&&(identical(other.isActive, isActive) || other.isActive == isActive));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,topCategorySt,allCategorySt,searchHistorySt,const DeepCollectionEquality().hash(searchHistory),isActive);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BrowseState(topCategorySt: $topCategorySt, allCategorySt: $allCategorySt, searchHistorySt: $searchHistorySt, searchHistory: $searchHistory, isActive: $isActive)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $BrowseStateCopyWith<$Res> {
|
||||
factory $BrowseStateCopyWith(BrowseState value, $Res Function(BrowseState) _then) = _$BrowseStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
RequestStatus topCategorySt, RequestStatus allCategorySt, RequestStatus searchHistorySt, List<String> searchHistory, bool isActive
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$BrowseStateCopyWithImpl<$Res>
|
||||
implements $BrowseStateCopyWith<$Res> {
|
||||
_$BrowseStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final BrowseState _self;
|
||||
final $Res Function(BrowseState) _then;
|
||||
|
||||
/// Create a copy of BrowseState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? topCategorySt = null,Object? allCategorySt = null,Object? searchHistorySt = null,Object? searchHistory = null,Object? isActive = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
topCategorySt: null == topCategorySt ? _self.topCategorySt : topCategorySt // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,allCategorySt: null == allCategorySt ? _self.allCategorySt : allCategorySt // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,searchHistorySt: null == searchHistorySt ? _self.searchHistorySt : searchHistorySt // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,searchHistory: null == searchHistory ? _self.searchHistory : searchHistory // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,isActive: null == isActive ? _self.isActive : isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [BrowseState].
|
||||
extension BrowseStatePatterns on BrowseState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _BrowseState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BrowseState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _BrowseState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BrowseState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _BrowseState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _BrowseState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( RequestStatus topCategorySt, RequestStatus allCategorySt, RequestStatus searchHistorySt, List<String> searchHistory, bool isActive)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BrowseState() when $default != null:
|
||||
return $default(_that.topCategorySt,_that.allCategorySt,_that.searchHistorySt,_that.searchHistory,_that.isActive);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( RequestStatus topCategorySt, RequestStatus allCategorySt, RequestStatus searchHistorySt, List<String> searchHistory, bool isActive) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BrowseState():
|
||||
return $default(_that.topCategorySt,_that.allCategorySt,_that.searchHistorySt,_that.searchHistory,_that.isActive);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( RequestStatus topCategorySt, RequestStatus allCategorySt, RequestStatus searchHistorySt, List<String> searchHistory, bool isActive)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _BrowseState() when $default != null:
|
||||
return $default(_that.topCategorySt,_that.allCategorySt,_that.searchHistorySt,_that.searchHistory,_that.isActive);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _BrowseState implements BrowseState {
|
||||
const _BrowseState({this.topCategorySt = RequestStatus.initial, this.allCategorySt = RequestStatus.initial, this.searchHistorySt = RequestStatus.initial, final List<String> searchHistory = const [], this.isActive = false}): _searchHistory = searchHistory;
|
||||
|
||||
|
||||
@override@JsonKey() final RequestStatus topCategorySt;
|
||||
@override@JsonKey() final RequestStatus allCategorySt;
|
||||
@override@JsonKey() final RequestStatus searchHistorySt;
|
||||
final List<String> _searchHistory;
|
||||
@override@JsonKey() List<String> get searchHistory {
|
||||
if (_searchHistory is EqualUnmodifiableListView) return _searchHistory;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_searchHistory);
|
||||
}
|
||||
|
||||
@override@JsonKey() final bool isActive;
|
||||
|
||||
/// Create a copy of BrowseState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$BrowseStateCopyWith<_BrowseState> get copyWith => __$BrowseStateCopyWithImpl<_BrowseState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _BrowseState&&(identical(other.topCategorySt, topCategorySt) || other.topCategorySt == topCategorySt)&&(identical(other.allCategorySt, allCategorySt) || other.allCategorySt == allCategorySt)&&(identical(other.searchHistorySt, searchHistorySt) || other.searchHistorySt == searchHistorySt)&&const DeepCollectionEquality().equals(other._searchHistory, _searchHistory)&&(identical(other.isActive, isActive) || other.isActive == isActive));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,topCategorySt,allCategorySt,searchHistorySt,const DeepCollectionEquality().hash(_searchHistory),isActive);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BrowseState(topCategorySt: $topCategorySt, allCategorySt: $allCategorySt, searchHistorySt: $searchHistorySt, searchHistory: $searchHistory, isActive: $isActive)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$BrowseStateCopyWith<$Res> implements $BrowseStateCopyWith<$Res> {
|
||||
factory _$BrowseStateCopyWith(_BrowseState value, $Res Function(_BrowseState) _then) = __$BrowseStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
RequestStatus topCategorySt, RequestStatus allCategorySt, RequestStatus searchHistorySt, List<String> searchHistory, bool isActive
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$BrowseStateCopyWithImpl<$Res>
|
||||
implements _$BrowseStateCopyWith<$Res> {
|
||||
__$BrowseStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _BrowseState _self;
|
||||
final $Res Function(_BrowseState) _then;
|
||||
|
||||
/// Create a copy of BrowseState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? topCategorySt = null,Object? allCategorySt = null,Object? searchHistorySt = null,Object? searchHistory = null,Object? isActive = null,}) {
|
||||
return _then(_BrowseState(
|
||||
topCategorySt: null == topCategorySt ? _self.topCategorySt : topCategorySt // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,allCategorySt: null == allCategorySt ? _self.allCategorySt : allCategorySt // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,searchHistorySt: null == searchHistorySt ? _self.searchHistorySt : searchHistorySt // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,searchHistory: null == searchHistory ? _self._searchHistory : searchHistory // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,isActive: null == isActive ? _self.isActive : isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,14 +0,0 @@
|
||||
part of 'browse_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class BrowseEvent with _$BrowseEvent {
|
||||
const factory BrowseEvent.started() = _Started;
|
||||
|
||||
const factory BrowseEvent.getTopCategories() = _GetTopCategories;
|
||||
|
||||
const factory BrowseEvent.getAllCategories() = _GetAllCategories;
|
||||
|
||||
const factory BrowseEvent.getSearchHistory() = _GetSearchHistory;
|
||||
|
||||
const factory BrowseEvent.focusChanged(bool? isActive) = _FocusChanged;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
part of 'browse_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class BrowseState with _$BrowseState {
|
||||
const factory BrowseState({
|
||||
@Default(RequestStatus.initial) RequestStatus topCategorySt,
|
||||
@Default(RequestStatus.initial) RequestStatus allCategorySt,
|
||||
@Default(RequestStatus.initial) RequestStatus searchHistorySt,
|
||||
@Default([]) List<String> searchHistory,
|
||||
@Default(false) bool isActive,
|
||||
}) = _BrowseState;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class BrowsePage extends StatelessWidget {
|
||||
const BrowsePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => sl<BrowseBloc>()
|
||||
..add(BrowseEvent.getTopCategories())
|
||||
..add(BrowseEvent.getAllCategories()),
|
||||
child: WLayout(child: Scaffold(body: WBrowseBody())),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WAllCategories extends StatelessWidget {
|
||||
const WAllCategories({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<BrowseBloc, BrowseState>(
|
||||
builder: (context, state) {
|
||||
if (state.allCategorySt.isLoaded()) {
|
||||
return WAllCategoriesBody();
|
||||
}
|
||||
return WAllCategoriesSkeletonizer();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class WAllCategoriesBody extends StatelessWidget {
|
||||
const WAllCategoriesBody({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
25.verticalSpace,
|
||||
Text(
|
||||
context.loc.allCategories,
|
||||
style: AppTextStyles.size24Medium.copyWith(height: 36 / 24),
|
||||
),
|
||||
11.verticalSpace,
|
||||
GridView.builder(
|
||||
itemCount: 10,
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 15,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisExtent: 175,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return WBrowseItem();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WAllCategoriesSkeletonizer extends StatelessWidget {
|
||||
const WAllCategoriesSkeletonizer({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Skeletonizer(
|
||||
enabled: true,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
25.verticalSpace,
|
||||
Text(
|
||||
context.loc.allCategories,
|
||||
style: AppTextStyles.size24Medium.copyWith(height: 36 / 24),
|
||||
),
|
||||
11.verticalSpace,
|
||||
GridView.builder(
|
||||
itemCount: 10,
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 15,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisExtent: 140,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return WBrowseSkeletonizerItem();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WBrowseBody extends StatefulWidget {
|
||||
const WBrowseBody({super.key});
|
||||
|
||||
@override
|
||||
State<WBrowseBody> createState() => _WBrowseBodyState();
|
||||
}
|
||||
|
||||
class _WBrowseBodyState extends State<WBrowseBody> {
|
||||
late FocusNode _focusNode;
|
||||
late TextEditingController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = TextEditingController();
|
||||
_focusNode = FocusNode();
|
||||
_focusNode.addListener(() {
|
||||
context.read<BrowseBloc>().add(BrowseEvent.focusChanged(true));
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void listener() {
|
||||
_focusNode.addListener(() {
|
||||
log("${_focusNode.hasFocus}");
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
_focusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<BrowseBloc, BrowseState>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(color: AppColors.cFFFFFF),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
10.verticalSpace,
|
||||
Row(
|
||||
spacing: 15,
|
||||
children: [
|
||||
/*
|
||||
InkWell(
|
||||
onTap: () {},
|
||||
borderRadius: AppUtils.kBorderRadius25,
|
||||
child: Ink(
|
||||
height: 44,
|
||||
width: 44,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cEEEEEE,
|
||||
borderRadius: AppUtils.kBorderRadius25,
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 44,
|
||||
width: 44,
|
||||
child: SvgPicture.asset(
|
||||
AppIcons.icBack,
|
||||
height: 20,
|
||||
width: 20,
|
||||
).paddingAll(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
*/
|
||||
Expanded(
|
||||
child: AppTextFormField(
|
||||
focusNode: _focusNode,
|
||||
controller: _controller,
|
||||
prefixIcon: SvgPicture.asset(AppIcons.icSearch),
|
||||
hintText: context.loc.categoriesShort,
|
||||
hintTextStyle: AppTextStyles.size16Medium.copyWith(
|
||||
color: AppColors.c660000,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
15.verticalSpace,
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: RefreshIndicator.adaptive(
|
||||
onRefresh: () async {
|
||||
context.read<BrowseBloc>()
|
||||
..add(BrowseEvent.getTopCategories())
|
||||
..add(BrowseEvent.getAllCategories());
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
WTopCategories(),
|
||||
WAllCategories(),
|
||||
40.verticalSpace,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
).paddingSymmetric(horizontal: 16);
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WBrowseItem extends StatelessWidget {
|
||||
const WBrowseItem({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Bounceable(
|
||||
onTap: () {},
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cFFFFFF,
|
||||
borderRadius: AppUtils.kBorderRadius15,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: AppUtils.kBorderRadiusTop15,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: AppLocaleKeys.foodImageUrl,
|
||||
width: context.w,
|
||||
height:120,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: context.w,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: AppUtils.kBorderRadiusBottom15,
|
||||
border: Border.all(
|
||||
color: AppColors.cE8E8E8,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentGeometry.center,
|
||||
child: Text(
|
||||
"Restaurant",
|
||||
textAlign: TextAlign.center,
|
||||
style: AppTextStyles.size16Regular.copyWith(
|
||||
height: 20 / 16,
|
||||
),
|
||||
).paddingSymmetric(horizontal: 30,vertical:5),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WBrowseSkeletonizerItem extends StatelessWidget {
|
||||
const WBrowseSkeletonizerItem({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Bounceable(
|
||||
onTap: () {},
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cFFFFFF,
|
||||
borderRadius: AppUtils.kBorderRadius15,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: AppUtils.kBorderRadiusTop15,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: AppLocaleKeys.foodImageUrl,
|
||||
width: context.w,
|
||||
height: 96,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: context.w,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: AppUtils.kBorderRadiusBottom15,
|
||||
border: Border.all(
|
||||
color: AppColors.cE6E6E6,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
"Restaurant Rewards",
|
||||
textAlign: TextAlign.center,
|
||||
style: AppTextStyles.size16Regular.copyWith(
|
||||
height: 20 / 16,
|
||||
),
|
||||
).paddingSymmetric(horizontal: 30),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WTopCategories extends StatelessWidget {
|
||||
const WTopCategories({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<BrowseBloc, BrowseState>(
|
||||
builder: (context, state) {
|
||||
if (state.topCategorySt.isLoaded()) {
|
||||
return WTopCategoriesBody();
|
||||
}
|
||||
return WTopCategoriesSkeletonizer();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class WTopCategoriesBody extends StatelessWidget {
|
||||
const WTopCategoriesBody({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
context.loc.topCategories,
|
||||
style: AppTextStyles.size24Medium.copyWith(height: 36 / 24),
|
||||
),
|
||||
11.verticalSpace,
|
||||
GridView.builder(
|
||||
itemCount: 6,
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 15,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisExtent: 175,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return WBrowseItem();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WTopCategoriesSkeletonizer extends StatelessWidget {
|
||||
const WTopCategoriesSkeletonizer({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Skeletonizer(
|
||||
enabled: true,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
context.loc.topCategories,
|
||||
style: AppTextStyles.size24Medium.copyWith(height: 36 / 24),
|
||||
),
|
||||
11.verticalSpace,
|
||||
GridView.builder(
|
||||
itemCount: 6,
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 15,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisExtent: 140,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return WBrowseSkeletonizerItem();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class AppListTile extends StatelessWidget {
|
||||
const AppListTile({
|
||||
super.key,
|
||||
required this.onPressed,
|
||||
required this.isSelected,
|
||||
required this.svgPath,
|
||||
required this.title,
|
||||
this.contentPadding,
|
||||
this.leading,
|
||||
this.titleWidget,
|
||||
this.trailing,
|
||||
this.titleTextStyle,
|
||||
this.subTitle,
|
||||
});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
final bool isSelected;
|
||||
final String svgPath;
|
||||
final String title;
|
||||
final EdgeInsets? contentPadding;
|
||||
final Widget? leading;
|
||||
final Widget? titleWidget;
|
||||
final Widget? trailing;
|
||||
final TextStyle? titleTextStyle;
|
||||
final Widget? subTitle;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
onTap: onPressed,
|
||||
subtitle: subTitle,
|
||||
contentPadding:
|
||||
contentPadding ?? EdgeInsetsGeometry.only(left: 20, right: 27),
|
||||
leading:leading ?? SvgPicture.asset(svgPath),
|
||||
title:
|
||||
titleWidget ??
|
||||
Text(title, style: titleTextStyle ?? AppTextStyles.size16Regular),
|
||||
trailing:
|
||||
trailing ?? (isSelected ? SvgPicture.asset(AppIcons.icCheck) : null),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter_bounceable/flutter_bounceable.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:food_delivery_client/feature/common/presentation/widgets/w_cached_network_image.dart';
|
||||
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WFoodItem extends StatelessWidget {
|
||||
const WFoodItem({
|
||||
super.key,
|
||||
this.imageHeight,
|
||||
this.textStyle1,
|
||||
this.textStyle2,
|
||||
this.enableTag = false,
|
||||
});
|
||||
|
||||
final double? imageHeight;
|
||||
final TextStyle? textStyle1;
|
||||
final TextStyle? textStyle2;
|
||||
final bool enableTag;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Bounceable(
|
||||
onTap: () {},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// CachedNetworkImage(
|
||||
// imageUrl: AppLocaleKeys.imageUrl,
|
||||
// width: 200,
|
||||
// height: 155,
|
||||
// fit: BoxFit.cover,
|
||||
// placeholder: (context, url) => CircularProgressIndicator(),
|
||||
// errorWidget: (context, url, error) => Icon(Icons.error),
|
||||
//
|
||||
// ),
|
||||
SizedBox(
|
||||
height: imageHeight ?? 155,
|
||||
width: context.w,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: WCachedNetworkImage(imageUrl: AppLocaleKeys.imageUrl),
|
||||
),
|
||||
// Positioned.fill(
|
||||
// child: CachedNetworkImage(
|
||||
// imageUrl: AppLocaleKeys.imageUrl,
|
||||
// width: 200,
|
||||
// height: 155,
|
||||
// fit: BoxFit.cover,
|
||||
// placeholder: (context, url) =>
|
||||
// Center(child: CircularProgressIndicator.adaptive()),
|
||||
// errorWidget: (context, url, error) => Icon(Icons.error),
|
||||
// ),
|
||||
// ),
|
||||
Positioned(
|
||||
top: 10,
|
||||
right: 8,
|
||||
left: 0,
|
||||
child: Row(
|
||||
children: [
|
||||
if (enableTag)
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.c34A853,
|
||||
borderRadius: AppUtils.kBorderRadiusTop20Bottom20,
|
||||
),
|
||||
child: Text(
|
||||
"5 orders until \$8 reward",
|
||||
style: AppTextStyles.size14Medium.copyWith(
|
||||
color: AppColors.cFFFFFF,
|
||||
),
|
||||
).paddingOnly(top: 2, bottom: 2, left: 20, right: 40),
|
||||
),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: SvgPicture.asset(AppIcons.icDislike),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
8.verticalSpace,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Adenine Kitchen",
|
||||
style: textStyle1 ?? AppTextStyles.size16Medium,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 24,
|
||||
width: 24,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cEEEEEE,
|
||||
borderRadius: AppUtils.kBorderRadius28,
|
||||
),
|
||||
child: Center(
|
||||
child: Text("4.4", style: AppTextStyles.size12Regular),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// RichText(
|
||||
// text: TextSpan(
|
||||
// text: "\$0.29 Delivery Fee",
|
||||
// children: [TextSpan(text: "10-25 min")],
|
||||
// style: AppTextStyles.size14Regular.copyWith(
|
||||
// color: AppColors.c6B6B6B,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"\$0.29 Delivery Fee",
|
||||
style:
|
||||
textStyle2 ??
|
||||
AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
5.horizontalSpace,
|
||||
Icon(Icons.circle, size: 5, color: AppColors.c6B6B6B),
|
||||
5.horizontalSpace,
|
||||
Text(
|
||||
"10-25 min",
|
||||
style:
|
||||
textStyle2 ??
|
||||
AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 15),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,13 @@ import '../../../../food_delivery_client.dart';
|
||||
class WLayout extends StatelessWidget {
|
||||
const WLayout({
|
||||
super.key,
|
||||
this.bgColor = AppColors.cFFFFFF,
|
||||
this.bgColor,
|
||||
this.bottom = true,
|
||||
this.top = true,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
final Color bgColor;
|
||||
final Color? bgColor;
|
||||
final bool bottom;
|
||||
final bool top;
|
||||
final Widget child;
|
||||
@@ -17,7 +17,7 @@ class WLayout extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: bgColor,
|
||||
color: bgColor ?? context.theme.scaffoldBackgroundColor,
|
||||
child: SafeArea(top: top, bottom: bottom, child: child),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export 'w_layout.dart';
|
||||
export 'w_food_item.dart';
|
||||
export 'w_divider.dart';
|
||||
export 'w_see_all_raw.dart';
|
||||
export 'w_stories_list_item.dart';
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
export 'presentation/pages/home_page/home_page.dart';
|
||||
export 'presentation/blocs/home_bloc/home_bloc.dart';
|
||||
export 'presentation/pages/home_page/widgets/w_home_headers.dart';
|
||||
export 'presentation/widgets/w_category_item.dart';
|
||||
export "presentation/pages/home_page/widgets/w_categories_header_item.dart";
|
||||
export 'presentation/pages/home_page/widgets/w_delivery_header.dart';
|
||||
export 'presentation/pages/home_page/widgets/w_discount_part.dart';
|
||||
export 'presentation/pages/home_page/widgets/w_offers_carouseL_slider.dart';
|
||||
export 'presentation/pages/home_page/widgets/w_popular_near_you.dart';
|
||||
export 'presentation/pages/home_page/widgets/w_todays_offers.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/home_page/widgets/pick_it_for_free.dart';
|
||||
export 'package:flutter_svg/flutter_svg.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/categories_page/categories_page.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/home_page/widgets/w_rating_btm_sheet.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/filters_page/filters_page.dart';
|
||||
export 'presentation/mixins/filter_mixins.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/filters_page/widgets/w_filter_app_bar.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/filters_page/widgets/w_filters_body.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/filters_page/widgets/w_delivery_duration.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/filters_page/widgets/w_filter_dietary.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/filters_page/widgets/w_filters_deals.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/filters_page/widgets/w_filters_sort.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/restaurants_by_category_page/widgets/w_restaurants_by_category_body.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/restaurants_by_category_page/widgets/w_featured_stores.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/restaurants_by_category_page/widgets/w_stores_list.dart';
|
||||
@@ -1,40 +0,0 @@
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
part 'home_event.dart';
|
||||
|
||||
part 'home_state.dart';
|
||||
|
||||
part 'home_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
HomeBloc() : super(const HomeState()) {
|
||||
on<_Changed>(_onChanged);
|
||||
on<_Filtered>(_onFiltered);
|
||||
on<_Rated>(_onRated);
|
||||
on<_DurationChanged>(_onDurationChanged);
|
||||
}
|
||||
|
||||
void _onChanged(_Changed event, Emitter<HomeState> emit) {
|
||||
emit(state.copyWith(currentIndex: event.index));
|
||||
}
|
||||
|
||||
void _onFiltered(_Filtered event, Emitter<HomeState> emit) {
|
||||
final oldFilters = List.from(state.filters);
|
||||
if (oldFilters.contains(event.filter)) {
|
||||
final newFilters = oldFilters..remove(event.filter);
|
||||
emit(state.copyWith(filters: newFilters));
|
||||
} else {
|
||||
final newFilters = oldFilters..add(event.filter);
|
||||
emit(state.copyWith(filters: newFilters));
|
||||
}
|
||||
}
|
||||
|
||||
void _onRated(_Rated event, Emitter<HomeState> emit) {
|
||||
emit(state.copyWith(rating: event.filter));
|
||||
}
|
||||
|
||||
void _onDurationChanged(_DurationChanged event, Emitter<HomeState> emit) {
|
||||
emit(state.copyWith(deliveryDuration: event.filter));
|
||||
}
|
||||
}
|
||||
@@ -1,778 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'home_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$HomeEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is HomeEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $HomeEventCopyWith<$Res> {
|
||||
$HomeEventCopyWith(HomeEvent _, $Res Function(HomeEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [HomeEvent].
|
||||
extension HomeEventPatterns on HomeEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,TResult Function( _Changed value)? changed,TResult Function( _DurationChanged value)? durationChanged,TResult Function( _Filtered value)? filtered,TResult Function( _Rated value)? rated,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Changed() when changed != null:
|
||||
return changed(_that);case _DurationChanged() when durationChanged != null:
|
||||
return durationChanged(_that);case _Filtered() when filtered != null:
|
||||
return filtered(_that);case _Rated() when rated != null:
|
||||
return rated(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,required TResult Function( _Changed value) changed,required TResult Function( _DurationChanged value) durationChanged,required TResult Function( _Filtered value) filtered,required TResult Function( _Rated value) rated,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _Changed():
|
||||
return changed(_that);case _DurationChanged():
|
||||
return durationChanged(_that);case _Filtered():
|
||||
return filtered(_that);case _Rated():
|
||||
return rated(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,TResult? Function( _Changed value)? changed,TResult? Function( _DurationChanged value)? durationChanged,TResult? Function( _Filtered value)? filtered,TResult? Function( _Rated value)? rated,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Changed() when changed != null:
|
||||
return changed(_that);case _DurationChanged() when durationChanged != null:
|
||||
return durationChanged(_that);case _Filtered() when filtered != null:
|
||||
return filtered(_that);case _Rated() when rated != null:
|
||||
return rated(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,TResult Function( int index)? changed,TResult Function( String filter)? durationChanged,TResult Function( String filter)? filtered,TResult Function( List<String> filter)? rated,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Changed() when changed != null:
|
||||
return changed(_that.index);case _DurationChanged() when durationChanged != null:
|
||||
return durationChanged(_that.filter);case _Filtered() when filtered != null:
|
||||
return filtered(_that.filter);case _Rated() when rated != null:
|
||||
return rated(_that.filter);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,required TResult Function( int index) changed,required TResult Function( String filter) durationChanged,required TResult Function( String filter) filtered,required TResult Function( List<String> filter) rated,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _Changed():
|
||||
return changed(_that.index);case _DurationChanged():
|
||||
return durationChanged(_that.filter);case _Filtered():
|
||||
return filtered(_that.filter);case _Rated():
|
||||
return rated(_that.filter);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,TResult? Function( int index)? changed,TResult? Function( String filter)? durationChanged,TResult? Function( String filter)? filtered,TResult? Function( List<String> filter)? rated,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Changed() when changed != null:
|
||||
return changed(_that.index);case _DurationChanged() when durationChanged != null:
|
||||
return durationChanged(_that.filter);case _Filtered() when filtered != null:
|
||||
return filtered(_that.filter);case _Rated() when rated != null:
|
||||
return rated(_that.filter);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements HomeEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Changed implements HomeEvent {
|
||||
const _Changed(this.index);
|
||||
|
||||
|
||||
final int index;
|
||||
|
||||
/// Create a copy of HomeEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ChangedCopyWith<_Changed> get copyWith => __$ChangedCopyWithImpl<_Changed>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Changed&&(identical(other.index, index) || other.index == index));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,index);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeEvent.changed(index: $index)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ChangedCopyWith<$Res> implements $HomeEventCopyWith<$Res> {
|
||||
factory _$ChangedCopyWith(_Changed value, $Res Function(_Changed) _then) = __$ChangedCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int index
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ChangedCopyWithImpl<$Res>
|
||||
implements _$ChangedCopyWith<$Res> {
|
||||
__$ChangedCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Changed _self;
|
||||
final $Res Function(_Changed) _then;
|
||||
|
||||
/// Create a copy of HomeEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? index = null,}) {
|
||||
return _then(_Changed(
|
||||
null == index ? _self.index : index // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _DurationChanged implements HomeEvent {
|
||||
const _DurationChanged(this.filter);
|
||||
|
||||
|
||||
final String filter;
|
||||
|
||||
/// Create a copy of HomeEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$DurationChangedCopyWith<_DurationChanged> get copyWith => __$DurationChangedCopyWithImpl<_DurationChanged>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _DurationChanged&&(identical(other.filter, filter) || other.filter == filter));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,filter);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeEvent.durationChanged(filter: $filter)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$DurationChangedCopyWith<$Res> implements $HomeEventCopyWith<$Res> {
|
||||
factory _$DurationChangedCopyWith(_DurationChanged value, $Res Function(_DurationChanged) _then) = __$DurationChangedCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String filter
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$DurationChangedCopyWithImpl<$Res>
|
||||
implements _$DurationChangedCopyWith<$Res> {
|
||||
__$DurationChangedCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _DurationChanged _self;
|
||||
final $Res Function(_DurationChanged) _then;
|
||||
|
||||
/// Create a copy of HomeEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? filter = null,}) {
|
||||
return _then(_DurationChanged(
|
||||
null == filter ? _self.filter : filter // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Filtered implements HomeEvent {
|
||||
const _Filtered(this.filter);
|
||||
|
||||
|
||||
final String filter;
|
||||
|
||||
/// Create a copy of HomeEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$FilteredCopyWith<_Filtered> get copyWith => __$FilteredCopyWithImpl<_Filtered>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Filtered&&(identical(other.filter, filter) || other.filter == filter));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,filter);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeEvent.filtered(filter: $filter)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$FilteredCopyWith<$Res> implements $HomeEventCopyWith<$Res> {
|
||||
factory _$FilteredCopyWith(_Filtered value, $Res Function(_Filtered) _then) = __$FilteredCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String filter
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$FilteredCopyWithImpl<$Res>
|
||||
implements _$FilteredCopyWith<$Res> {
|
||||
__$FilteredCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Filtered _self;
|
||||
final $Res Function(_Filtered) _then;
|
||||
|
||||
/// Create a copy of HomeEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? filter = null,}) {
|
||||
return _then(_Filtered(
|
||||
null == filter ? _self.filter : filter // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Rated implements HomeEvent {
|
||||
const _Rated(final List<String> filter): _filter = filter;
|
||||
|
||||
|
||||
final List<String> _filter;
|
||||
List<String> get filter {
|
||||
if (_filter is EqualUnmodifiableListView) return _filter;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_filter);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of HomeEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$RatedCopyWith<_Rated> get copyWith => __$RatedCopyWithImpl<_Rated>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Rated&&const DeepCollectionEquality().equals(other._filter, _filter));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_filter));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeEvent.rated(filter: $filter)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$RatedCopyWith<$Res> implements $HomeEventCopyWith<$Res> {
|
||||
factory _$RatedCopyWith(_Rated value, $Res Function(_Rated) _then) = __$RatedCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
List<String> filter
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$RatedCopyWithImpl<$Res>
|
||||
implements _$RatedCopyWith<$Res> {
|
||||
__$RatedCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Rated _self;
|
||||
final $Res Function(_Rated) _then;
|
||||
|
||||
/// Create a copy of HomeEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? filter = null,}) {
|
||||
return _then(_Rated(
|
||||
null == filter ? _self._filter : filter // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$HomeState {
|
||||
|
||||
int get currentIndex; String get deliveryDuration; List get filters; List<String> get rating;
|
||||
/// Create a copy of HomeState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$HomeStateCopyWith<HomeState> get copyWith => _$HomeStateCopyWithImpl<HomeState>(this as HomeState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is HomeState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.deliveryDuration, deliveryDuration) || other.deliveryDuration == deliveryDuration)&&const DeepCollectionEquality().equals(other.filters, filters)&&const DeepCollectionEquality().equals(other.rating, rating));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,currentIndex,deliveryDuration,const DeepCollectionEquality().hash(filters),const DeepCollectionEquality().hash(rating));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeState(currentIndex: $currentIndex, deliveryDuration: $deliveryDuration, filters: $filters, rating: $rating)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $HomeStateCopyWith<$Res> {
|
||||
factory $HomeStateCopyWith(HomeState value, $Res Function(HomeState) _then) = _$HomeStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int currentIndex, String deliveryDuration, List filters, List<String> rating
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$HomeStateCopyWithImpl<$Res>
|
||||
implements $HomeStateCopyWith<$Res> {
|
||||
_$HomeStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final HomeState _self;
|
||||
final $Res Function(HomeState) _then;
|
||||
|
||||
/// Create a copy of HomeState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? currentIndex = null,Object? deliveryDuration = null,Object? filters = null,Object? rating = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,deliveryDuration: null == deliveryDuration ? _self.deliveryDuration : deliveryDuration // ignore: cast_nullable_to_non_nullable
|
||||
as String,filters: null == filters ? _self.filters : filters // ignore: cast_nullable_to_non_nullable
|
||||
as List,rating: null == rating ? _self.rating : rating // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [HomeState].
|
||||
extension HomeStatePatterns on HomeState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _HomeState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _HomeState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _HomeState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int currentIndex, String deliveryDuration, List filters, List<String> rating)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState() when $default != null:
|
||||
return $default(_that.currentIndex,_that.deliveryDuration,_that.filters,_that.rating);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int currentIndex, String deliveryDuration, List filters, List<String> rating) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState():
|
||||
return $default(_that.currentIndex,_that.deliveryDuration,_that.filters,_that.rating);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int currentIndex, String deliveryDuration, List filters, List<String> rating)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState() when $default != null:
|
||||
return $default(_that.currentIndex,_that.deliveryDuration,_that.filters,_that.rating);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _HomeState implements HomeState {
|
||||
const _HomeState({this.currentIndex = 0, this.deliveryDuration = "60+", final List filters = const [], final List<String> rating = const []}): _filters = filters,_rating = rating;
|
||||
|
||||
|
||||
@override@JsonKey() final int currentIndex;
|
||||
@override@JsonKey() final String deliveryDuration;
|
||||
final List _filters;
|
||||
@override@JsonKey() List get filters {
|
||||
if (_filters is EqualUnmodifiableListView) return _filters;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_filters);
|
||||
}
|
||||
|
||||
final List<String> _rating;
|
||||
@override@JsonKey() List<String> get rating {
|
||||
if (_rating is EqualUnmodifiableListView) return _rating;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_rating);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of HomeState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$HomeStateCopyWith<_HomeState> get copyWith => __$HomeStateCopyWithImpl<_HomeState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _HomeState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.deliveryDuration, deliveryDuration) || other.deliveryDuration == deliveryDuration)&&const DeepCollectionEquality().equals(other._filters, _filters)&&const DeepCollectionEquality().equals(other._rating, _rating));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,currentIndex,deliveryDuration,const DeepCollectionEquality().hash(_filters),const DeepCollectionEquality().hash(_rating));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeState(currentIndex: $currentIndex, deliveryDuration: $deliveryDuration, filters: $filters, rating: $rating)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$HomeStateCopyWith<$Res> implements $HomeStateCopyWith<$Res> {
|
||||
factory _$HomeStateCopyWith(_HomeState value, $Res Function(_HomeState) _then) = __$HomeStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int currentIndex, String deliveryDuration, List filters, List<String> rating
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$HomeStateCopyWithImpl<$Res>
|
||||
implements _$HomeStateCopyWith<$Res> {
|
||||
__$HomeStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _HomeState _self;
|
||||
final $Res Function(_HomeState) _then;
|
||||
|
||||
/// Create a copy of HomeState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? currentIndex = null,Object? deliveryDuration = null,Object? filters = null,Object? rating = null,}) {
|
||||
return _then(_HomeState(
|
||||
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,deliveryDuration: null == deliveryDuration ? _self.deliveryDuration : deliveryDuration // ignore: cast_nullable_to_non_nullable
|
||||
as String,filters: null == filters ? _self._filters : filters // ignore: cast_nullable_to_non_nullable
|
||||
as List,rating: null == rating ? _self._rating : rating // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -1,11 +0,0 @@
|
||||
part of 'home_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class HomeEvent with _$HomeEvent {
|
||||
const factory HomeEvent.started() = _Started;
|
||||
const factory HomeEvent.changed(int index) = _Changed;
|
||||
const factory HomeEvent.durationChanged(String filter) = _DurationChanged;
|
||||
const factory HomeEvent.filtered(String filter) = _Filtered;
|
||||
const factory HomeEvent.rated(List<String> filter) = _Rated;
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
part of 'home_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class HomeState with _$HomeState {
|
||||
const factory HomeState({
|
||||
@Default(0) int currentIndex,
|
||||
@Default("60+") String deliveryDuration,
|
||||
@Default([]) List filters,
|
||||
@Default([]) List<String> rating
|
||||
|
||||
}) = _HomeState;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import 'package:food_delivery_client/core/core.dart';
|
||||
|
||||
mixin CategoriesMixin {
|
||||
List<String> images = [
|
||||
AppImages.imgConvenience,
|
||||
AppImages.imgAlcohol,
|
||||
AppImages.imgPetSupplies,
|
||||
AppImages.imgFlowers,
|
||||
AppImages.imgGrocery,
|
||||
AppImages.imgAmerican,
|
||||
AppImages.imgSpeciality,
|
||||
AppImages.imgTakeout,
|
||||
AppImages.imgAsian,
|
||||
AppImages.imgIceCream,
|
||||
AppImages.imgHalal,
|
||||
AppImages.imgRetails,
|
||||
AppImages.imgCarribean,
|
||||
AppImages.imgIndian,
|
||||
AppImages.imgFrench,
|
||||
AppImages.imgFastFoods,
|
||||
AppImages.imgBurger,
|
||||
AppImages.imgRide,
|
||||
AppImages.imgChinese,
|
||||
AppImages.imgDesert,
|
||||
];
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import '../../../../core/theme/app_icons.dart';
|
||||
|
||||
mixin FilterMixins {
|
||||
final List<String> deliveryDurations = ["30", "45", "60", "60+"];
|
||||
final List<String> filterSortSvgs = [
|
||||
AppIcons.icPicked,
|
||||
AppIcons.icMostPopular,
|
||||
AppIcons.icStar,
|
||||
AppIcons.icDeliveryTime,
|
||||
];
|
||||
|
||||
final List<String> filterDietary = [
|
||||
AppIcons.icVegetarian,
|
||||
AppIcons.icVegen,
|
||||
AppIcons.icGlutenFree,
|
||||
AppIcons.icAllergyFriendly,
|
||||
];
|
||||
|
||||
final List<String> filterDeals = [AppIcons.icDeals, AppIcons.icBestOverall];
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
mixin HomePageMixins {
|
||||
static const headers = [];
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
import 'package:food_delivery_client/feature/home/presentation/mixins/categories_mixin.dart';
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class CategoriesPage extends StatelessWidget with CategoriesMixin {
|
||||
CategoriesPage({super.key});
|
||||
|
||||
show(BuildContext context) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
|
||||
builder: (context) => Wrap(children: [this]),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String> _titles = [
|
||||
context.loc.convenience,
|
||||
context.loc.alcohol,
|
||||
context.loc.petSupplies,
|
||||
context.loc.flowers,
|
||||
context.loc.grocery,
|
||||
context.loc.american,
|
||||
context.loc.speciality,
|
||||
context.loc.takeout,
|
||||
context.loc.asian,
|
||||
context.loc.iceCream,
|
||||
context.loc.halal,
|
||||
context.loc.retails,
|
||||
context.loc.caribbean,
|
||||
context.loc.indian,
|
||||
context.loc.french,
|
||||
context.loc.fastFoods,
|
||||
context.loc.burger,
|
||||
context.loc.ride,
|
||||
context.loc.chinese,
|
||||
context.loc.dessert,
|
||||
];
|
||||
return Material(
|
||||
color: AppColors.cFFFFFF,
|
||||
borderRadius: AppUtils.kBorderRadius20,
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
24.verticalSpace,
|
||||
Text(context.loc.allCategories, style: AppTextStyles.size20Regular),
|
||||
30.verticalSpace,
|
||||
GridView.builder(
|
||||
itemCount: images.length,
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
crossAxisSpacing: 5,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 78 / 100,
|
||||
),
|
||||
itemBuilder: (context, index) => WCategoryItem(
|
||||
onTap: () {
|
||||
context.push(
|
||||
Routes.restaurantsByCategory,
|
||||
extra: _titles[index],
|
||||
);
|
||||
},
|
||||
imgUrl: images[index],
|
||||
text: _titles[index],
|
||||
),
|
||||
),
|
||||
40.verticalSpace,
|
||||
],
|
||||
).paddingSymmetric(horizontal: 15),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class FiltersPage extends StatefulWidget {
|
||||
const FiltersPage({super.key, required this.homeBloc});
|
||||
|
||||
final HomeBloc homeBloc;
|
||||
|
||||
@override
|
||||
State<FiltersPage> createState() => _FiltersPageState();
|
||||
}
|
||||
|
||||
class _FiltersPageState extends State<FiltersPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider.value(
|
||||
value: widget.homeBloc,
|
||||
child: BlocBuilder<HomeBloc, HomeState>(
|
||||
builder: (context, state) {
|
||||
return WFiltersBody();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WDeliveryDuration extends StatelessWidget with FilterMixins {
|
||||
WDeliveryDuration({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<HomeBloc, HomeState>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
context.loc.delivery,
|
||||
style: AppTextStyles.size18Medium,
|
||||
).paddingSymmetric(horizontal: 20),
|
||||
15.verticalSpace,
|
||||
SizedBox(
|
||||
height: 60,
|
||||
child: Stack(
|
||||
alignment: AlignmentGeometry.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 40,
|
||||
width: context.w,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: AppUtils.kBorderRadius8,
|
||||
color: AppColors.cE6E6E6.newWithOpacity(.6),
|
||||
),
|
||||
),
|
||||
),
|
||||
Material(
|
||||
color: AppColors.cTransparent,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: List.generate(deliveryDurations.length, (
|
||||
index,
|
||||
) {
|
||||
final isActive =
|
||||
state.deliveryDuration == deliveryDurations[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
context.read<HomeBloc>().add(
|
||||
HomeEvent.durationChanged(
|
||||
deliveryDurations[index],
|
||||
),
|
||||
);
|
||||
},
|
||||
borderRadius: AppUtils.kBorderRadius40,
|
||||
child: Ink(
|
||||
height: 60,
|
||||
width: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: isActive
|
||||
? AppColors.c34A853
|
||||
: AppColors.cTransparent,
|
||||
borderRadius: AppUtils.kBorderRadius40,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
deliveryDurations[index],
|
||||
style: AppTextStyles.size16Medium.copyWith(
|
||||
color: isActive
|
||||
? AppColors.cFFFFFF
|
||||
: AppColors.c000000,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
).paddingSymmetric(horizontal: 20),
|
||||
25.verticalSpace,
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WFiltersAppBar extends StatelessWidget {
|
||||
const WFiltersAppBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
centerTitle: true,
|
||||
elevation: 30,
|
||||
bottomOpacity: 1,
|
||||
scrolledUnderElevation: 10,
|
||||
backgroundColor: AppColors.cFFFFFF,
|
||||
surfaceTintColor: AppColors.cTransparent,
|
||||
useDefaultSemanticsOrder: true,
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
icon: SvgPicture.asset(AppIcons.icClose),
|
||||
),
|
||||
title: Text(context.loc.allCategories, style: AppTextStyles.size20Medium),
|
||||
);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user