forked from eatvio/eatvio_app
feat(order info): added order info screen
This commit is contained in:
@@ -9,11 +9,12 @@ import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/b
|
||||
import 'package:eatvio_app/features/calendar/presentation/pages/calendar_screen.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/chat_screen.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/chats_screen.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/payment_screen.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart';
|
||||
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/stepper_become_consultant_screen.dart';
|
||||
import 'package:eatvio_app/features/consultations/presentation/pages/consultations_screen.dart';
|
||||
import 'package:eatvio_app/features/consultations/presentation/pages/info_by_order_screen.dart';
|
||||
import 'package:eatvio_app/features/order_info/presentation/info_by_order_screen.dart';
|
||||
import 'package:eatvio_app/features/create_diet/presentation/create_diet_screen.dart';
|
||||
import 'package:eatvio_app/features/create_diet/presentation/diet_preview_screen.dart';
|
||||
import 'package:eatvio_app/features/create_plan/presentation/create_plan_screen.dart';
|
||||
@@ -34,6 +35,7 @@ import 'package:eatvio_app/features/my_finance/presentation/pages/user_finance_s
|
||||
import 'package:eatvio_app/features/my_plans/presentation/my_plans_screen.dart';
|
||||
import 'package:eatvio_app/features/notifications/presentation/pages/notifications_screen.dart';
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/plans/models/chosen_plan_model.dart';
|
||||
import 'package:eatvio_app/features/plans/presentation/pages/about_plan_screen.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/pages/profile_screen.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/pages/subs_screen.dart';
|
||||
@@ -77,9 +79,9 @@ class AppRouter {
|
||||
return BlocBuilder<ProfileAvatarCubit, ProfileAvatarState>(
|
||||
builder: (BuildContext context, ProfileAvatarState state) {
|
||||
if (state is ProfileAvatarStateLoaded) {
|
||||
return BottomNavigationBarWidget(child: child, profileModel: state.profile);
|
||||
return BottomNavigationBarWidget(profileModel: state.profile, child: child);
|
||||
}
|
||||
return SizedBox.shrink();
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
);
|
||||
},
|
||||
@@ -92,45 +94,50 @@ class AppRouter {
|
||||
return null;
|
||||
},
|
||||
pageBuilder: (context, state) {
|
||||
return NoTransitionPage(child: ProfileScreen());
|
||||
return const NoTransitionPage(child: ProfileScreen());
|
||||
},
|
||||
),
|
||||
GoRoute(path: '/feed-screen', name: 'feedScreen', pageBuilder: (context, state) => NoTransitionPage(child: FeedScreen())),
|
||||
GoRoute(path: '/diary-screen', name: 'diaryScreen', pageBuilder: (context, state) => NoTransitionPage(child: DiaryScreen())),
|
||||
GoRoute(path: '/consultations-screen', name: 'consultationsScreen', pageBuilder: (context, state) => NoTransitionPage(child: ConsultationsScreen())),
|
||||
GoRoute(path: '/chat-select-screen', name: 'chatSelectScreen', pageBuilder: (context, state) => NoTransitionPage(child: ChatsScreen())),
|
||||
GoRoute(path: '/notifications-screen', name: 'notificationsScreen', pageBuilder: (context, state) => NoTransitionPage(child: NotificationsScreen())),
|
||||
GoRoute(path: '/feed-screen', name: 'feedScreen', pageBuilder: (context, state) => const NoTransitionPage(child: FeedScreen())),
|
||||
GoRoute(path: '/diary-screen', name: 'diaryScreen', pageBuilder: (context, state) => const NoTransitionPage(child: DiaryScreen())),
|
||||
GoRoute(
|
||||
path: '/consultations-screen',
|
||||
name: 'consultationsScreen',
|
||||
pageBuilder: (context, state) => const NoTransitionPage(child: ConsultationsScreen())),
|
||||
GoRoute(path: '/chat-select-screen', name: 'chatSelectScreen', pageBuilder: (context, state) => const NoTransitionPage(child: ChatsScreen())),
|
||||
GoRoute(
|
||||
path: '/notifications-screen',
|
||||
name: 'notificationsScreen',
|
||||
pageBuilder: (context, state) => const NoTransitionPage(child: NotificationsScreen())),
|
||||
GoRoute(
|
||||
path: '/menu-screen',
|
||||
name: 'menuScreen',
|
||||
pageBuilder:
|
||||
(context, state) => NoTransitionPage(
|
||||
child: BlocBuilder<ProfileAvatarCubit, ProfileAvatarState>(
|
||||
builder: (BuildContext context, ProfileAvatarState state) {
|
||||
if (state is ProfileAvatarStateLoaded) {
|
||||
return MenuScreen(profileModel: state.profile);
|
||||
}
|
||||
return SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
),
|
||||
pageBuilder: (context, state) => NoTransitionPage(
|
||||
child: BlocBuilder<ProfileAvatarCubit, ProfileAvatarState>(
|
||||
builder: (BuildContext context, ProfileAvatarState state) {
|
||||
if (state is ProfileAvatarStateLoaded) {
|
||||
return MenuScreen(profileModel: state.profile);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
GoRoute(
|
||||
path: '/consultant-finance-screen',
|
||||
name: 'consultantFinanceScreen',
|
||||
builder: (context, state) => ConsultantFinanceScreen(),
|
||||
builder: (context, state) => const ConsultantFinanceScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/user-finance-screen',
|
||||
name: 'userFinanceScreen',
|
||||
builder: (context, state) => UserFinanceScreen(),
|
||||
builder: (context, state) => const UserFinanceScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: CardSettingsScreen.path,
|
||||
name: CardSettingsScreen.name,
|
||||
builder: (context, state) => CardSettingsScreen(),
|
||||
builder: (context, state) => const CardSettingsScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/about-plan-screen',
|
||||
@@ -140,7 +147,7 @@ class AppRouter {
|
||||
return AboutPlanScreen(plan: data['plan'] as PlanModel, index: data['index'] as int?, navigateToComments: data['navigateToComments'] as bool);
|
||||
},
|
||||
),
|
||||
GoRoute(path: '/glossary-screen', name: 'glossaryScreen', builder: (context, state) => GlossaryScreen()),
|
||||
GoRoute(path: '/glossary-screen', name: 'glossaryScreen', builder: (context, state) => const GlossaryScreen()),
|
||||
GoRoute(
|
||||
path: '/about-recipes-screen',
|
||||
name: 'aboutRecipesScreen',
|
||||
@@ -149,7 +156,7 @@ class AppRouter {
|
||||
return AboutRecipeScreen(recipe: data['recipe'] as Recipe, index: data['index'] as int?, navigateToComments: data['navigateToComments'] as bool);
|
||||
},
|
||||
),
|
||||
GoRoute(path: RecipeCreateScreen.path, name: RecipeCreateScreen.name, builder: (context, state) => RecipeCreateScreen()),
|
||||
GoRoute(path: RecipeCreateScreen.path, name: RecipeCreateScreen.name, builder: (context, state) => const RecipeCreateScreen()),
|
||||
GoRoute(path: '/profile-screen', name: 'profileScreen', builder: (context, state) => ProfileScreen(author: state.extra as Author)),
|
||||
GoRoute(
|
||||
path: '/subs-screen/:slug',
|
||||
@@ -182,7 +189,7 @@ class AppRouter {
|
||||
GoRoute(
|
||||
path: '/settings-screen',
|
||||
name: 'settingsScreen',
|
||||
builder: (context, state) => SettingsScreen(),
|
||||
builder: (context, state) => const SettingsScreen(),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: 'general-info-screen',
|
||||
@@ -217,10 +224,11 @@ class AppRouter {
|
||||
),
|
||||
],
|
||||
),
|
||||
GoRoute(path: '/become-consultant-screen', name: 'becomeConsultantScreen', builder: (context, state) => BecomeConsultantScreen()),
|
||||
GoRoute(path: '/stepper-become-consultant-screen', name: 'stepperBecomeConsultantScreen', builder: (context, state) => StepperBecomeConsultantScreen()),
|
||||
GoRoute(path: '/calendar-screen', name: 'calendarScreen', builder: (context, state) => CalendarScreen()),
|
||||
GoRoute(path: '/support-screen', name: 'supportScreen', builder: (context, state) => SupportScreen()),
|
||||
GoRoute(path: '/become-consultant-screen', name: 'becomeConsultantScreen', builder: (context, state) => const BecomeConsultantScreen()),
|
||||
GoRoute(
|
||||
path: '/stepper-become-consultant-screen', name: 'stepperBecomeConsultantScreen', builder: (context, state) => const StepperBecomeConsultantScreen()),
|
||||
GoRoute(path: '/calendar-screen', name: 'calendarScreen', builder: (context, state) => const CalendarScreen()),
|
||||
GoRoute(path: '/support-screen', name: 'supportScreen', builder: (context, state) => const SupportScreen()),
|
||||
GoRoute(
|
||||
path: '/photo-view-screen/:index',
|
||||
name: 'photoViewScreen',
|
||||
@@ -242,13 +250,24 @@ class AppRouter {
|
||||
return DietPreviewScreen(diet: data);
|
||||
},
|
||||
),
|
||||
GoRoute(path: CreatePlanScreen.path, name: CreatePlanScreen.name, builder: (context, state) => CreatePlanScreen()),
|
||||
GoRoute(path: MyDietsScreen.path, name: MyDietsScreen.name, builder: (context, state) => MyDietsScreen()),
|
||||
GoRoute(path: MyPlansScreen.path, name: MyPlansScreen.name, builder: (context, state) => MyPlansScreen()),
|
||||
GoRoute(path: CreatePlanScreen.path, name: CreatePlanScreen.name, builder: (context, state) => const CreatePlanScreen()),
|
||||
GoRoute(path: MyDietsScreen.path, name: MyDietsScreen.name, builder: (context, state) => const MyDietsScreen()),
|
||||
GoRoute(path: MyPlansScreen.path, name: MyPlansScreen.name, builder: (context, state) => const MyPlansScreen()),
|
||||
GoRoute(path: UserDetailsScreen.path, name: UserDetailsScreen.name, builder: (context, state) => UserDetailsScreen(slug: state.extra as String)),
|
||||
GoRoute(path: DevToolsScreen.path, name: DevToolsScreen.name, builder: (context, state) => DevToolsScreen()),
|
||||
GoRoute(path: ConsultantRatingScreen.path, name: ConsultantRatingScreen.name, builder: (context, state) => ConsultantRatingScreen()),
|
||||
GoRoute(path: InfoByOrderScreen.path, name: InfoByOrderScreen.name, builder: (context, state) => InfoByOrderScreen()),
|
||||
GoRoute(path: DevToolsScreen.path, name: DevToolsScreen.name, builder: (context, state) => const DevToolsScreen()),
|
||||
GoRoute(path: ConsultantRatingScreen.path, name: ConsultantRatingScreen.name, builder: (context, state) => const ConsultantRatingScreen()),
|
||||
GoRoute(
|
||||
path: InfoByOrderScreen.path,
|
||||
name: InfoByOrderScreen.name,
|
||||
builder: (context, state) => InfoByOrderScreen(
|
||||
plan: state.extra as ChosenPlanModel,
|
||||
)),
|
||||
GoRoute(
|
||||
path: PaymentScreen.path,
|
||||
name: PaymentScreen.name,
|
||||
builder: (context, state) => PaymentScreen(
|
||||
url: state.extra as String,
|
||||
)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
String baseUrl = 'https://eatvio.ru';
|
||||
// String baseUrl = 'https://dev2.eatvio.com';
|
||||
// String baseUrl = 'https://eatvio.ru';
|
||||
String baseUrl = 'https://dev2.eatvio.com';
|
||||
|
||||
const List<int> durationValues = [7, 14, 21];
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
abstract class CredentialsStorage {
|
||||
static Future<bool> haveCredentialsInStorage() async {
|
||||
try {
|
||||
if (await FlutterSecureStorage().read(key: 'email') == null || await FlutterSecureStorage().read(key: 'password') == null) {
|
||||
if (await const FlutterSecureStorage().read(key: 'email') == null || await const FlutterSecureStorage().read(key: 'password') == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -15,18 +15,18 @@ abstract class CredentialsStorage {
|
||||
|
||||
static Future<Map<String, String>> getCredentialsFromStorage() async {
|
||||
return {
|
||||
'email': (await FlutterSecureStorage().read(key: 'email'))!,
|
||||
'password': (await FlutterSecureStorage().read(key: 'password'))!,
|
||||
'email': (await const FlutterSecureStorage().read(key: 'email'))!,
|
||||
'password': (await const FlutterSecureStorage().read(key: 'password'))!,
|
||||
};
|
||||
}
|
||||
|
||||
static saveCredentials(String email, String password) async {
|
||||
await FlutterSecureStorage().write(key: 'email', value: email);
|
||||
await FlutterSecureStorage().write(key: 'password', value: password);
|
||||
await const FlutterSecureStorage().write(key: 'email', value: email);
|
||||
await const FlutterSecureStorage().write(key: 'password', value: password);
|
||||
}
|
||||
|
||||
static removeCredentials() async {
|
||||
await FlutterSecureStorage().delete(key: 'email');
|
||||
await FlutterSecureStorage().delete(key: 'password');
|
||||
await const FlutterSecureStorage().delete(key: 'email');
|
||||
await const FlutterSecureStorage().delete(key: 'password');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@ part of 'selection_popup_model.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SelectionPopupModel {
|
||||
@@ -32,9 +31,8 @@ mixin _$SelectionPopupModel {
|
||||
/// @nodoc
|
||||
abstract class $SelectionPopupModelCopyWith<$Res> {
|
||||
factory $SelectionPopupModelCopyWith(
|
||||
SelectionPopupModel value,
|
||||
$Res Function(SelectionPopupModel) then,
|
||||
) = _$SelectionPopupModelCopyWithImpl<$Res, SelectionPopupModel>;
|
||||
SelectionPopupModel value, $Res Function(SelectionPopupModel) then) =
|
||||
_$SelectionPopupModelCopyWithImpl<$Res, SelectionPopupModel>;
|
||||
@useResult
|
||||
$Res call({int? id, String title, dynamic value, bool isSelected});
|
||||
}
|
||||
@@ -59,41 +57,33 @@ class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel>
|
||||
Object? value = freezed,
|
||||
Object? isSelected = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
id:
|
||||
freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
title:
|
||||
null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
value:
|
||||
freezed == value
|
||||
? _value.value
|
||||
: value // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
isSelected:
|
||||
null == isSelected
|
||||
? _value.isSelected
|
||||
: isSelected // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
return _then(_value.copyWith(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
title: null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
value: freezed == value
|
||||
? _value.value
|
||||
: value // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
isSelected: null == isSelected
|
||||
? _value.isSelected
|
||||
: isSelected // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SelectionPopupModelImplCopyWith<$Res>
|
||||
implements $SelectionPopupModelCopyWith<$Res> {
|
||||
factory _$$SelectionPopupModelImplCopyWith(
|
||||
_$SelectionPopupModelImpl value,
|
||||
$Res Function(_$SelectionPopupModelImpl) then,
|
||||
) = __$$SelectionPopupModelImplCopyWithImpl<$Res>;
|
||||
factory _$$SelectionPopupModelImplCopyWith(_$SelectionPopupModelImpl value,
|
||||
$Res Function(_$SelectionPopupModelImpl) then) =
|
||||
__$$SelectionPopupModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({int? id, String title, dynamic value, bool isSelected});
|
||||
@@ -103,10 +93,9 @@ abstract class _$$SelectionPopupModelImplCopyWith<$Res>
|
||||
class __$$SelectionPopupModelImplCopyWithImpl<$Res>
|
||||
extends _$SelectionPopupModelCopyWithImpl<$Res, _$SelectionPopupModelImpl>
|
||||
implements _$$SelectionPopupModelImplCopyWith<$Res> {
|
||||
__$$SelectionPopupModelImplCopyWithImpl(
|
||||
_$SelectionPopupModelImpl _value,
|
||||
$Res Function(_$SelectionPopupModelImpl) _then,
|
||||
) : super(_value, _then);
|
||||
__$$SelectionPopupModelImplCopyWithImpl(_$SelectionPopupModelImpl _value,
|
||||
$Res Function(_$SelectionPopupModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of SelectionPopupModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -118,42 +107,32 @@ class __$$SelectionPopupModelImplCopyWithImpl<$Res>
|
||||
Object? value = freezed,
|
||||
Object? isSelected = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$SelectionPopupModelImpl(
|
||||
id:
|
||||
freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
title:
|
||||
null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
value:
|
||||
freezed == value
|
||||
? _value.value
|
||||
: value // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
isSelected:
|
||||
null == isSelected
|
||||
? _value.isSelected
|
||||
: isSelected // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
return _then(_$SelectionPopupModelImpl(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
title: null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
value: freezed == value
|
||||
? _value.value
|
||||
: value // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
isSelected: null == isSelected
|
||||
? _value.isSelected
|
||||
: isSelected // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SelectionPopupModelImpl implements _SelectionPopupModel {
|
||||
const _$SelectionPopupModelImpl({
|
||||
this.id,
|
||||
required this.title,
|
||||
this.value,
|
||||
this.isSelected = false,
|
||||
});
|
||||
const _$SelectionPopupModelImpl(
|
||||
{this.id, required this.title, this.value, this.isSelected = false});
|
||||
|
||||
@override
|
||||
final int? id;
|
||||
@@ -183,13 +162,8 @@ class _$SelectionPopupModelImpl implements _SelectionPopupModel {
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
title,
|
||||
const DeepCollectionEquality().hash(value),
|
||||
isSelected,
|
||||
);
|
||||
int get hashCode => Object.hash(runtimeType, id, title,
|
||||
const DeepCollectionEquality().hash(value), isSelected);
|
||||
|
||||
/// Create a copy of SelectionPopupModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -198,18 +172,15 @@ class _$SelectionPopupModelImpl implements _SelectionPopupModel {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith =>
|
||||
__$$SelectionPopupModelImplCopyWithImpl<_$SelectionPopupModelImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _SelectionPopupModel implements SelectionPopupModel {
|
||||
const factory _SelectionPopupModel({
|
||||
final int? id,
|
||||
required final String title,
|
||||
final dynamic value,
|
||||
final bool isSelected,
|
||||
}) = _$SelectionPopupModelImpl;
|
||||
const factory _SelectionPopupModel(
|
||||
{final int? id,
|
||||
required final String title,
|
||||
final dynamic value,
|
||||
final bool isSelected}) = _$SelectionPopupModelImpl;
|
||||
|
||||
@override
|
||||
int? get id;
|
||||
|
||||
@@ -79,7 +79,7 @@ import 'package:eatvio_app/features/settings/services/settings_service.dart';
|
||||
import 'package:eatvio_app/features/user_details/presentation/cubit/user_details_cubit.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/bloc/plans_cubit/plans_cubit.dart' as profilePlans;
|
||||
import 'package:eatvio_app/features/profile/presentation/bloc/plans_cubit/plans_cubit.dart' as profile_plans;
|
||||
|
||||
final sl = GetIt.instance;
|
||||
|
||||
@@ -98,7 +98,7 @@ Future<void> init() async {
|
||||
sl.registerFactory<RecipesCubit>(() => RecipesCubit(feedRepository: sl(), recipeRepository: sl(), aboutRecipeRepository: sl()));
|
||||
sl.registerFactory<CalendarCubit>(() => CalendarCubit(calendarRepository: sl()));
|
||||
sl.registerFactory<ProfileCubit>(() => ProfileCubit(profileRepository: sl(), chatRepository: sl()));
|
||||
sl.registerFactory<profilePlans.PlansCubit>(() => profilePlans.PlansCubit(plansRepository: sl()));
|
||||
sl.registerFactory<profile_plans.PlansCubit>(() => profile_plans.PlansCubit(plansRepository: sl()));
|
||||
sl.registerFactory<DietsCubit>(() => DietsCubit(feedRepository: sl(), dietsRepository: sl()));
|
||||
sl.registerFactory<CommentsCubit>(() => CommentsCubit(feedRepository: sl()));
|
||||
sl.registerFactory<PlansCubit>(() => PlansCubit(feedRepository: sl(), planRepository: sl()));
|
||||
@@ -173,5 +173,5 @@ Future<void> init() async {
|
||||
sl.registerLazySingleton(
|
||||
() => Dio(BaseOptions(baseUrl: baseUrl, headers: {'accept': 'application/json', 'content-type': 'application/json'}))..interceptors.add(TokenInterceptor()),
|
||||
);
|
||||
sl.registerLazySingleton(() async => await FlutterSecureStorage());
|
||||
sl.registerLazySingleton(() async => const FlutterSecureStorage());
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@ part of 'pagination_model.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
Links _$LinksFromJson(Map<String, dynamic> json) {
|
||||
return _Links.fromJson(json);
|
||||
@@ -44,12 +43,11 @@ abstract class $LinksCopyWith<$Res> {
|
||||
factory $LinksCopyWith(Links value, $Res Function(Links) then) =
|
||||
_$LinksCopyWithImpl<$Res, Links>;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: "first") String first,
|
||||
@JsonKey(name: "last") String last,
|
||||
@JsonKey(name: "prev") dynamic prev,
|
||||
@JsonKey(name: "next") dynamic next,
|
||||
});
|
||||
$Res call(
|
||||
{@JsonKey(name: "first") String first,
|
||||
@JsonKey(name: "last") String last,
|
||||
@JsonKey(name: "prev") dynamic prev,
|
||||
@JsonKey(name: "next") dynamic next});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -72,48 +70,39 @@ class _$LinksCopyWithImpl<$Res, $Val extends Links>
|
||||
Object? prev = freezed,
|
||||
Object? next = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
first:
|
||||
null == first
|
||||
? _value.first
|
||||
: first // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
last:
|
||||
null == last
|
||||
? _value.last
|
||||
: last // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
prev:
|
||||
freezed == prev
|
||||
? _value.prev
|
||||
: prev // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
next:
|
||||
freezed == next
|
||||
? _value.next
|
||||
: next // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
return _then(_value.copyWith(
|
||||
first: null == first
|
||||
? _value.first
|
||||
: first // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
last: null == last
|
||||
? _value.last
|
||||
: last // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
prev: freezed == prev
|
||||
? _value.prev
|
||||
: prev // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
next: freezed == next
|
||||
? _value.next
|
||||
: next // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LinksImplCopyWith<$Res> implements $LinksCopyWith<$Res> {
|
||||
factory _$$LinksImplCopyWith(
|
||||
_$LinksImpl value,
|
||||
$Res Function(_$LinksImpl) then,
|
||||
) = __$$LinksImplCopyWithImpl<$Res>;
|
||||
_$LinksImpl value, $Res Function(_$LinksImpl) then) =
|
||||
__$$LinksImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: "first") String first,
|
||||
@JsonKey(name: "last") String last,
|
||||
@JsonKey(name: "prev") dynamic prev,
|
||||
@JsonKey(name: "next") dynamic next,
|
||||
});
|
||||
$Res call(
|
||||
{@JsonKey(name: "first") String first,
|
||||
@JsonKey(name: "last") String last,
|
||||
@JsonKey(name: "prev") dynamic prev,
|
||||
@JsonKey(name: "next") dynamic next});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -121,9 +110,8 @@ class __$$LinksImplCopyWithImpl<$Res>
|
||||
extends _$LinksCopyWithImpl<$Res, _$LinksImpl>
|
||||
implements _$$LinksImplCopyWith<$Res> {
|
||||
__$$LinksImplCopyWithImpl(
|
||||
_$LinksImpl _value,
|
||||
$Res Function(_$LinksImpl) _then,
|
||||
) : super(_value, _then);
|
||||
_$LinksImpl _value, $Res Function(_$LinksImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of Links
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -135,42 +123,35 @@ class __$$LinksImplCopyWithImpl<$Res>
|
||||
Object? prev = freezed,
|
||||
Object? next = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$LinksImpl(
|
||||
first:
|
||||
null == first
|
||||
? _value.first
|
||||
: first // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
last:
|
||||
null == last
|
||||
? _value.last
|
||||
: last // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
prev:
|
||||
freezed == prev
|
||||
? _value.prev
|
||||
: prev // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
next:
|
||||
freezed == next
|
||||
? _value.next
|
||||
: next // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
),
|
||||
);
|
||||
return _then(_$LinksImpl(
|
||||
first: null == first
|
||||
? _value.first
|
||||
: first // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
last: null == last
|
||||
? _value.last
|
||||
: last // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
prev: freezed == prev
|
||||
? _value.prev
|
||||
: prev // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
next: freezed == next
|
||||
? _value.next
|
||||
: next // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LinksImpl implements _Links {
|
||||
const _$LinksImpl({
|
||||
@JsonKey(name: "first") required this.first,
|
||||
@JsonKey(name: "last") required this.last,
|
||||
@JsonKey(name: "prev") required this.prev,
|
||||
@JsonKey(name: "next") required this.next,
|
||||
});
|
||||
const _$LinksImpl(
|
||||
{@JsonKey(name: "first") required this.first,
|
||||
@JsonKey(name: "last") required this.last,
|
||||
@JsonKey(name: "prev") required this.prev,
|
||||
@JsonKey(name: "next") required this.next});
|
||||
|
||||
factory _$LinksImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LinksImplFromJson(json);
|
||||
@@ -207,12 +188,11 @@ class _$LinksImpl implements _Links {
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
first,
|
||||
last,
|
||||
const DeepCollectionEquality().hash(prev),
|
||||
const DeepCollectionEquality().hash(next),
|
||||
);
|
||||
runtimeType,
|
||||
first,
|
||||
last,
|
||||
const DeepCollectionEquality().hash(prev),
|
||||
const DeepCollectionEquality().hash(next));
|
||||
|
||||
/// Create a copy of Links
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -224,17 +204,18 @@ class _$LinksImpl implements _Links {
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$LinksImplToJson(this);
|
||||
return _$$LinksImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Links implements Links {
|
||||
const factory _Links({
|
||||
@JsonKey(name: "first") required final String first,
|
||||
@JsonKey(name: "last") required final String last,
|
||||
@JsonKey(name: "prev") required final dynamic prev,
|
||||
@JsonKey(name: "next") required final dynamic next,
|
||||
}) = _$LinksImpl;
|
||||
const factory _Links(
|
||||
{@JsonKey(name: "first") required final String first,
|
||||
@JsonKey(name: "last") required final String last,
|
||||
@JsonKey(name: "prev") required final dynamic prev,
|
||||
@JsonKey(name: "next") required final dynamic next}) = _$LinksImpl;
|
||||
|
||||
factory _Links.fromJson(Map<String, dynamic> json) = _$LinksImpl.fromJson;
|
||||
|
||||
@@ -300,18 +281,17 @@ abstract class $MetaCopyWith<$Res> {
|
||||
factory $MetaCopyWith(Meta value, $Res Function(Meta) then) =
|
||||
_$MetaCopyWithImpl<$Res, Meta>;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: "current_page") int currentPage,
|
||||
@JsonKey(name: "from") dynamic from,
|
||||
@JsonKey(name: "last_page") int lastPage,
|
||||
@JsonKey(name: "links") List<Link> links,
|
||||
@JsonKey(name: "path") String? path,
|
||||
@JsonKey(name: "per_page") int perPage,
|
||||
@JsonKey(name: "to") dynamic to,
|
||||
@JsonKey(name: "total") int total,
|
||||
@JsonKey(name: "total_min_price") int? totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") int? totalMaxPrice,
|
||||
});
|
||||
$Res call(
|
||||
{@JsonKey(name: "current_page") int currentPage,
|
||||
@JsonKey(name: "from") dynamic from,
|
||||
@JsonKey(name: "last_page") int lastPage,
|
||||
@JsonKey(name: "links") List<Link> links,
|
||||
@JsonKey(name: "path") String? path,
|
||||
@JsonKey(name: "per_page") int perPage,
|
||||
@JsonKey(name: "to") dynamic to,
|
||||
@JsonKey(name: "total") int total,
|
||||
@JsonKey(name: "total_min_price") int? totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") int? totalMaxPrice});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -340,84 +320,69 @@ class _$MetaCopyWithImpl<$Res, $Val extends Meta>
|
||||
Object? totalMinPrice = freezed,
|
||||
Object? totalMaxPrice = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
currentPage:
|
||||
null == currentPage
|
||||
? _value.currentPage
|
||||
: currentPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
from:
|
||||
freezed == from
|
||||
? _value.from
|
||||
: from // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
lastPage:
|
||||
null == lastPage
|
||||
? _value.lastPage
|
||||
: lastPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
links:
|
||||
null == links
|
||||
? _value.links
|
||||
: links // ignore: cast_nullable_to_non_nullable
|
||||
as List<Link>,
|
||||
path:
|
||||
freezed == path
|
||||
? _value.path
|
||||
: path // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
perPage:
|
||||
null == perPage
|
||||
? _value.perPage
|
||||
: perPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
to:
|
||||
freezed == to
|
||||
? _value.to
|
||||
: to // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
total:
|
||||
null == total
|
||||
? _value.total
|
||||
: total // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalMinPrice:
|
||||
freezed == totalMinPrice
|
||||
? _value.totalMinPrice
|
||||
: totalMinPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
totalMaxPrice:
|
||||
freezed == totalMaxPrice
|
||||
? _value.totalMaxPrice
|
||||
: totalMaxPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
return _then(_value.copyWith(
|
||||
currentPage: null == currentPage
|
||||
? _value.currentPage
|
||||
: currentPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
from: freezed == from
|
||||
? _value.from
|
||||
: from // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
lastPage: null == lastPage
|
||||
? _value.lastPage
|
||||
: lastPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
links: null == links
|
||||
? _value.links
|
||||
: links // ignore: cast_nullable_to_non_nullable
|
||||
as List<Link>,
|
||||
path: freezed == path
|
||||
? _value.path
|
||||
: path // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
perPage: null == perPage
|
||||
? _value.perPage
|
||||
: perPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
to: freezed == to
|
||||
? _value.to
|
||||
: to // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
total: null == total
|
||||
? _value.total
|
||||
: total // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalMinPrice: freezed == totalMinPrice
|
||||
? _value.totalMinPrice
|
||||
: totalMinPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
totalMaxPrice: freezed == totalMaxPrice
|
||||
? _value.totalMaxPrice
|
||||
: totalMaxPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MetaImplCopyWith<$Res> implements $MetaCopyWith<$Res> {
|
||||
factory _$$MetaImplCopyWith(
|
||||
_$MetaImpl value,
|
||||
$Res Function(_$MetaImpl) then,
|
||||
) = __$$MetaImplCopyWithImpl<$Res>;
|
||||
_$MetaImpl value, $Res Function(_$MetaImpl) then) =
|
||||
__$$MetaImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: "current_page") int currentPage,
|
||||
@JsonKey(name: "from") dynamic from,
|
||||
@JsonKey(name: "last_page") int lastPage,
|
||||
@JsonKey(name: "links") List<Link> links,
|
||||
@JsonKey(name: "path") String? path,
|
||||
@JsonKey(name: "per_page") int perPage,
|
||||
@JsonKey(name: "to") dynamic to,
|
||||
@JsonKey(name: "total") int total,
|
||||
@JsonKey(name: "total_min_price") int? totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") int? totalMaxPrice,
|
||||
});
|
||||
$Res call(
|
||||
{@JsonKey(name: "current_page") int currentPage,
|
||||
@JsonKey(name: "from") dynamic from,
|
||||
@JsonKey(name: "last_page") int lastPage,
|
||||
@JsonKey(name: "links") List<Link> links,
|
||||
@JsonKey(name: "path") String? path,
|
||||
@JsonKey(name: "per_page") int perPage,
|
||||
@JsonKey(name: "to") dynamic to,
|
||||
@JsonKey(name: "total") int total,
|
||||
@JsonKey(name: "total_min_price") int? totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") int? totalMaxPrice});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -425,7 +390,7 @@ class __$$MetaImplCopyWithImpl<$Res>
|
||||
extends _$MetaCopyWithImpl<$Res, _$MetaImpl>
|
||||
implements _$$MetaImplCopyWith<$Res> {
|
||||
__$$MetaImplCopyWithImpl(_$MetaImpl _value, $Res Function(_$MetaImpl) _then)
|
||||
: super(_value, _then);
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of Meta
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -443,78 +408,66 @@ class __$$MetaImplCopyWithImpl<$Res>
|
||||
Object? totalMinPrice = freezed,
|
||||
Object? totalMaxPrice = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$MetaImpl(
|
||||
currentPage:
|
||||
null == currentPage
|
||||
? _value.currentPage
|
||||
: currentPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
from:
|
||||
freezed == from
|
||||
? _value.from
|
||||
: from // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
lastPage:
|
||||
null == lastPage
|
||||
? _value.lastPage
|
||||
: lastPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
links:
|
||||
null == links
|
||||
? _value._links
|
||||
: links // ignore: cast_nullable_to_non_nullable
|
||||
as List<Link>,
|
||||
path:
|
||||
freezed == path
|
||||
? _value.path
|
||||
: path // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
perPage:
|
||||
null == perPage
|
||||
? _value.perPage
|
||||
: perPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
to:
|
||||
freezed == to
|
||||
? _value.to
|
||||
: to // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
total:
|
||||
null == total
|
||||
? _value.total
|
||||
: total // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalMinPrice:
|
||||
freezed == totalMinPrice
|
||||
? _value.totalMinPrice
|
||||
: totalMinPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
totalMaxPrice:
|
||||
freezed == totalMaxPrice
|
||||
? _value.totalMaxPrice
|
||||
: totalMaxPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
),
|
||||
);
|
||||
return _then(_$MetaImpl(
|
||||
currentPage: null == currentPage
|
||||
? _value.currentPage
|
||||
: currentPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
from: freezed == from
|
||||
? _value.from
|
||||
: from // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
lastPage: null == lastPage
|
||||
? _value.lastPage
|
||||
: lastPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
links: null == links
|
||||
? _value._links
|
||||
: links // ignore: cast_nullable_to_non_nullable
|
||||
as List<Link>,
|
||||
path: freezed == path
|
||||
? _value.path
|
||||
: path // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
perPage: null == perPage
|
||||
? _value.perPage
|
||||
: perPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
to: freezed == to
|
||||
? _value.to
|
||||
: to // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,
|
||||
total: null == total
|
||||
? _value.total
|
||||
: total // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalMinPrice: freezed == totalMinPrice
|
||||
? _value.totalMinPrice
|
||||
: totalMinPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
totalMaxPrice: freezed == totalMaxPrice
|
||||
? _value.totalMaxPrice
|
||||
: totalMaxPrice // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$MetaImpl implements _Meta {
|
||||
const _$MetaImpl({
|
||||
@JsonKey(name: "current_page") required this.currentPage,
|
||||
@JsonKey(name: "from") required this.from,
|
||||
@JsonKey(name: "last_page") required this.lastPage,
|
||||
@JsonKey(name: "links") required final List<Link> links,
|
||||
@JsonKey(name: "path") this.path,
|
||||
@JsonKey(name: "per_page") required this.perPage,
|
||||
@JsonKey(name: "to") required this.to,
|
||||
@JsonKey(name: "total") required this.total,
|
||||
@JsonKey(name: "total_min_price") this.totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") this.totalMaxPrice,
|
||||
}) : _links = links;
|
||||
const _$MetaImpl(
|
||||
{@JsonKey(name: "current_page") required this.currentPage,
|
||||
@JsonKey(name: "from") required this.from,
|
||||
@JsonKey(name: "last_page") required this.lastPage,
|
||||
@JsonKey(name: "links") required final List<Link> links,
|
||||
@JsonKey(name: "path") this.path,
|
||||
@JsonKey(name: "per_page") required this.perPage,
|
||||
@JsonKey(name: "to") required this.to,
|
||||
@JsonKey(name: "total") required this.total,
|
||||
@JsonKey(name: "total_min_price") this.totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") this.totalMaxPrice})
|
||||
: _links = links;
|
||||
|
||||
factory _$MetaImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$MetaImplFromJson(json);
|
||||
@@ -585,18 +538,17 @@ class _$MetaImpl implements _Meta {
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
currentPage,
|
||||
const DeepCollectionEquality().hash(from),
|
||||
lastPage,
|
||||
const DeepCollectionEquality().hash(_links),
|
||||
path,
|
||||
perPage,
|
||||
const DeepCollectionEquality().hash(to),
|
||||
total,
|
||||
totalMinPrice,
|
||||
totalMaxPrice,
|
||||
);
|
||||
runtimeType,
|
||||
currentPage,
|
||||
const DeepCollectionEquality().hash(from),
|
||||
lastPage,
|
||||
const DeepCollectionEquality().hash(_links),
|
||||
path,
|
||||
perPage,
|
||||
const DeepCollectionEquality().hash(to),
|
||||
total,
|
||||
totalMinPrice,
|
||||
totalMaxPrice);
|
||||
|
||||
/// Create a copy of Meta
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -608,23 +560,24 @@ class _$MetaImpl implements _Meta {
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$MetaImplToJson(this);
|
||||
return _$$MetaImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Meta implements Meta {
|
||||
const factory _Meta({
|
||||
@JsonKey(name: "current_page") required final int currentPage,
|
||||
@JsonKey(name: "from") required final dynamic from,
|
||||
@JsonKey(name: "last_page") required final int lastPage,
|
||||
@JsonKey(name: "links") required final List<Link> links,
|
||||
@JsonKey(name: "path") final String? path,
|
||||
@JsonKey(name: "per_page") required final int perPage,
|
||||
@JsonKey(name: "to") required final dynamic to,
|
||||
@JsonKey(name: "total") required final int total,
|
||||
@JsonKey(name: "total_min_price") final int? totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") final int? totalMaxPrice,
|
||||
}) = _$MetaImpl;
|
||||
const factory _Meta(
|
||||
{@JsonKey(name: "current_page") required final int currentPage,
|
||||
@JsonKey(name: "from") required final dynamic from,
|
||||
@JsonKey(name: "last_page") required final int lastPage,
|
||||
@JsonKey(name: "links") required final List<Link> links,
|
||||
@JsonKey(name: "path") final String? path,
|
||||
@JsonKey(name: "per_page") required final int perPage,
|
||||
@JsonKey(name: "to") required final dynamic to,
|
||||
@JsonKey(name: "total") required final int total,
|
||||
@JsonKey(name: "total_min_price") final int? totalMinPrice,
|
||||
@JsonKey(name: "total_max_price") final int? totalMaxPrice}) = _$MetaImpl;
|
||||
|
||||
factory _Meta.fromJson(Map<String, dynamic> json) = _$MetaImpl.fromJson;
|
||||
|
||||
@@ -694,11 +647,10 @@ abstract class $LinkCopyWith<$Res> {
|
||||
factory $LinkCopyWith(Link value, $Res Function(Link) then) =
|
||||
_$LinkCopyWithImpl<$Res, Link>;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: "url") String? url,
|
||||
@JsonKey(name: "label") String? label,
|
||||
@JsonKey(name: "active") bool? active,
|
||||
});
|
||||
$Res call(
|
||||
{@JsonKey(name: "url") String? url,
|
||||
@JsonKey(name: "label") String? label,
|
||||
@JsonKey(name: "active") bool? active});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -720,42 +672,34 @@ class _$LinkCopyWithImpl<$Res, $Val extends Link>
|
||||
Object? label = freezed,
|
||||
Object? active = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
url:
|
||||
freezed == url
|
||||
? _value.url
|
||||
: url // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
label:
|
||||
freezed == label
|
||||
? _value.label
|
||||
: label // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
active:
|
||||
freezed == active
|
||||
? _value.active
|
||||
: active // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
return _then(_value.copyWith(
|
||||
url: freezed == url
|
||||
? _value.url
|
||||
: url // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
label: freezed == label
|
||||
? _value.label
|
||||
: label // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
active: freezed == active
|
||||
? _value.active
|
||||
: active // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LinkImplCopyWith<$Res> implements $LinkCopyWith<$Res> {
|
||||
factory _$$LinkImplCopyWith(
|
||||
_$LinkImpl value,
|
||||
$Res Function(_$LinkImpl) then,
|
||||
) = __$$LinkImplCopyWithImpl<$Res>;
|
||||
_$LinkImpl value, $Res Function(_$LinkImpl) then) =
|
||||
__$$LinkImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: "url") String? url,
|
||||
@JsonKey(name: "label") String? label,
|
||||
@JsonKey(name: "active") bool? active,
|
||||
});
|
||||
$Res call(
|
||||
{@JsonKey(name: "url") String? url,
|
||||
@JsonKey(name: "label") String? label,
|
||||
@JsonKey(name: "active") bool? active});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -763,7 +707,7 @@ class __$$LinkImplCopyWithImpl<$Res>
|
||||
extends _$LinkCopyWithImpl<$Res, _$LinkImpl>
|
||||
implements _$$LinkImplCopyWith<$Res> {
|
||||
__$$LinkImplCopyWithImpl(_$LinkImpl _value, $Res Function(_$LinkImpl) _then)
|
||||
: super(_value, _then);
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of Link
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -774,36 +718,30 @@ class __$$LinkImplCopyWithImpl<$Res>
|
||||
Object? label = freezed,
|
||||
Object? active = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$LinkImpl(
|
||||
url:
|
||||
freezed == url
|
||||
? _value.url
|
||||
: url // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
label:
|
||||
freezed == label
|
||||
? _value.label
|
||||
: label // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
active:
|
||||
freezed == active
|
||||
? _value.active
|
||||
: active // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
),
|
||||
);
|
||||
return _then(_$LinkImpl(
|
||||
url: freezed == url
|
||||
? _value.url
|
||||
: url // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
label: freezed == label
|
||||
? _value.label
|
||||
: label // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
active: freezed == active
|
||||
? _value.active
|
||||
: active // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LinkImpl implements _Link {
|
||||
const _$LinkImpl({
|
||||
@JsonKey(name: "url") this.url,
|
||||
@JsonKey(name: "label") this.label,
|
||||
@JsonKey(name: "active") this.active,
|
||||
});
|
||||
const _$LinkImpl(
|
||||
{@JsonKey(name: "url") this.url,
|
||||
@JsonKey(name: "label") this.label,
|
||||
@JsonKey(name: "active") this.active});
|
||||
|
||||
factory _$LinkImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LinkImplFromJson(json);
|
||||
@@ -847,16 +785,17 @@ class _$LinkImpl implements _Link {
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$LinkImplToJson(this);
|
||||
return _$$LinkImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Link implements Link {
|
||||
const factory _Link({
|
||||
@JsonKey(name: "url") final String? url,
|
||||
@JsonKey(name: "label") final String? label,
|
||||
@JsonKey(name: "active") final bool? active,
|
||||
}) = _$LinkImpl;
|
||||
const factory _Link(
|
||||
{@JsonKey(name: "url") final String? url,
|
||||
@JsonKey(name: "label") final String? label,
|
||||
@JsonKey(name: "active") final bool? active}) = _$LinkImpl;
|
||||
|
||||
factory _Link.fromJson(Map<String, dynamic> json) = _$LinkImpl.fromJson;
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ part of 'pagination_model.dart';
|
||||
// **************************************************************************
|
||||
|
||||
_$LinksImpl _$$LinksImplFromJson(Map<String, dynamic> json) => _$LinksImpl(
|
||||
first: json['first'] as String,
|
||||
last: json['last'] as String,
|
||||
prev: json['prev'],
|
||||
next: json['next'],
|
||||
);
|
||||
first: json['first'] as String,
|
||||
last: json['last'] as String,
|
||||
prev: json['prev'],
|
||||
next: json['next'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LinksImplToJson(_$LinksImpl instance) =>
|
||||
<String, dynamic>{
|
||||
@@ -22,20 +22,19 @@ Map<String, dynamic> _$$LinksImplToJson(_$LinksImpl instance) =>
|
||||
};
|
||||
|
||||
_$MetaImpl _$$MetaImplFromJson(Map<String, dynamic> json) => _$MetaImpl(
|
||||
currentPage: (json['current_page'] as num).toInt(),
|
||||
from: json['from'],
|
||||
lastPage: (json['last_page'] as num).toInt(),
|
||||
links:
|
||||
(json['links'] as List<dynamic>)
|
||||
currentPage: (json['current_page'] as num).toInt(),
|
||||
from: json['from'],
|
||||
lastPage: (json['last_page'] as num).toInt(),
|
||||
links: (json['links'] as List<dynamic>)
|
||||
.map((e) => Link.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
path: json['path'] as String?,
|
||||
perPage: (json['per_page'] as num).toInt(),
|
||||
to: json['to'],
|
||||
total: (json['total'] as num).toInt(),
|
||||
totalMinPrice: (json['total_min_price'] as num?)?.toInt(),
|
||||
totalMaxPrice: (json['total_max_price'] as num?)?.toInt(),
|
||||
);
|
||||
path: json['path'] as String?,
|
||||
perPage: (json['per_page'] as num).toInt(),
|
||||
to: json['to'],
|
||||
total: (json['total'] as num).toInt(),
|
||||
totalMinPrice: (json['total_min_price'] as num?)?.toInt(),
|
||||
totalMaxPrice: (json['total_max_price'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$MetaImplToJson(_$MetaImpl instance) =>
|
||||
<String, dynamic>{
|
||||
@@ -52,10 +51,10 @@ Map<String, dynamic> _$$MetaImplToJson(_$MetaImpl instance) =>
|
||||
};
|
||||
|
||||
_$LinkImpl _$$LinkImplFromJson(Map<String, dynamic> json) => _$LinkImpl(
|
||||
url: json['url'] as String?,
|
||||
label: json['label'] as String?,
|
||||
active: json['active'] as bool?,
|
||||
);
|
||||
url: json['url'] as String?,
|
||||
label: json['label'] as String?,
|
||||
active: json['active'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LinkImplToJson(_$LinkImpl instance) =>
|
||||
<String, dynamic>{
|
||||
|
||||
@@ -80,7 +80,7 @@ class BorderRadiusStyle {
|
||||
color: appTheme.black900.withValues(alpha: 0.15),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 2,
|
||||
offset: Offset(
|
||||
offset: const Offset(
|
||||
0,
|
||||
2,
|
||||
),
|
||||
@@ -110,15 +110,15 @@ class BorderRadiusStyle {
|
||||
);
|
||||
|
||||
// Custom borders
|
||||
static BorderRadius get customBorderBL8 => BorderRadius.only(
|
||||
static BorderRadius get customBorderBL8 => const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(8),
|
||||
);
|
||||
|
||||
static BorderRadius get customBorderTL5 => BorderRadius.vertical(
|
||||
static BorderRadius get customBorderTL5 => const BorderRadius.vertical(
|
||||
top: Radius.circular(5),
|
||||
);
|
||||
|
||||
static BorderRadius get customBorderTL51 => BorderRadius.only(
|
||||
static BorderRadius get customBorderTL51 => const BorderRadius.only(
|
||||
topLeft: Radius.circular(5),
|
||||
bottomRight: Radius.circular(5),
|
||||
);
|
||||
|
||||
@@ -5,15 +5,15 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
/// Helper class for managing themes and colors.
|
||||
class ThemeHelper {
|
||||
// The current app theme
|
||||
var _appTheme = 'primary';
|
||||
final _appTheme = 'primary';
|
||||
|
||||
// A map of custom color themes supported by the app
|
||||
Map<String, PrimaryColors> _supportedCustomColor = {
|
||||
final Map<String, PrimaryColors> _supportedCustomColor = {
|
||||
'primary': PrimaryColors(),
|
||||
};
|
||||
|
||||
// A map of color schemes supported by the app
|
||||
Map<String, ColorScheme> _supportedColorScheme = {
|
||||
final Map<String, ColorScheme> _supportedColorScheme = {
|
||||
'primary': ColorSchemes.primaryColorScheme,
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ class ThemeHelper {
|
||||
visualDensity: VisualDensity.standard,
|
||||
colorScheme: colorScheme,
|
||||
scaffoldBackgroundColor: colorScheme.onPrimary,
|
||||
appBarTheme: AppBarTheme(
|
||||
appBarTheme: const AppBarTheme(
|
||||
scrolledUnderElevation: 0,
|
||||
elevation: 0,
|
||||
systemOverlayStyle: SystemUiOverlayStyle(
|
||||
@@ -86,7 +86,7 @@ class ThemeHelper {
|
||||
|
||||
/// Class containing the supported color schemes.
|
||||
class ColorSchemes {
|
||||
static final primaryColorScheme = ColorScheme.light(
|
||||
static const primaryColorScheme = ColorScheme.light(
|
||||
// Primary colors
|
||||
primary: Color(0XFF323F4B),
|
||||
|
||||
@@ -99,102 +99,103 @@ class ColorSchemes {
|
||||
/// Class containing custom colors for a primary theme.
|
||||
class PrimaryColors {
|
||||
// Blue
|
||||
Color get blue400 => Color(0XFF43A6F2);
|
||||
Color get blue400 => const Color(0XFF43A6F2);
|
||||
|
||||
Color get blueA400 => Color(0XFF2F80ED);
|
||||
Color get blueA400 => const Color(0XFF2F80ED);
|
||||
|
||||
// BlueGray
|
||||
Color get blueGray400 => Color(0XFF7B8794);
|
||||
Color get blueGray400 => const Color(0XFF7B8794);
|
||||
|
||||
Color get black900 => Color(0XFF000000);
|
||||
Color get black900 => const Color(0XFF000000);
|
||||
|
||||
// Blue
|
||||
Color get blue800 => Color(0XFF1F78B4);
|
||||
Color get blue800 => const Color(0XFF1F78B4);
|
||||
|
||||
// BlueGray
|
||||
Color get blueGray300 => Color(0XFF9AA5B1);
|
||||
Color get blueGray300 => const Color(0XFF9AA5B1);
|
||||
|
||||
Color get black => Color(0XFF323F4B);
|
||||
Color get black => const Color(0XFF323F4B);
|
||||
|
||||
Color get blueGray900 => Color(0XFF2A2F4C);
|
||||
Color get blueGray900 => const Color(0XFF2A2F4C);
|
||||
|
||||
// DeepOrange
|
||||
Color get deepOrange900 => Color(0XFF9A4A00);
|
||||
Color get deepOrange900 => const Color(0XFF9A4A00);
|
||||
|
||||
// Gray
|
||||
Color get gray100 => Color(0XFFF0F2F5);
|
||||
Color get gray100 => const Color(0XFFF0F2F5);
|
||||
|
||||
Color get gray200 => Color(0XFFF0F0F0);
|
||||
Color get gray200 => const Color(0XFFF0F0F0);
|
||||
|
||||
Color get gray400 => Color(0XFFC1C1C1);
|
||||
Color get gray400 => const Color(0XFFC1C1C1);
|
||||
|
||||
Color get gray40001 => Color(0XFFC8C8C8);
|
||||
Color get gray40001 => const Color(0XFFC8C8C8);
|
||||
|
||||
Color get gray50 => Color(0XFFF6FAFF);
|
||||
Color get gray50 => const Color(0XFFF6FAFF);
|
||||
|
||||
Color get gray500 => Color(0XFFA3A3A3);
|
||||
Color get gray500 => const Color(0XFFA3A3A3);
|
||||
|
||||
Color get gray600 => Color(0XFF6D6D6D);
|
||||
Color get gray600 => const Color(0XFF6D6D6D);
|
||||
|
||||
Color get gray60001 => Color(0XFF848484);
|
||||
Color get gray60001 => const Color(0XFF848484);
|
||||
|
||||
Color get gray60002 => Color(0XFF757575);
|
||||
Color get gray60002 => const Color(0XFF757575);
|
||||
|
||||
Color get gray60003 => Color(0XFF707070);
|
||||
Color get gray60003 => const Color(0XFF707070);
|
||||
|
||||
// Green
|
||||
Color get greenA700 => Color(0XFF019A3E);
|
||||
Color get greenA700 => const Color(0XFF019A3E);
|
||||
|
||||
Color get greenA70001 => Color(0XFF00BE13);
|
||||
Color get greenA70001 => const Color(0XFF00BE13);
|
||||
|
||||
// LightGreen
|
||||
Color get lightGreen300 => Color(0XFFB2DF8A);
|
||||
Color get lightGreen300 => const Color(0XFFB2DF8A);
|
||||
|
||||
Color get lightGreenA700 => Color(0XFF18FF14);
|
||||
Color get lightGreenA700 => const Color(0XFF18FF14);
|
||||
|
||||
// Red
|
||||
Color get red200 => Color(0XFFE3A6A6);
|
||||
Color get red200 => const Color(0XFFE3A6A6);
|
||||
|
||||
// Teal
|
||||
Color get teal100 => Color(0XFFA6CEE3);
|
||||
Color get teal100 => const Color(0XFFA6CEE3);
|
||||
|
||||
Color get teal900 => Color(0XFF0B3F56);
|
||||
Color get teal900 => const Color(0XFF0B3F56);
|
||||
|
||||
// White
|
||||
Color get whiteA700 => Color(0XFFFFFFFF);
|
||||
Color get whiteA700 => const Color(0XFFFFFFFF);
|
||||
|
||||
Color get backgroundAvatar => Color(0xFFEBF4FF);
|
||||
Color get backgroundAvatar => const Color(0xFFEBF4FF);
|
||||
|
||||
Color get cardBackground => Color(0xFFF7FAFF);
|
||||
Color get cardBackground => const Color(0xFFF7FAFF);
|
||||
|
||||
Color get dividerColor => Color(0xFFF1F2F6);
|
||||
Color get dividerColor => const Color(0xFFF1F2F6);
|
||||
|
||||
Color get gray => Color(0xFF6D6F71);
|
||||
Color get gray => const Color(0xFF6D6F71);
|
||||
|
||||
Color get lightGray600 => Color(0xFFB0B0B0);
|
||||
Color get lightGray600 => const Color(0xFFB0B0B0);
|
||||
|
||||
Color get lightGray => Color(0xFFCECECE);
|
||||
Color get lightGray => const Color(0xFFCECECE);
|
||||
|
||||
Color get transparentBlue => Color(0xFF2F80ED).withValues(alpha: 0.1);
|
||||
Color get transparentBlue => const Color(0xFF2F80ED).withValues(alpha: 0.1);
|
||||
|
||||
Color get lightGray0 => Color(0xFFF6F6F6);
|
||||
Color get lightGray0 => const Color(0xFFF6F6F6);
|
||||
|
||||
Color get lightGray00 => Color(0xFFE9E9EA);
|
||||
Color get lightGray00 => const Color(0xFFE9E9EA);
|
||||
|
||||
Color get dottedBorder => Color(0xFFE6E6E6);
|
||||
Color get dottedBorder => const Color(0xFFE6E6E6);
|
||||
|
||||
Color get red => Color(0xFFCD4141);
|
||||
Color get strongRed => Color(0xFFD01717);
|
||||
Color get red => const Color(0xFFCD4141);
|
||||
Color get strongRed => const Color(0xFFD01717);
|
||||
|
||||
Color get transparentRed => Color(0xFFCD4141).withValues(alpha: 0.75);
|
||||
Color get transparentRed => const Color(0xFFCD4141).withValues(alpha: 0.75);
|
||||
|
||||
Color get transparentBlack => Color(0xFF1313264).withValues(alpha: 0.3);
|
||||
// ignore: use_full_hex_values_for_flutter_colors
|
||||
Color get transparentBlack => const Color(0xff1313264).withValues(alpha: 0.3);
|
||||
|
||||
Color get gray60004 => Color(0xFFD4DAE2).withValues(alpha: 0.2);
|
||||
Color get gray60004 => const Color(0xFFD4DAE2).withValues(alpha: 0.2);
|
||||
|
||||
Color get blueGray => Color(0xFF809CB9);
|
||||
Color get blueGray => const Color(0xFF809CB9);
|
||||
|
||||
Color get dialogShadow => Color.fromARGB(125, 0, 0, 0);
|
||||
Color get dialogShadow => const Color.fromARGB(125, 0, 0, 0);
|
||||
}
|
||||
|
||||
PrimaryColors get appTheme => ThemeHelper().themeColor();
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
abstract class TokenStorage {
|
||||
static Future<bool> haveTokenInStorage() async {
|
||||
try {
|
||||
if (await FlutterSecureStorage().read(key: 'token') == null) {
|
||||
if (await const FlutterSecureStorage().read(key: 'token') == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -13,11 +13,11 @@ abstract class TokenStorage {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<String?> getTokenFromStorage() async => await FlutterSecureStorage().read(key: 'token');
|
||||
static Future<String?> getTokenFromStorage() async => await const FlutterSecureStorage().read(key: 'token');
|
||||
|
||||
static saveTokenInStorage(String token) async {
|
||||
await FlutterSecureStorage().write(key: 'token', value: token);
|
||||
await const FlutterSecureStorage().write(key: 'token', value: token);
|
||||
}
|
||||
|
||||
static Future<void> removeTokenInStorage() async => (await FlutterSecureStorage().delete(key: 'token'));
|
||||
static Future<void> removeTokenInStorage() async => (await const FlutterSecureStorage().delete(key: 'token'));
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ import 'package:eatvio_app/generated/l10n.dart';
|
||||
|
||||
String getLocalizedMeasurementUnits(S s, Portion portion) {
|
||||
switch (portion) {
|
||||
case Portion.GRAMS:
|
||||
case Portion.grams:
|
||||
return s.gr;
|
||||
case Portion.MILLILITERS:
|
||||
case Portion.milliliters:
|
||||
return s.milliliter;
|
||||
case Portion.PCS:
|
||||
case Portion.pcs:
|
||||
return s.pcs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class WsManager {
|
||||
Stream<ChannelReadEvent>? get clientTypingStream => _privateDirectChatChannel?.bind('client-typing');
|
||||
|
||||
Future<void> initialize() async {
|
||||
if (this.client == null) {
|
||||
if (client == null) {
|
||||
try {
|
||||
await TokenStorage.haveTokenInStorage();
|
||||
final wsUrl = await wsService.getWebsocket();
|
||||
@@ -37,7 +37,7 @@ class WsManager {
|
||||
key: wsUrl.key,
|
||||
host: wsUrl.host,
|
||||
shouldSupplyMetadataQueries: true,
|
||||
metadata: PusherChannelsOptionsMetadata.byDefault(),
|
||||
metadata: const PusherChannelsOptionsMetadata.byDefault(),
|
||||
port: 443,
|
||||
);
|
||||
client = PusherChannelsClient.websocket(
|
||||
@@ -58,7 +58,7 @@ class WsManager {
|
||||
|
||||
await client?.connect();
|
||||
|
||||
this.client = client;
|
||||
client = client;
|
||||
userId = wsUrl.userId;
|
||||
|
||||
await _initPrivateNotificationsChannel();
|
||||
@@ -82,10 +82,10 @@ class WsManager {
|
||||
|
||||
Future<void> _initPrivateNotificationsChannel() async {
|
||||
final token = await TokenStorage.getTokenFromStorage();
|
||||
_privateNotificationChannel = await client?.privateChannel(
|
||||
_privateNotificationChannel = client?.privateChannel(
|
||||
'$newNotificationsChannelName.$userId',
|
||||
authorizationDelegate: EndpointAuthorizableChannelTokenAuthorizationDelegate.forPrivateChannel(
|
||||
authorizationEndpoint: Uri.parse(baseUrl + '/broadcasting/auth'),
|
||||
authorizationEndpoint: Uri.parse('$baseUrl/broadcasting/auth'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
@@ -95,10 +95,10 @@ class WsManager {
|
||||
|
||||
Future<void> _initPrivateMessagesChannel() async {
|
||||
final token = await TokenStorage.getTokenFromStorage();
|
||||
_privateMessagesChannel = await client?.privateChannel(
|
||||
_privateMessagesChannel = client?.privateChannel(
|
||||
'$newMessagesChannelName.$userId',
|
||||
authorizationDelegate: EndpointAuthorizableChannelTokenAuthorizationDelegate.forPrivateChannel(
|
||||
authorizationEndpoint: Uri.parse(baseUrl + '/broadcasting/auth'),
|
||||
authorizationEndpoint: Uri.parse('$baseUrl/broadcasting/auth'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
@@ -108,10 +108,10 @@ class WsManager {
|
||||
|
||||
Future<void> initPrivateDirectChatChannel(String chatId) async {
|
||||
final token = await TokenStorage.getTokenFromStorage();
|
||||
_privateDirectChatChannel = await client?.privateChannel(
|
||||
_privateDirectChatChannel = client?.privateChannel(
|
||||
'$directChatChannelName.$chatId',
|
||||
authorizationDelegate: EndpointAuthorizableChannelTokenAuthorizationDelegate.forPrivateChannel(
|
||||
authorizationEndpoint: Uri.parse(baseUrl + '/broadcasting/auth'),
|
||||
authorizationEndpoint: Uri.parse('$baseUrl/broadcasting/auth'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
|
||||
@@ -18,12 +18,12 @@ class AddItemButton extends StatelessWidget {
|
||||
color: appTheme.blueA400,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
width: 40,
|
||||
height: 40,
|
||||
child: Icon(
|
||||
Icons.add_rounded,
|
||||
color: appTheme.gray100,
|
||||
),
|
||||
width: 40,
|
||||
height: 40,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AnimatedOptionButton extends StatelessWidget {
|
||||
const AnimatedOptionButton({required this.text, required this.isSelected, required this.onTap, this.textStyle});
|
||||
const AnimatedOptionButton({super.key, required this.text, required this.isSelected, required this.onTap, this.textStyle});
|
||||
final String text;
|
||||
final bool isSelected;
|
||||
final void Function() onTap;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BaseButton extends StatelessWidget {
|
||||
BaseButton({
|
||||
Key? key,
|
||||
const BaseButton({
|
||||
super.key,
|
||||
required this.text,
|
||||
this.onPressed,
|
||||
this.buttonStyle,
|
||||
@@ -12,9 +12,7 @@ class BaseButton extends StatelessWidget {
|
||||
this.width,
|
||||
this.margin,
|
||||
this.alignment,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
});
|
||||
|
||||
final String text;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Future<void> showBottomSheetWithBlur({
|
||||
child: Container(
|
||||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20),
|
||||
),
|
||||
|
||||
@@ -15,31 +15,31 @@ class CpfcContainer extends StatelessWidget {
|
||||
final s = S.of(context);
|
||||
return Container(
|
||||
color: appTheme.cardBackground,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Text('${calories.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
|
||||
Text(calories.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
|
||||
Text(s.calories, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text('${proteins.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
|
||||
Text(proteins.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
|
||||
Text(s.proteins, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text('${fats.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
|
||||
Text(fats.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
|
||||
Text(s.fats, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text('${carbohydrates.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
|
||||
Text(carbohydrates.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
|
||||
Text(s.carbohydrates, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.d
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomDropDown extends StatelessWidget {
|
||||
const CustomDropDown({
|
||||
const CustomDropDown({super.key,
|
||||
this.alignment,
|
||||
this.width,
|
||||
this.focusNode,
|
||||
@@ -59,7 +59,7 @@ class CustomDropDown extends StatelessWidget {
|
||||
_buildDropDownWidget(BuildContext context) {
|
||||
return DropdownButtonFormField<SelectionPopupModel>(
|
||||
focusNode: focusNode ?? FocusNode(),
|
||||
icon: Icon(Icons.keyboard_arrow_down_rounded),
|
||||
icon: const Icon(Icons.keyboard_arrow_down_rounded),
|
||||
autofocus: autofocus!,
|
||||
value: value,
|
||||
isDense: true,
|
||||
@@ -70,7 +70,7 @@ class CustomDropDown extends StatelessWidget {
|
||||
child: Text(
|
||||
item.title,
|
||||
style: hintStyle ??
|
||||
TextStyle(
|
||||
const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black,
|
||||
@@ -90,7 +90,7 @@ class CustomDropDown extends StatelessWidget {
|
||||
|
||||
InputDecoration _buildInputDecoration(BuildContext context) {
|
||||
return InputDecoration(
|
||||
labelStyle: TextStyle(
|
||||
labelStyle: const TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400,
|
||||
@@ -108,19 +108,19 @@ class CustomDropDown extends StatelessWidget {
|
||||
suffixIcon: suffix,
|
||||
isDense: true,
|
||||
suffixIconConstraints: suffixConstraints,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16, horizontal: 12),
|
||||
fillColor: Color(0xFFF6F6F6),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 16, horizontal: 12),
|
||||
fillColor: const Color(0xFFF6F6F6),
|
||||
filled: filled,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -3,32 +3,21 @@ import 'package:eatvio_app/core/widgets/base_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomOutlinedButton extends BaseButton {
|
||||
CustomOutlinedButton({
|
||||
Key? key,
|
||||
const CustomOutlinedButton({super.key,
|
||||
this.decoration,
|
||||
this.leftIcon,
|
||||
this.rightIcon,
|
||||
this.label,
|
||||
VoidCallback? onPressed,
|
||||
ButtonStyle? buttonStyle,
|
||||
TextStyle? buttonTextStyle,
|
||||
bool? isDisabled,
|
||||
Alignment? alignment,
|
||||
double? height,
|
||||
double? width,
|
||||
EdgeInsets? margin,
|
||||
required String text,
|
||||
}) : super(
|
||||
text: text,
|
||||
onPressed: onPressed,
|
||||
buttonStyle: buttonStyle,
|
||||
isDisabled: isDisabled,
|
||||
buttonTextStyle: buttonTextStyle,
|
||||
height: height,
|
||||
alignment: alignment,
|
||||
width: width,
|
||||
margin: margin,
|
||||
);
|
||||
super.onPressed,
|
||||
super.buttonStyle,
|
||||
super.buttonTextStyle,
|
||||
super.isDisabled,
|
||||
super.alignment,
|
||||
super.height,
|
||||
super.width,
|
||||
super.margin,
|
||||
required super.text,
|
||||
});
|
||||
|
||||
final BoxDecoration? decoration;
|
||||
final Widget? leftIcon;
|
||||
@@ -41,8 +30,8 @@ class CustomOutlinedButton extends BaseButton {
|
||||
return Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: Container(
|
||||
height: this.height ?? 30,
|
||||
width: this.width ?? double.maxFinite,
|
||||
height: height ?? 30,
|
||||
width: width ?? double.maxFinite,
|
||||
margin: margin,
|
||||
decoration: decoration,
|
||||
child: OutlinedButton(
|
||||
@@ -52,12 +41,12 @@ class CustomOutlinedButton extends BaseButton {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
leftIcon ?? SizedBox.shrink(),
|
||||
leftIcon ?? const SizedBox.shrink(),
|
||||
Text(
|
||||
text,
|
||||
style: buttonTextStyle ?? CustomTextStyles.titleSmallBold,
|
||||
),
|
||||
rightIcon ?? SizedBox.shrink(),
|
||||
rightIcon ?? const SizedBox.shrink(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -65,8 +54,8 @@ class CustomOutlinedButton extends BaseButton {
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
height: this.height ?? 30,
|
||||
width: this.width ?? double.maxFinite,
|
||||
height: height ?? 30,
|
||||
width: width ?? double.maxFinite,
|
||||
margin: margin,
|
||||
decoration: decoration,
|
||||
child: OutlinedButton(
|
||||
@@ -76,12 +65,12 @@ class CustomOutlinedButton extends BaseButton {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
leftIcon ?? SizedBox.shrink(),
|
||||
leftIcon ?? const SizedBox.shrink(),
|
||||
Text(
|
||||
text,
|
||||
style: buttonTextStyle ?? CustomTextStyles.titleSmallBold,
|
||||
),
|
||||
rightIcon ?? SizedBox.shrink(),
|
||||
rightIcon ?? const SizedBox.shrink(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -19,7 +19,7 @@ class CustomSearchBar extends StatelessWidget {
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
controller: searchController,
|
||||
autofocus: false,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
),
|
||||
onChanged: onChanged,
|
||||
@@ -38,7 +38,7 @@ class CustomSearchBar extends StatelessWidget {
|
||||
)
|
||||
: null,
|
||||
isDense: false,
|
||||
contentPadding: enableIcon ? EdgeInsets.all(8) : EdgeInsets.only(top: 8, left: 16, right: 8, bottom: 8),
|
||||
contentPadding: enableIcon ? const EdgeInsets.all(8) : const EdgeInsets.only(top: 8, left: 16, right: 8, bottom: 8),
|
||||
fillColor: backgroundColor ?? appTheme.gray100,
|
||||
filled: true,
|
||||
border: OutlineInputBorder(
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class CustomTextFormField extends StatelessWidget {
|
||||
CustomTextFormField({
|
||||
const CustomTextFormField({
|
||||
this.alignment,
|
||||
this.width,
|
||||
this.controller,
|
||||
@@ -97,9 +97,9 @@ class CustomTextFormField extends StatelessWidget {
|
||||
maxLength: maxLength,
|
||||
onChanged: onChanged,
|
||||
controller: controller,
|
||||
focusNode: focusNode ?? null,
|
||||
focusNode: focusNode,
|
||||
autofocus: autofocus,
|
||||
style: TextStyle(fontSize: 16, color: Colors.black, fontWeight: FontWeight.w500),
|
||||
style: const TextStyle(fontSize: 16, color: Colors.black, fontWeight: FontWeight.w500),
|
||||
obscureText: obscureText!,
|
||||
textInputAction: textInputAction,
|
||||
maxLines: maxLines,
|
||||
@@ -110,16 +110,16 @@ class CustomTextFormField extends StatelessWidget {
|
||||
counter: counter,
|
||||
suffixText: suffixText,
|
||||
hintText: hintText ?? "",
|
||||
hintStyle: hintStyle ?? TextStyle(fontSize: 16, color: Color(0xFF323F4B).withAlpha((255 / 2).toInt()), fontWeight: FontWeight.w500),
|
||||
hintStyle: hintStyle ?? TextStyle(fontSize: 16, color: const Color(0xFF323F4B).withAlpha((255 / 2).toInt()), fontWeight: FontWeight.w500),
|
||||
prefixIcon: prefix,
|
||||
prefixIconConstraints: prefixConstraints,
|
||||
suffixIcon: suffix,
|
||||
floatingLabelBehavior: FloatingLabelBehavior.always,
|
||||
suffixStyle: textStyle ?? TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xFF323F4B)),
|
||||
suffixStyle: textStyle ?? const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xFF323F4B)),
|
||||
suffixIconConstraints: suffixConstraints,
|
||||
isDense: false,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16, horizontal: 12),
|
||||
fillColor: Color(0xFFF6F6F6),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 16, horizontal: 12),
|
||||
fillColor: const Color(0xFFF6F6F6),
|
||||
filled: true,
|
||||
border:
|
||||
borderDecoration ??
|
||||
|
||||
@@ -24,34 +24,36 @@ class _DataErrorWidgetState extends State<DataErrorWidget> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SvgPicture.asset('assets/icons/cloud.svg'),
|
||||
SizedBox(height: 30),
|
||||
const SizedBox(height: 30),
|
||||
Text(s.something_went_wrong, style: TextStyles.textLSemibold.copyWith(color: appTheme.black)),
|
||||
SizedBox(height: 12),
|
||||
const SizedBox(height: 12),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32),
|
||||
child: Text(s.can_not_load_data_please_try_again, style: TextStyles.textSMedium.copyWith(color: appTheme.black), textAlign: TextAlign.center),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
isLoading
|
||||
? Loader()
|
||||
? const Loader()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: CustomOutlinedButton(
|
||||
text: s.try_again,
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(side: WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
|
||||
onPressed: () async {
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
await widget.onReload();
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
},
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: CustomOutlinedButton(
|
||||
text: s.try_again,
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
|
||||
onPressed: () async {
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
await widget.onReload();
|
||||
if (context.mounted) {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class FeedIconButton extends StatelessWidget {
|
||||
onTap: onTap ?? () {},
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ?? appTheme.gray100,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
@@ -35,7 +35,7 @@ class FeedIconButton extends StatelessWidget {
|
||||
color: iconColor ?? appTheme.gray600,
|
||||
),
|
||||
if (text != null) ...[
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
text!,
|
||||
style: TextStyles.textSMedium.copyWith(
|
||||
|
||||
@@ -55,18 +55,18 @@ class InfoRow extends StatelessWidget {
|
||||
width: 13.3,
|
||||
height: 13.3,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
switch (type) {
|
||||
ProductType.diet => '${diet?.duration} ${getDayForm(diet?.duration ?? 7, s)}',
|
||||
ProductType.plan => '${plan?.duration} ${getDayForm(plan?.duration ?? 7, s)}',
|
||||
ProductType.recipe => '${timeTitle ?? ''}',
|
||||
ProductType.recipe => timeTitle ?? '',
|
||||
},
|
||||
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
const SizedBox(width: 12),
|
||||
InfoBouble(
|
||||
backgroundColor: itemsBackgroundColor,
|
||||
children: [
|
||||
@@ -79,18 +79,18 @@ class InfoRow extends StatelessWidget {
|
||||
width: 13.3,
|
||||
height: 13.3,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
switch (type) {
|
||||
ProductType.diet => '80 человек прошли',
|
||||
ProductType.plan => '80 человек прошли',
|
||||
ProductType.recipe => (recipe?.calories.toStringAsFixed(0) ?? '0') + ' ккал',
|
||||
ProductType.recipe => '${recipe?.calories.toStringAsFixed(0) ?? '0'} ккал',
|
||||
},
|
||||
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
const SizedBox(width: 12),
|
||||
if (type == ProductType.recipe)
|
||||
InfoBouble(
|
||||
backgroundColor: itemsBackgroundColor,
|
||||
@@ -100,7 +100,7 @@ class InfoRow extends StatelessWidget {
|
||||
width: 13.3,
|
||||
height: 13.3,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${recipe?.steps?.length ?? 0} ${getStepForm(recipe?.steps?.length ?? 0)}',
|
||||
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
|
||||
|
||||
@@ -18,7 +18,7 @@ class ItemWidget extends StatelessWidget {
|
||||
width: iconSize,
|
||||
height: iconSize,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
|
||||
@@ -6,7 +6,7 @@ class Loader extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
return const Center(
|
||||
child: SizedBox(
|
||||
height: 32,
|
||||
width: 32,
|
||||
|
||||
@@ -23,10 +23,10 @@ class MainBackgroundBouble extends StatelessWidget {
|
||||
boxShadow: enableShadow
|
||||
? [
|
||||
BoxShadow(
|
||||
color: Color(0x00000000).withValues(alpha: 0.2),
|
||||
color: const Color(0x00000000).withValues(alpha: 0.2),
|
||||
spreadRadius: 0,
|
||||
blurRadius: 32,
|
||||
offset: Offset(0, 0),
|
||||
offset: const Offset(0, 0),
|
||||
),
|
||||
]
|
||||
: null,
|
||||
|
||||
94
lib/core/widgets/option_widget.dart
Normal file
94
lib/core/widgets/option_widget.dart
Normal file
@@ -0,0 +1,94 @@
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/utils/localization_utils.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_divider.dart';
|
||||
import 'package:eatvio_app/core/widgets/main_background_bouble.dart';
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/core/widgets/item_widget.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class OptionWidget extends StatelessWidget {
|
||||
const OptionWidget({super.key, required this.option, this.disableDuration = false});
|
||||
final PacketOptions? option;
|
||||
final bool disableDuration;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (option == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return MainBackgroundBouble(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
option?.short ?? '',
|
||||
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
option?.description ?? '',
|
||||
style: TextStyles.textSMedium.copyWith(color: appTheme.black),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
if (!disableDuration) ...[
|
||||
const _OptionDurationWidget(duration: 7),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
const CustomDivider(),
|
||||
const SizedBox(height: 16),
|
||||
ListView.separated(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
||||
itemBuilder: (context, index) => ItemWidget(text: option?.items[index] ?? ''),
|
||||
itemCount: option?.items.length ?? 0,
|
||||
shrinkWrap: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class _OptionDurationWidget extends StatelessWidget {
|
||||
const _OptionDurationWidget({required this.duration});
|
||||
final int duration;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return Container(
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(4), color: appTheme.cardBackground),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Container(
|
||||
width: 4,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topRight: Radius.circular(100),
|
||||
bottomRight: Radius.circular(100),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Text(
|
||||
'${s.option_duration} $duration ${getDayForm(duration, s)}',
|
||||
style: TextStyles.textSMedium.copyWith(color: appTheme.black),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ void showErrorDialog(BuildContext context, {String? title, String? description})
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.whiteA700,
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
boxShadow: [BoxShadow(color: appTheme.dialogShadow, blurRadius: 32)],
|
||||
),
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
@@ -27,12 +27,12 @@ void showErrorDialog(BuildContext context, {String? title, String? description})
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
title ?? s.some_error_occurred,
|
||||
style: TextStyles.textLSemibold.copyWith(color: appTheme.black, decoration: TextDecoration.none),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
const SizedBox(height: 12),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 72),
|
||||
child: Text(
|
||||
@@ -47,7 +47,7 @@ void showErrorDialog(BuildContext context, {String? title, String? description})
|
||||
child: Text(s.ok, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -15,11 +15,11 @@ class SuccessPublishedDietBottomSheet extends StatelessWidget {
|
||||
final s = S.of(context);
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
BottomSheetHandlerBar(),
|
||||
SizedBox(
|
||||
const BottomSheetHandlerBar(),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text(
|
||||
@@ -30,7 +30,7 @@ class SuccessPublishedDietBottomSheet extends StatelessWidget {
|
||||
'опубликованна',
|
||||
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Padding(
|
||||
@@ -43,12 +43,12 @@ class SuccessPublishedDietBottomSheet extends StatelessWidget {
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(
|
||||
side: WidgetStatePropertyAll(BorderSide.none),
|
||||
side: const WidgetStatePropertyAll(BorderSide.none),
|
||||
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -15,11 +15,11 @@ class SuccessPublishedRecipeBottomSheet extends StatelessWidget {
|
||||
final s = S.of(context);
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
BottomSheetHandlerBar(),
|
||||
SizedBox(
|
||||
const BottomSheetHandlerBar(),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text(
|
||||
@@ -30,7 +30,7 @@ class SuccessPublishedRecipeBottomSheet extends StatelessWidget {
|
||||
'"$title" ${s.successfully_published}',
|
||||
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Padding(
|
||||
@@ -43,12 +43,12 @@ class SuccessPublishedRecipeBottomSheet extends StatelessWidget {
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(
|
||||
side: WidgetStatePropertyAll(BorderSide.none),
|
||||
side: const WidgetStatePropertyAll(BorderSide.none),
|
||||
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user