forked from eatvio/eatvio_app
merge upstream
This commit is contained in:
@@ -183,7 +183,10 @@ class CubitRegistrations {
|
||||
),
|
||||
);
|
||||
sl.registerFactory<profile_plans.PlansCubit>(
|
||||
() => profile_plans.PlansCubit(plansRepository: sl()),
|
||||
() => profile_plans.PlansCubit(
|
||||
plansRepository: sl(),
|
||||
planRepository: sl(),
|
||||
),
|
||||
);
|
||||
sl.registerFactory<SubCubit>(() => SubCubit(profileRepository: sl()));
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ class CustomPopup extends StatelessWidget {
|
||||
final PlanModel? plan;
|
||||
final String userSlug;
|
||||
final VoidCallback? onPostsChanged;
|
||||
final VoidCallback? onPlanChanged;
|
||||
|
||||
const CustomPopup({
|
||||
super.key,
|
||||
@@ -59,6 +60,7 @@ class CustomPopup extends StatelessWidget {
|
||||
this.plan,
|
||||
required this.userSlug,
|
||||
this.onPostsChanged,
|
||||
this.onPlanChanged,
|
||||
});
|
||||
|
||||
bool get _isAdminAuthor =>
|
||||
@@ -166,9 +168,13 @@ class CustomPopup extends StatelessWidget {
|
||||
try {
|
||||
context.read<AboutPlanCubit>().getPlan(slug: currentPlan.slug);
|
||||
} catch (_) {}
|
||||
try {
|
||||
context.read<PlansCubit>().loadPlans();
|
||||
} catch (_) {}
|
||||
if (onPlanChanged != null) {
|
||||
onPlanChanged!();
|
||||
} else {
|
||||
try {
|
||||
context.read<PlansCubit>().loadPlans();
|
||||
} catch (_) {}
|
||||
}
|
||||
try {
|
||||
context.read<MyPlansCubit>().loadPlans();
|
||||
} catch (_) {}
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:eatvio_app/core/utils/url_utils.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
import 'package:eatvio_app/features/user_details/presentation/user_details_screen.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -107,7 +108,9 @@ class AuthorCard extends StatelessWidget {
|
||||
backgroundColor: appTheme.cardBackground,
|
||||
children: [
|
||||
Text(
|
||||
'${author.authorPlaceInRating}-й в рейтинге',
|
||||
S.of(context).rating_place(
|
||||
author.authorPlaceInRating!,
|
||||
),
|
||||
style: TextStyles.textMMediumAuto.copyWith(
|
||||
color: appTheme.blueA400,
|
||||
),
|
||||
|
||||
@@ -66,11 +66,13 @@ class LikesState extends Equatable {
|
||||
final bool wasLikedByMe;
|
||||
final int totalLikes;
|
||||
final int index;
|
||||
final String? slug;
|
||||
|
||||
const LikesState({
|
||||
required this.wasLikedByMe,
|
||||
required this.totalLikes,
|
||||
required this.index,
|
||||
this.slug,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -78,37 +80,44 @@ class LikesState extends Equatable {
|
||||
wasLikedByMe,
|
||||
totalLikes,
|
||||
index,
|
||||
slug,
|
||||
];
|
||||
}
|
||||
|
||||
class FavoriteState extends Equatable {
|
||||
final bool isFavorite;
|
||||
final int index;
|
||||
final String? slug;
|
||||
|
||||
const FavoriteState({
|
||||
required this.isFavorite,
|
||||
required this.index,
|
||||
this.slug,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
isFavorite,
|
||||
index,
|
||||
slug,
|
||||
];
|
||||
}
|
||||
|
||||
class CommentsState extends Equatable {
|
||||
final int index;
|
||||
final int totalComments;
|
||||
final String? slug;
|
||||
|
||||
const CommentsState({
|
||||
required this.index,
|
||||
required this.totalComments,
|
||||
this.slug,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
index,
|
||||
totalComments,
|
||||
slug,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:easy_debounce/easy_debounce.dart';
|
||||
import 'package:eatvio_app/core/const.dart';
|
||||
import 'package:eatvio_app/core/utils/toasts.dart';
|
||||
import 'package:eatvio_app/features/diets/repositories/diet_repository.dart';
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/plans_cubit/plans_state.dart';
|
||||
import 'package:eatvio_app/features/feed/repositories/feed_repository.dart';
|
||||
import 'package:eatvio_app/features/plans/repositories/plan_repository.dart';
|
||||
@@ -87,57 +88,51 @@ class PlansCubit extends Cubit<PlansState> {
|
||||
}
|
||||
|
||||
void _changePlanLikeState(LikesState likesState) {
|
||||
final currentPlans = state.plans;
|
||||
final plansForModification = [...currentPlans];
|
||||
final currentPlan = currentPlans[likesState.index];
|
||||
|
||||
plansForModification[likesState.index] = currentPlan.copyWith(
|
||||
totalLikes: likesState.totalLikes,
|
||||
wasLikedByMe: likesState.wasLikedByMe,
|
||||
);
|
||||
emit(
|
||||
state.copyWith(
|
||||
plans: [
|
||||
...plansForModification,
|
||||
],
|
||||
isLoading: isLoading,
|
||||
errorMessage: null,
|
||||
_updatePlanAt(
|
||||
slug: likesState.slug,
|
||||
index: likesState.index,
|
||||
transform: (currentPlan) => currentPlan.copyWith(
|
||||
totalLikes: likesState.totalLikes,
|
||||
wasLikedByMe: likesState.wasLikedByMe,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _changePlanFavoriteState(FavoriteState favoriteState) {
|
||||
final currentPlans = state.plans;
|
||||
final plansForModification = [...currentPlans];
|
||||
final currentPlan = currentPlans[favoriteState.index];
|
||||
|
||||
plansForModification[favoriteState.index] = currentPlan.copyWith(
|
||||
isFavorite: favoriteState.isFavorite,
|
||||
);
|
||||
emit(
|
||||
state.copyWith(
|
||||
plans: [
|
||||
...plansForModification,
|
||||
],
|
||||
isLoading: isLoading,
|
||||
errorMessage: null,
|
||||
_updatePlanAt(
|
||||
slug: favoriteState.slug,
|
||||
index: favoriteState.index,
|
||||
transform: (currentPlan) => currentPlan.copyWith(
|
||||
isFavorite: favoriteState.isFavorite,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _changePlanCommentsState(CommentsState commentsState) {
|
||||
final currentPlans = state.plans;
|
||||
final plansForModification = [...currentPlans];
|
||||
final currentPlan = currentPlans[commentsState.index];
|
||||
|
||||
plansForModification[commentsState.index] = currentPlan.copyWith(
|
||||
totalComments: commentsState.totalComments,
|
||||
_updatePlanAt(
|
||||
slug: commentsState.slug,
|
||||
index: commentsState.index,
|
||||
transform: (currentPlan) => currentPlan.copyWith(
|
||||
totalComments: commentsState.totalComments,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _updatePlanAt({
|
||||
required String? slug,
|
||||
required int index,
|
||||
required PlanModel Function(PlanModel currentPlan) transform,
|
||||
}) {
|
||||
final currentPlans = state.plans;
|
||||
final targetIndex =
|
||||
slug != null ? currentPlans.indexWhere((plan) => plan.slug == slug) : index;
|
||||
if (targetIndex < 0 || targetIndex >= currentPlans.length) return;
|
||||
|
||||
final plansForModification = [...currentPlans];
|
||||
plansForModification[targetIndex] = transform(currentPlans[targetIndex]);
|
||||
emit(
|
||||
state.copyWith(
|
||||
plans: [
|
||||
...plansForModification,
|
||||
],
|
||||
plans: plansForModification,
|
||||
isLoading: isLoading,
|
||||
errorMessage: null,
|
||||
),
|
||||
|
||||
@@ -13,10 +13,8 @@ import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/utils/url_utils.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/plans_cubit/plans_cubit.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
@@ -24,8 +22,18 @@ import 'package:share_plus/share_plus.dart';
|
||||
class PlanWidget extends StatefulWidget {
|
||||
final PlanModel plan;
|
||||
final int index;
|
||||
final Future<void> Function(String slug)? onLikeTap;
|
||||
final Future<void> Function(String slug, bool isFavorite)? onToggleFavorite;
|
||||
final VoidCallback? onPlanChanged;
|
||||
|
||||
const PlanWidget({super.key, required this.plan, required this.index});
|
||||
const PlanWidget({
|
||||
super.key,
|
||||
required this.plan,
|
||||
required this.index,
|
||||
this.onLikeTap,
|
||||
this.onToggleFavorite,
|
||||
this.onPlanChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PlanWidget> createState() => _PlanWidgetState();
|
||||
@@ -71,17 +79,10 @@ class _PlanWidgetState extends State<PlanWidget> {
|
||||
left: 14,
|
||||
child: BookmarkButton(
|
||||
onTap: () async {
|
||||
if (widget.plan.isFavorite) {
|
||||
await context.read<PlansCubit>().removePlanFromFavorite(
|
||||
widget.plan.slug,
|
||||
widget.index,
|
||||
);
|
||||
} else {
|
||||
await context.read<PlansCubit>().addPlanToFavorite(
|
||||
widget.plan.slug,
|
||||
widget.index,
|
||||
);
|
||||
}
|
||||
await widget.onToggleFavorite?.call(
|
||||
widget.plan.slug,
|
||||
widget.plan.isFavorite,
|
||||
);
|
||||
},
|
||||
color: appTheme.whiteA700,
|
||||
isFavorite: widget.plan.isFavorite,
|
||||
@@ -111,6 +112,7 @@ class _PlanWidgetState extends State<PlanWidget> {
|
||||
plan: widget.plan,
|
||||
complainedContentType: ComplainedContent.plan,
|
||||
userSlug: widget.plan.author.authorSlug,
|
||||
onPlanChanged: widget.onPlanChanged,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -200,22 +202,25 @@ class _PlanWidgetState extends State<PlanWidget> {
|
||||
),
|
||||
subtitle: Row(
|
||||
children: [
|
||||
InfoBouble(
|
||||
radius: 12,
|
||||
backgroundColor: appTheme.gray50,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 4,
|
||||
horizontal: 10,
|
||||
),
|
||||
children: [
|
||||
Text(
|
||||
'${widget.plan.author.authorPlaceInRating}-й в рейтинге',
|
||||
style: TextStyles.textXSSemibold.copyWith(
|
||||
color: appTheme.blueA400,
|
||||
),
|
||||
if (widget.plan.author.authorPlaceInRating != null)
|
||||
InfoBouble(
|
||||
radius: 12,
|
||||
backgroundColor: appTheme.gray50,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 4,
|
||||
horizontal: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
children: [
|
||||
Text(
|
||||
s.rating_place(
|
||||
widget.plan.author.authorPlaceInRating!,
|
||||
),
|
||||
style: TextStyles.textXSSemibold.copyWith(
|
||||
color: appTheme.blueA400,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
'${widget.plan.packetsCount == 1 ? widget.plan.packet1Options?.price : '${s.from} ${widget.plan.minPriceOfOptions.toStringAsFixed(0)}'}₽',
|
||||
@@ -255,10 +260,7 @@ class _PlanWidgetState extends State<PlanWidget> {
|
||||
? appTheme.transparentBlue
|
||||
: null,
|
||||
onTap: () async {
|
||||
await context.read<PlansCubit>().likePlan(
|
||||
widget.plan.slug,
|
||||
widget.index,
|
||||
);
|
||||
await widget.onLikeTap?.call(widget.plan.slug);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
|
||||
@@ -44,7 +44,15 @@ class Plans extends StatelessWidget {
|
||||
final id = state.plans[index].id;
|
||||
handleVisibility(visibleFraction: info.visibleFraction, id: id, type: ViewableContentType.plans);
|
||||
},
|
||||
child: PlanWidget(plan: state.plans[index], index: index),
|
||||
child: PlanWidget(
|
||||
plan: state.plans[index],
|
||||
index: index,
|
||||
onLikeTap: (slug) => context.read<PlansCubit>().likePlan(slug, index),
|
||||
onToggleFavorite: (slug, isFavorite) => isFavorite
|
||||
? context.read<PlansCubit>().removePlanFromFavorite(slug, index)
|
||||
: context.read<PlansCubit>().addPlanToFavorite(slug, index),
|
||||
onPlanChanged: () => context.read<PlansCubit>().loadPlans(),
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) {
|
||||
|
||||
@@ -27,9 +27,9 @@ class AboutPlanCubit extends Cubit<AboutPlanState> {
|
||||
Future<void> getPlan({required String slug, int? index}) async {
|
||||
try {
|
||||
final plan = await planRepository.getPlan(slug);
|
||||
if (index != null) {
|
||||
planRepository.emitCommentsStateToFeed(CommentsState(index: index, totalComments: plan.totalComments));
|
||||
}
|
||||
planRepository.emitCommentsStateToFeed(
|
||||
CommentsState(index: index ?? 0, totalComments: plan.totalComments, slug: slug),
|
||||
);
|
||||
emit(state.copyWith(planModel: plan, error: null));
|
||||
} catch (e, stackTrace) {
|
||||
await reportFrom(e, stackTrace, this);
|
||||
@@ -59,14 +59,20 @@ class AboutPlanCubit extends Cubit<AboutPlanState> {
|
||||
if (currentPlan == null) return;
|
||||
if (currentPlan.wasLikedByMe) {
|
||||
emit(state.copyWith(planModel: currentPlan.copyWith(wasLikedByMe: false, totalLikes: currentPlan.totalLikes - 1), error: null));
|
||||
if (index != null) {
|
||||
planRepository.emitLikesStateToFeed(LikesState(wasLikedByMe: false, totalLikes: currentPlan.totalLikes - 1, index: index));
|
||||
}
|
||||
planRepository.emitLikesStateToFeed(LikesState(
|
||||
wasLikedByMe: false,
|
||||
totalLikes: currentPlan.totalLikes - 1,
|
||||
index: index ?? 0,
|
||||
slug: slug,
|
||||
));
|
||||
} else {
|
||||
emit(state.copyWith(planModel: currentPlan.copyWith(wasLikedByMe: true, totalLikes: currentPlan.totalLikes + 1), error: null));
|
||||
if (index != null) {
|
||||
planRepository.emitLikesStateToFeed(LikesState(wasLikedByMe: true, totalLikes: currentPlan.totalLikes + 1, index: index));
|
||||
}
|
||||
planRepository.emitLikesStateToFeed(LikesState(
|
||||
wasLikedByMe: true,
|
||||
totalLikes: currentPlan.totalLikes + 1,
|
||||
index: index ?? 0,
|
||||
slug: slug,
|
||||
));
|
||||
}
|
||||
|
||||
EasyDebounce.debounce('like_plan_$slug', const Duration(seconds: 1), () async {
|
||||
@@ -75,9 +81,12 @@ class AboutPlanCubit extends Cubit<AboutPlanState> {
|
||||
} catch (e, st) {
|
||||
await reportFrom(e, st, this);
|
||||
log(e.toString());
|
||||
if (index != null) {
|
||||
planRepository.emitLikesStateToFeed(LikesState(wasLikedByMe: currentPlan.wasLikedByMe, totalLikes: currentPlan.totalLikes, index: index));
|
||||
}
|
||||
planRepository.emitLikesStateToFeed(LikesState(
|
||||
wasLikedByMe: currentPlan.wasLikedByMe,
|
||||
totalLikes: currentPlan.totalLikes,
|
||||
index: index ?? 0,
|
||||
slug: slug,
|
||||
));
|
||||
emit(state.copyWith(planModel: currentPlan, error: null));
|
||||
}
|
||||
});
|
||||
@@ -88,9 +97,9 @@ class AboutPlanCubit extends Cubit<AboutPlanState> {
|
||||
if (currentPlan == null) return;
|
||||
|
||||
emit(state.copyWith(planModel: currentPlan.copyWith(isFavorite: true)));
|
||||
if (index != null) {
|
||||
planRepository.emitFavoriteStateToFeed(FavoriteState(isFavorite: true, index: index));
|
||||
}
|
||||
planRepository.emitFavoriteStateToFeed(
|
||||
FavoriteState(isFavorite: true, index: index ?? 0, slug: slug),
|
||||
);
|
||||
EasyDebounce.debounce('add_or_remove_plan_to_favorites', const Duration(seconds: 1), () async {
|
||||
try {
|
||||
await planRepository.addToFavorite(slug);
|
||||
@@ -98,9 +107,9 @@ class AboutPlanCubit extends Cubit<AboutPlanState> {
|
||||
await reportFrom(e, st, this);
|
||||
log(e.toString());
|
||||
showErrorToast('Произошла ошибка. Попробуйте ещё раз через некоторое время');
|
||||
if (index != null) {
|
||||
planRepository.emitFavoriteStateToFeed(FavoriteState(isFavorite: currentPlan.isFavorite, index: index));
|
||||
}
|
||||
planRepository.emitFavoriteStateToFeed(
|
||||
FavoriteState(isFavorite: currentPlan.isFavorite, index: index ?? 0, slug: slug),
|
||||
);
|
||||
emit(state.copyWith(planModel: currentPlan, error: null));
|
||||
}
|
||||
});
|
||||
@@ -111,9 +120,9 @@ class AboutPlanCubit extends Cubit<AboutPlanState> {
|
||||
if (currentPlan == null) return;
|
||||
|
||||
emit(state.copyWith(planModel: currentPlan.copyWith(isFavorite: false)));
|
||||
if (index != null) {
|
||||
planRepository.emitFavoriteStateToFeed(FavoriteState(isFavorite: false, index: index));
|
||||
}
|
||||
planRepository.emitFavoriteStateToFeed(
|
||||
FavoriteState(isFavorite: false, index: index ?? 0, slug: slug),
|
||||
);
|
||||
EasyDebounce.debounce('add_or_remove_plan_to_favorites', const Duration(seconds: 1), () async {
|
||||
try {
|
||||
await planRepository.removeFromFavorite(slug);
|
||||
@@ -121,9 +130,9 @@ class AboutPlanCubit extends Cubit<AboutPlanState> {
|
||||
await reportFrom(e, st, this);
|
||||
log(e.toString());
|
||||
showErrorToast('Произошла ошибка. Попробуйте ещё раз через некоторое время');
|
||||
if (index != null) {
|
||||
planRepository.emitFavoriteStateToFeed(FavoriteState(isFavorite: currentPlan.isFavorite, index: index));
|
||||
}
|
||||
planRepository.emitFavoriteStateToFeed(
|
||||
FavoriteState(isFavorite: currentPlan.isFavorite, index: index ?? 0, slug: slug),
|
||||
);
|
||||
emit(state.copyWith(planModel: currentPlan, error: null));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -12,9 +12,9 @@ class PlanRepository {
|
||||
final _planLikeStateStreamController = StreamController<LikesState>.broadcast();
|
||||
final _planFavoriteStateStreamController = StreamController<FavoriteState>.broadcast();
|
||||
final _planCommentsStateStreamController = StreamController<CommentsState>.broadcast();
|
||||
Stream get planLikeState => _planLikeStateStreamController.stream;
|
||||
Stream get planFavoriteState => _planFavoriteStateStreamController.stream;
|
||||
Stream get planCommentsState => _planCommentsStateStreamController.stream;
|
||||
Stream<LikesState> get planLikeState => _planLikeStateStreamController.stream;
|
||||
Stream<FavoriteState> get planFavoriteState => _planFavoriteStateStreamController.stream;
|
||||
Stream<CommentsState> get planCommentsState => _planCommentsStateStreamController.stream;
|
||||
|
||||
Future<PlanModel> getPlan(String slug) async {
|
||||
return planService.getPlan(slug);
|
||||
|
||||
@@ -1,25 +1,197 @@
|
||||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:easy_debounce/easy_debounce.dart';
|
||||
import 'package:eatvio_app/core/error_reporting/report_from.dart';
|
||||
import 'package:eatvio_app/core/utils/toasts.dart';
|
||||
import 'package:eatvio_app/features/diets/repositories/diet_repository.dart';
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/plans/repositories/plan_repository.dart';
|
||||
import 'package:eatvio_app/features/plans/repositories/plans_repository.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/bloc/plans_cubit/plans_state.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:eatvio_app/core/error_reporting/report_from.dart';
|
||||
|
||||
class PlansCubit extends Cubit<PlansState> {
|
||||
final PlansRepository plansRepository;
|
||||
final PlanRepository planRepository;
|
||||
|
||||
static const Duration _debounceDuration = Duration(milliseconds: 200);
|
||||
|
||||
late final StreamSubscription<LikesState> likesStateSubscription;
|
||||
late final StreamSubscription<FavoriteState> favoriteStateSubscription;
|
||||
late final StreamSubscription<CommentsState> commentsStateSubscription;
|
||||
|
||||
final Set<String> _pendingDebounceTags = {};
|
||||
|
||||
PlansCubit({
|
||||
required this.plansRepository,
|
||||
}) : super(const PlansState());
|
||||
required this.planRepository,
|
||||
}) : super(const PlansState()) {
|
||||
likesStateSubscription = planRepository.planLikeState.listen(_changePlanLikeState);
|
||||
favoriteStateSubscription = planRepository.planFavoriteState.listen(_changePlanFavoriteState);
|
||||
commentsStateSubscription = planRepository.planCommentsState.listen(_changePlanCommentsState);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> close() async {
|
||||
for (final tag in _pendingDebounceTags) {
|
||||
EasyDebounce.cancel(tag);
|
||||
}
|
||||
_pendingDebounceTags.clear();
|
||||
await likesStateSubscription.cancel();
|
||||
await favoriteStateSubscription.cancel();
|
||||
await commentsStateSubscription.cancel();
|
||||
await super.close();
|
||||
}
|
||||
|
||||
Future<void> getPlans(String slug) async {
|
||||
emit(const PlansState.loading());
|
||||
try {
|
||||
emit(PlansState.loaded(plansList: await plansRepository.getPlansBySlug(slug)));
|
||||
final plansList = await plansRepository.getPlansBySlug(slug);
|
||||
if (!isClosed) emit(PlansState.loaded(plansList: plansList));
|
||||
} catch (e, st) {
|
||||
await reportFrom(e, st, this);
|
||||
log(e.toString());
|
||||
emit(PlansState.error(errorMessage: e.toString()));
|
||||
if (!isClosed) emit(PlansState.error(errorMessage: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> likePlan(String slug) async {
|
||||
final plan = _planBySlug(slug);
|
||||
if (plan == null) return;
|
||||
|
||||
final wasLikedByMe = plan.wasLikedByMe;
|
||||
final totalLikes = plan.totalLikes;
|
||||
|
||||
_updatePlanBySlug(
|
||||
slug,
|
||||
(plan) => plan.copyWith(
|
||||
wasLikedByMe: !plan.wasLikedByMe,
|
||||
totalLikes: plan.wasLikedByMe ? plan.totalLikes - 1 : plan.totalLikes + 1,
|
||||
),
|
||||
);
|
||||
|
||||
_debounce('profile_like_plan_$slug', () async {
|
||||
try {
|
||||
await planRepository.likePlan(slug);
|
||||
} catch (e, st) {
|
||||
await reportFrom(e, st, this);
|
||||
if (isClosed) return;
|
||||
_updatePlanBySlug(
|
||||
slug,
|
||||
(plan) => plan.copyWith(wasLikedByMe: wasLikedByMe, totalLikes: totalLikes),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> addPlanToFavorite(String slug) => _changeFavorite(slug, true);
|
||||
|
||||
Future<void> removePlanFromFavorite(String slug) => _changeFavorite(slug, false);
|
||||
|
||||
Future<void> _changeFavorite(String slug, bool isFavorite) async {
|
||||
final plan = _planBySlug(slug);
|
||||
if (plan == null) return;
|
||||
|
||||
final previousIsFavorite = plan.isFavorite;
|
||||
|
||||
_updatePlanBySlug(slug, (plan) => plan.copyWith(isFavorite: isFavorite));
|
||||
|
||||
_debounce('profile_favorite_$slug', () async {
|
||||
try {
|
||||
if (isFavorite) {
|
||||
await planRepository.addToFavorite(slug);
|
||||
} else {
|
||||
await planRepository.removeFromFavorite(slug);
|
||||
}
|
||||
} catch (e, st) {
|
||||
await reportFrom(e, st, this);
|
||||
if (isClosed) return;
|
||||
_updatePlanBySlug(slug, (plan) => plan.copyWith(isFavorite: previousIsFavorite));
|
||||
showErrorToast(S.current.error_try_again_later);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _changePlanLikeState(LikesState likesState) {
|
||||
_updatePlan(
|
||||
slug: likesState.slug,
|
||||
index: likesState.index,
|
||||
transform: (plan) => plan.copyWith(
|
||||
totalLikes: likesState.totalLikes,
|
||||
wasLikedByMe: likesState.wasLikedByMe,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _changePlanFavoriteState(FavoriteState favoriteState) {
|
||||
_updatePlan(
|
||||
slug: favoriteState.slug,
|
||||
index: favoriteState.index,
|
||||
transform: (plan) => plan.copyWith(isFavorite: favoriteState.isFavorite),
|
||||
);
|
||||
}
|
||||
|
||||
void _changePlanCommentsState(CommentsState commentsState) {
|
||||
_updatePlan(
|
||||
slug: commentsState.slug,
|
||||
index: commentsState.index,
|
||||
transform: (plan) => plan.copyWith(totalComments: commentsState.totalComments),
|
||||
);
|
||||
}
|
||||
|
||||
void _updatePlan({
|
||||
required String? slug,
|
||||
required int index,
|
||||
required PlanModel Function(PlanModel plan) transform,
|
||||
}) {
|
||||
if (slug != null) {
|
||||
_updatePlanBySlug(slug, transform);
|
||||
} else {
|
||||
_updatePlanByIndex(index, transform);
|
||||
}
|
||||
}
|
||||
|
||||
void _updatePlanBySlug(String slug, PlanModel Function(PlanModel plan) transform) {
|
||||
final current = state;
|
||||
if (current is! PlansStateLoaded || isClosed) return;
|
||||
|
||||
final index = current.plansList.indexWhere((plan) => plan.slug == slug);
|
||||
if (index == -1) return;
|
||||
|
||||
_emitPlanAt(current, index, transform);
|
||||
}
|
||||
|
||||
void _updatePlanByIndex(int index, PlanModel Function(PlanModel plan) transform) {
|
||||
final current = state;
|
||||
if (current is! PlansStateLoaded || isClosed) return;
|
||||
if (index < 0 || index >= current.plansList.length) return;
|
||||
|
||||
_emitPlanAt(current, index, transform);
|
||||
}
|
||||
|
||||
void _emitPlanAt(PlansStateLoaded current, int index, PlanModel Function(PlanModel plan) transform) {
|
||||
final plansList = [...current.plansList];
|
||||
plansList[index] = transform(plansList[index]);
|
||||
emit(current.copyWith(plansList: plansList));
|
||||
}
|
||||
|
||||
PlanModel? _planBySlug(String slug) {
|
||||
final current = state;
|
||||
if (current is! PlansStateLoaded) return null;
|
||||
|
||||
for (final plan in current.plansList) {
|
||||
if (plan.slug == slug) return plan;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void _debounce(String tag, Future<void> Function() action) {
|
||||
_pendingDebounceTags.add(tag);
|
||||
EasyDebounce.debounce(tag, _debounceDuration, () async {
|
||||
_pendingDebounceTags.remove(tag);
|
||||
await action();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +97,7 @@ class ProfileCubit extends Cubit<ProfileState> {
|
||||
void updateFeedBlogPostList(FeedBlogPostModel feedBlogPostModel, bool wasLikedByMe) {
|
||||
List<FeedBlogPostModel> feedBlogPostList = [...(state as ProfileStateLoaded).blogPosts];
|
||||
final int index = feedBlogPostList.indexOf(feedBlogPostModel);
|
||||
if (index == -1) return;
|
||||
feedBlogPostList[index] = feedBlogPostModel.copyWith(
|
||||
wasLikedByMe: wasLikedByMe,
|
||||
totalLikes: wasLikedByMe == false ? feedBlogPostList[index].totalLikes - 1 : feedBlogPostList[index].totalLikes + 1,
|
||||
|
||||
@@ -205,24 +205,27 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF6FAFF),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'${state.consultantInfo!.ratingPlace}-й в рейтинге',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: appTheme.blueA400,
|
||||
if (state.consultantInfo!.ratingPlace != null)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF6FAFF),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
S.of(context).rating_place(
|
||||
state.consultantInfo!.ratingPlace!,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: appTheme.blueA400,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (state
|
||||
@@ -331,6 +334,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
}
|
||||
|
||||
Scaffold _myProfileScreen(ProfileStateLoaded state) {
|
||||
final consultantInfo = state.consultantInfo;
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey.shade200,
|
||||
appBar: AppBar(
|
||||
@@ -360,7 +364,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
_header(state),
|
||||
if (state.profile.roles.contains('consultant'))
|
||||
if (state.profile.roles.contains('consultant') &&
|
||||
consultantInfo != null)
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -376,31 +381,30 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF6FAFF),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'${state.consultantInfo!.ratingPlace}-й в рейтинге',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: appTheme.blueA400,
|
||||
if (consultantInfo.ratingPlace != null)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF6FAFF),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
S.of(context).rating_place(
|
||||
consultantInfo.ratingPlace!,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: appTheme.blueA400,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (state
|
||||
.consultantInfo!
|
||||
.educationModel
|
||||
.hasMedicalEducation ==
|
||||
1)
|
||||
if (consultantInfo.educationModel.hasMedicalEducation == 1)
|
||||
const Row(
|
||||
children: [
|
||||
SizedBox(width: 16),
|
||||
@@ -451,6 +455,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
if (!state.profile.roles.contains('consultant') || hidePlans) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final profileSlug = state.profile.slug;
|
||||
return BlocBuilder<PlansCubit, PlansState>(
|
||||
bloc: plansCubit,
|
||||
builder: (BuildContext context, PlansState state) {
|
||||
@@ -486,7 +491,15 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
});
|
||||
},
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return PlanWidget(plan: state.plansList[index], index: index);
|
||||
return PlanWidget(
|
||||
plan: state.plansList[index],
|
||||
index: index,
|
||||
onLikeTap: (slug) => plansCubit.likePlan(slug),
|
||||
onToggleFavorite: (slug, isFavorite) => isFavorite
|
||||
? plansCubit.removePlanFromFavorite(slug)
|
||||
: plansCubit.addPlanToFavorite(slug),
|
||||
onPlanChanged: () => plansCubit.getPlans(profileSlug),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
@@ -895,10 +908,11 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
}
|
||||
|
||||
SingleChildRenderObjectWidget _socialLinks(ProfileStateLoaded state) {
|
||||
if (!state.profile.roles.contains('consultant') &&
|
||||
state.consultantInfo != null) {
|
||||
final consultantInfo = state.consultantInfo;
|
||||
if (!state.profile.roles.contains('consultant') || consultantInfo == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final educationModel = consultantInfo.educationModel;
|
||||
return Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 4) +
|
||||
@@ -913,47 +927,34 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
_socialLinkButton(
|
||||
() {
|
||||
launchUrl(
|
||||
Uri.parse(
|
||||
state.consultantInfo!.educationModel.vkLink ?? '',
|
||||
),
|
||||
Uri.parse(educationModel.vkLink ?? ''),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
},
|
||||
'assets/icons/vk.svg',
|
||||
state.consultantInfo!.educationModel.vkLink!.isEmpty
|
||||
? true
|
||||
: false,
|
||||
educationModel.vkLink?.isEmpty ?? true,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_socialLinkButton(
|
||||
() {
|
||||
launchUrl(
|
||||
Uri.parse(
|
||||
state.consultantInfo!.educationModel.tgLink ?? '',
|
||||
),
|
||||
Uri.parse(educationModel.tgLink ?? ''),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
},
|
||||
'assets/icons/telegram.svg',
|
||||
state.consultantInfo!.educationModel.tgLink!.isEmpty
|
||||
? true
|
||||
: false,
|
||||
educationModel.tgLink?.isEmpty ?? true,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_socialLinkButton(
|
||||
() {
|
||||
launchUrl(
|
||||
Uri.parse(
|
||||
state.consultantInfo!.educationModel.personalSiteLink ??
|
||||
'',
|
||||
),
|
||||
Uri.parse(educationModel.personalSiteLink ?? ''),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
},
|
||||
'assets/icons/web.svg',
|
||||
state.consultantInfo!.educationModel.personalSiteLink!.isEmpty
|
||||
? true
|
||||
: false,
|
||||
educationModel.personalSiteLink?.isEmpty ?? true,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -191,21 +191,24 @@ class _ProfileBlogPostWidgetState extends State<ProfileBlogPostWidget> {
|
||||
? Colors.red.withValues(alpha: 0.8)
|
||||
: null,
|
||||
onTap: () async {
|
||||
final nextLiked = !isLiked;
|
||||
setState(() {
|
||||
isLiked = !isLiked;
|
||||
isLiked ? totalLikes++ : totalLikes--;
|
||||
isLiked = nextLiked;
|
||||
nextLiked ? totalLikes++ : totalLikes--;
|
||||
});
|
||||
isLiked
|
||||
? await context.read<FeedCubit>().likePost(
|
||||
post.id,
|
||||
)
|
||||
: await context.read<FeedCubit>().unlikedPost(
|
||||
post.id,
|
||||
);
|
||||
widget.profileCubit.updateFeedBlogPostList(
|
||||
post,
|
||||
isLiked ? false : true,
|
||||
nextLiked,
|
||||
);
|
||||
if (nextLiked) {
|
||||
await context.read<FeedCubit>().likePost(
|
||||
post.id,
|
||||
);
|
||||
} else {
|
||||
await context.read<FeedCubit>().unlikedPost(
|
||||
post.id,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
@@ -76,28 +76,30 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
static String m22(percent, amount) =>
|
||||
"Discount ${percent}% — you save ${amount} ₽";
|
||||
|
||||
static String m23(date) => "Start: ${date}";
|
||||
static String m23(place) => "#${place} in the ranking";
|
||||
|
||||
static String m24(step) => "шаг ${step} из 2";
|
||||
static String m24(date) => "Start: ${date}";
|
||||
|
||||
static String m25(planName, name) =>
|
||||
static String m25(step) => "шаг ${step} из 2";
|
||||
|
||||
static String m26(planName, name) =>
|
||||
"Завтра начинается план «${planName}» с пользователем ${name}";
|
||||
|
||||
static String m26(planName) =>
|
||||
static String m27(planName) =>
|
||||
"Завтра начнется прохождение плана «${planName}»";
|
||||
|
||||
static String m27(name, planName) =>
|
||||
static String m28(name, planName) =>
|
||||
"Пользователь ${name} отменил подписку на план «${planName}»";
|
||||
|
||||
static String m28(name, planName) =>
|
||||
static String m29(name, planName) =>
|
||||
"Пользователь ${name} оплатил план «${planName}»";
|
||||
|
||||
static String m29(name, planName) =>
|
||||
static String m30(name, planName) =>
|
||||
"Пользователь ${name} подписался на план «${planName}»";
|
||||
|
||||
static String m30(percent) => "Downloading… ${percent}%";
|
||||
static String m31(percent) => "Downloading… ${percent}%";
|
||||
|
||||
static String m31(planName) => "Вы отменили подписку на план «${planName}»";
|
||||
static String m32(planName) => "Вы отменили подписку на план «${planName}»";
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
||||
@@ -451,6 +453,9 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"error_desc": MessageLookupByLibrary.simpleMessage(
|
||||
"Произошла ошибка. Мы уже работаем над её устранением. Попробуйте позже",
|
||||
),
|
||||
"error_try_again_later": MessageLookupByLibrary.simpleMessage(
|
||||
"Something went wrong. Please try again later.",
|
||||
),
|
||||
"exit": MessageLookupByLibrary.simpleMessage("Выйти"),
|
||||
"expand": MessageLookupByLibrary.simpleMessage("Показать полностью"),
|
||||
"explainResonOfCancelation": MessageLookupByLibrary.simpleMessage(
|
||||
@@ -958,6 +963,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"rating_history": MessageLookupByLibrary.simpleMessage(
|
||||
"Начисление рейтинга",
|
||||
),
|
||||
"rating_place": m23,
|
||||
"reasonExample": MessageLookupByLibrary.simpleMessage("Заказал по ошибке"),
|
||||
"recipe_author": MessageLookupByLibrary.simpleMessage("Автор рецепта"),
|
||||
"recipe_publishing": MessageLookupByLibrary.simpleMessage(
|
||||
@@ -1051,13 +1057,13 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"Выбрана дата старта",
|
||||
),
|
||||
"startDiet": MessageLookupByLibrary.simpleMessage("Начать диету"),
|
||||
"start_date_label": m23,
|
||||
"start_date_label": m24,
|
||||
"statistic": MessageLookupByLibrary.simpleMessage("Статистика"),
|
||||
"step": MessageLookupByLibrary.simpleMessage("Шаг"),
|
||||
"step_by_step_photo_recipe": MessageLookupByLibrary.simpleMessage(
|
||||
"Пошаговый фоторецепт",
|
||||
),
|
||||
"step_widget": m24,
|
||||
"step_widget": m25,
|
||||
"successfully_published": MessageLookupByLibrary.simpleMessage(
|
||||
"успешно опубликован",
|
||||
),
|
||||
@@ -1082,8 +1088,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"toOffer": MessageLookupByLibrary.simpleMessage("Предложить"),
|
||||
"to_draft": MessageLookupByLibrary.simpleMessage("В черновик"),
|
||||
"to_order": MessageLookupByLibrary.simpleMessage("Заказать"),
|
||||
"tommorowPlanWithUserWillStart": m25,
|
||||
"tomorrowYourPlanWillStart": m26,
|
||||
"tommorowPlanWithUserWillStart": m26,
|
||||
"tomorrowYourPlanWillStart": m27,
|
||||
"try_again": MessageLookupByLibrary.simpleMessage("Попробовать снова"),
|
||||
"try_again_2": MessageLookupByLibrary.simpleMessage("Попробуйте ещё раз"),
|
||||
"typeAmoutOfReturn": MessageLookupByLibrary.simpleMessage(
|
||||
@@ -1117,7 +1123,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"Верхние показатели давления:",
|
||||
),
|
||||
"upper": MessageLookupByLibrary.simpleMessage("Верхнее"),
|
||||
"userCanceldThePlanSubscription": m27,
|
||||
"userCanceldThePlanSubscription": m28,
|
||||
"userConfirmedPlanCompletion": MessageLookupByLibrary.simpleMessage(
|
||||
"Пользователь подтвердил прохождения плана. В ближайшее время Вы получите",
|
||||
),
|
||||
@@ -1125,8 +1131,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
MessageLookupByLibrary.simpleMessage(
|
||||
"Пользователь подтвердил прохождения плана.",
|
||||
),
|
||||
"userPaidThePlan": m28,
|
||||
"userSubscribedToPlan": m29,
|
||||
"userPaidThePlan": m29,
|
||||
"userSubscribedToPlan": m30,
|
||||
"user_authorization": MessageLookupByLibrary.simpleMessage(
|
||||
"Аутентификация",
|
||||
),
|
||||
@@ -1213,7 +1219,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"video_call_recordings_downloading": MessageLookupByLibrary.simpleMessage(
|
||||
"Downloading…",
|
||||
),
|
||||
"video_call_recordings_downloading_percent": m30,
|
||||
"video_call_recordings_downloading_percent": m31,
|
||||
"video_call_recordings_empty": MessageLookupByLibrary.simpleMessage(
|
||||
"No video consultations yet",
|
||||
),
|
||||
@@ -1307,7 +1313,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"youCanComplain": MessageLookupByLibrary.simpleMessage(
|
||||
"Если вас что-то не устроило, вы можете подать жалобу",
|
||||
),
|
||||
"youCanceledSubscriptionToPlan": m31,
|
||||
"youCanceledSubscriptionToPlan": m32,
|
||||
"youShureYouWantToCancelOrder": MessageLookupByLibrary.simpleMessage(
|
||||
"Вы уверены, что хотите отменить заказ?",
|
||||
),
|
||||
|
||||
@@ -69,9 +69,11 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
static String m22(percent, amount) =>
|
||||
"Скидка ${percent}% — вы экономите ${amount} ₽";
|
||||
|
||||
static String m23(date) => "Старт: ${date}";
|
||||
static String m23(place) => "${place}-й в рейтинге";
|
||||
|
||||
static String m30(percent) => "Скачивание… ${percent}%";
|
||||
static String m24(date) => "Старт: ${date}";
|
||||
|
||||
static String m31(percent) => "Скачивание… ${percent}%";
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
||||
@@ -227,6 +229,9 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"enter_promo_code": MessageLookupByLibrary.simpleMessage(
|
||||
"Введите промокод",
|
||||
),
|
||||
"error_try_again_later": MessageLookupByLibrary.simpleMessage(
|
||||
"Произошла ошибка. Попробуйте ещё раз через некоторое время",
|
||||
),
|
||||
"exit": MessageLookupByLibrary.simpleMessage("Выйти"),
|
||||
"expand": MessageLookupByLibrary.simpleMessage("Показать полностью"),
|
||||
"fats": MessageLookupByLibrary.simpleMessage("Жиры"),
|
||||
@@ -560,6 +565,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"public_diet_state": MessageLookupByLibrary.simpleMessage("Публичная"),
|
||||
"publish": MessageLookupByLibrary.simpleMessage("Опубликовать"),
|
||||
"published": MessageLookupByLibrary.simpleMessage("Опубликованные"),
|
||||
"rating_place": m23,
|
||||
"removeFromActive": MessageLookupByLibrary.simpleMessage(
|
||||
"Снять с публикации",
|
||||
),
|
||||
@@ -609,7 +615,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"Выбрана дата старта",
|
||||
),
|
||||
"startDiet": MessageLookupByLibrary.simpleMessage("Начать диету"),
|
||||
"start_date_label": m23,
|
||||
"start_date_label": m24,
|
||||
"suggestDiet": MessageLookupByLibrary.simpleMessage("Предложить диету"),
|
||||
"tell_your_schedule": MessageLookupByLibrary.simpleMessage(
|
||||
"Расскажите в свободной форме о том как просыпаетесь, когда едите, когда ложитесь спать:",
|
||||
@@ -708,7 +714,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"video_call_recordings_downloading": MessageLookupByLibrary.simpleMessage(
|
||||
"Скачивание…",
|
||||
),
|
||||
"video_call_recordings_downloading_percent": m30,
|
||||
"video_call_recordings_downloading_percent": m31,
|
||||
"video_call_recordings_empty": MessageLookupByLibrary.simpleMessage(
|
||||
"Пока нет видеоконсультаций",
|
||||
),
|
||||
|
||||
@@ -5531,6 +5531,26 @@ class S {
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `#{place} in the ranking`
|
||||
String rating_place(int place) {
|
||||
return Intl.message(
|
||||
'#$place in the ranking',
|
||||
name: 'rating_place',
|
||||
desc: '',
|
||||
args: [place],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Something went wrong. Please try again later.`
|
||||
String get error_try_again_later {
|
||||
return Intl.message(
|
||||
'Something went wrong. Please try again later.',
|
||||
name: 'error_try_again_later',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
||||
|
||||
@@ -838,5 +838,12 @@
|
||||
"video_call_recordings_period_week": "7 days",
|
||||
"video_call_recordings_period_current_month": "Current month",
|
||||
"video_call_recordings_period_prev_month": "Previous month",
|
||||
"video_call_recordings_period_all": "All time"
|
||||
"video_call_recordings_period_all": "All time",
|
||||
"rating_place": "#{place} in the ranking",
|
||||
"@rating_place": {
|
||||
"placeholders": {
|
||||
"place": {"type": "int"}
|
||||
}
|
||||
},
|
||||
"error_try_again_later": "Something went wrong. Please try again later."
|
||||
}
|
||||
|
||||
@@ -593,5 +593,12 @@
|
||||
"video_call_recordings_period_week": "7 дней",
|
||||
"video_call_recordings_period_current_month": "Текущий месяц",
|
||||
"video_call_recordings_period_prev_month": "Прошлый месяц",
|
||||
"video_call_recordings_period_all": "Всё время"
|
||||
"video_call_recordings_period_all": "Всё время",
|
||||
"rating_place": "{place}-й в рейтинге",
|
||||
"@rating_place": {
|
||||
"placeholders": {
|
||||
"place": {"type": "int"}
|
||||
}
|
||||
},
|
||||
"error_try_again_later": "Произошла ошибка. Попробуйте ещё раз через некоторое время"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user