fix: plans - like and bookmark in consultant profile (#582)

- decouple PlanWidget from feed PlansCubit via owner-provided callbacks
- add like/favorite actions to profile PlansCubit: slug lookup, optimistic
  update, rollback of the affected plan, per-slug debounce, isClosed guards
- pass slug through like/favorite/comments events; guard out-of-range index
  in feed plans handlers and deep-link about_plan sync
- capture post like intent before await in profile blog post widget
- replace null force-unwraps in profile screen, guard indexOf == -1
- tests: profile plan like/bookmark, slug sync, bounds guards, #700 regression
This commit is contained in:
2026-11-20 16:30:13 +03:00
parent 1e8c1ab2eb
commit 0df474b2b5
22 changed files with 2139 additions and 137 deletions

View File

@@ -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 (_) {}