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,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) {