feat(menu): add popup to recipe, diet, plan

This commit is contained in:
mso7nueh
2025-04-30 17:26:34 +03:00
parent d040f94979
commit 2ab148d0d0
7 changed files with 74 additions and 139 deletions

View File

@@ -7,6 +7,7 @@ import 'package:eatvio_app/core/enums/product_type.dart';
import 'package:eatvio_app/core/utils/localization_utils.dart';
import 'package:eatvio_app/core/widgets/bookmark_button.dart';
import 'package:eatvio_app/core/widgets/custom_divider.dart';
import 'package:eatvio_app/core/widgets/custom_popup.dart';
import 'package:eatvio_app/core/widgets/data_error_widget.dart';
import 'package:eatvio_app/core/widgets/info_row.dart';
import 'package:eatvio_app/core/widgets/loader.dart';
@@ -317,31 +318,13 @@ class _AboutDietScreenState extends State<AboutDietScreen> {
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
actions: [
PortalTarget(
visible: isMoreOptionsVisible,
portalFollower: MoreOptions(
path: 'diet/${widget.diet.id}',
complainedContentType: ComplainedContent.diet,
id: widget.diet.id,
),
anchor: const Aligned(
shiftToWithinBound: AxisFlag(x: true, y: true),
follower: Alignment.topRight,
target: Alignment.bottomRight,
),
child: IconButton(
onPressed: () {
setState(() {
isMoreOptionsVisible = !isMoreOptionsVisible;
});
},
icon: SvgPicture.asset(
'assets/icons/more_button.svg',
width: 20,
height: 20,
),
),
CustomPopup(
isAuthor: widget.diet.author.authorIsMe,
path: 'diet/${widget.diet.id}',
complainedContentType: ComplainedContent.diet,
id: widget.diet.id,
),
const SizedBox(width: 16),
],
),
body: SingleChildScrollView(

View File

@@ -3,9 +3,9 @@ import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/core/enums/complained_content.dart';
import 'package:eatvio_app/core/enums/product_type.dart';
import 'package:eatvio_app/core/widgets/bookmark_button.dart';
import 'package:eatvio_app/core/widgets/custom_popup.dart';
import 'package:eatvio_app/core/widgets/info_row.dart';
import 'package:eatvio_app/core/widgets/feed_icon_button.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/more_options.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart';
import 'package:eatvio_app/core/theme/custom_text_style.dart';
@@ -13,7 +13,6 @@ import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_portal/flutter_portal.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:share_plus/share_plus.dart';
@@ -83,28 +82,17 @@ class _DietsWidgetState extends State<DietsWidget> {
Positioned(
right: 12,
top: 12,
child: PortalTarget(
visible: isMoreOptionsVisible,
portalFollower: MoreOptions(
path: 'diet/${widget.diet.id}',
complainedContentType: ComplainedContent.diet,
id: widget.diet.id,
),
anchor: const Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight),
child: InkWell(
onTap: () {
setState(() {
isMoreOptionsVisible = !isMoreOptionsVisible;
});
},
child: SizedBox(
width: 32,
height: 24,
child: Material(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
child: const Icon(Icons.more_horiz),
),
child: SizedBox(
width: 32,
height: 24,
child: Material(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
child: CustomPopup(
isAuthor: widget.diet.author.authorIsMe,
path: 'diet/${widget.diet.id}',
id: widget.diet.id,
complainedContentType: ComplainedContent.diet,
),
),
),

View File

@@ -3,10 +3,10 @@ import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/core/enums/complained_content.dart';
import 'package:eatvio_app/core/enums/product_type.dart';
import 'package:eatvio_app/core/widgets/bookmark_button.dart';
import 'package:eatvio_app/core/widgets/custom_popup.dart';
import 'package:eatvio_app/core/widgets/info_row.dart';
import 'package:eatvio_app/core/widgets/feed_icon_button.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/more_options.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
import 'package:eatvio_app/core/theme/custom_text_style.dart';
@@ -16,7 +16,6 @@ import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_portal/flutter_portal.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:share_plus/share_plus.dart';
@@ -24,6 +23,7 @@ import 'package:share_plus/share_plus.dart';
class PlanWidget extends StatefulWidget {
final PlanModel plan;
final int index;
const PlanWidget({
super.key,
required this.plan,
@@ -87,28 +87,18 @@ class _PlanWidgetState extends State<PlanWidget> {
Positioned(
right: 12,
top: 12,
child: PortalTarget(
visible: isMoreOptionsVisible,
portalFollower: MoreOptions(
path: 'plan/${widget.plan.id}',
complainedContentType: ComplainedContent.plan,
id: widget.plan.id,
),
anchor: const Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight),
child: InkWell(
onTap: () {
setState(() {
isMoreOptionsVisible = !isMoreOptionsVisible;
});
},
child: SizedBox(
width: 32,
height: 24,
child: Material(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
child: const Icon(Icons.more_horiz),
),
child: SizedBox(
width: 32,
height: 24,
child: Material(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
child: CustomPopup(
isAuthor: widget.plan.author.authorIsMe,
path: 'plan/${widget.plan.id}',
id: widget.plan.id,
slug: widget.plan.slug,
complainedContentType: ComplainedContent.plan,
),
),
),

View File

@@ -6,8 +6,8 @@ import 'package:eatvio_app/core/enums/complained_content.dart';
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/utils/localization_utils.dart';
import 'package:eatvio_app/core/widgets/bookmark_button.dart';
import 'package:eatvio_app/core/widgets/custom_popup.dart';
import 'package:eatvio_app/core/widgets/feed_icon_button.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/more_options.dart';
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart';
@@ -16,7 +16,6 @@ import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_portal/flutter_portal.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:share_plus/share_plus.dart';
@@ -117,28 +116,17 @@ class _RecipesWidgetState extends State<RecipesWidget> {
Positioned(
right: 12,
top: 12,
child: PortalTarget(
visible: isMoreOptionsVisible,
portalFollower: MoreOptions(
complainedContentType: ComplainedContent.recipe,
path: 'recipe/${widget.recipe.slug}',
slug: widget.recipe.slug,
),
anchor: const Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight),
child: InkWell(
onTap: () {
setState(() {
isMoreOptionsVisible = !isMoreOptionsVisible;
});
},
child: SizedBox(
width: 32,
height: 24,
child: Material(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
child: const Icon(Icons.more_horiz),
),
child: SizedBox(
width: 32,
height: 24,
child: Material(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
child: CustomPopup(
isAuthor: widget.recipe.author.authorIsMe,
path: 'recipe/${widget.recipe.slug}',
slug: widget.recipe.slug,
complainedContentType: ComplainedContent.recipe,
),
),
),

View File

@@ -6,6 +6,7 @@ import 'package:eatvio_app/core/enums/complained_content.dart';
import 'package:eatvio_app/core/enums/product_type.dart';
import 'package:eatvio_app/core/utils/localization_utils.dart';
import 'package:eatvio_app/core/widgets/bookmark_button.dart';
import 'package:eatvio_app/core/widgets/custom_popup.dart';
import 'package:eatvio_app/core/widgets/data_error_widget.dart';
import 'package:eatvio_app/core/widgets/info_row.dart';
import 'package:eatvio_app/core/widgets/loader.dart';
@@ -112,31 +113,13 @@ class _AboutPlanScreenState extends State<AboutPlanScreen> {
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
actions: [
PortalTarget(
visible: isMoreOptionsVisible,
portalFollower: MoreOptions(
complainedContentType: ComplainedContent.plan,
path: 'plan/${widget.plan.id}',
slug: widget.plan.slug,
),
anchor: const Aligned(
shiftToWithinBound: AxisFlag(x: true, y: true),
follower: Alignment.topRight,
target: Alignment.bottomRight,
),
child: IconButton(
onPressed: () {
setState(() {
isMoreOptionsVisible = !isMoreOptionsVisible;
});
},
icon: SvgPicture.asset(
'assets/icons/more_button.svg',
width: 20,
height: 20,
),
),
CustomPopup(
isAuthor: widget.plan.author.authorIsMe,
path: 'plan/${widget.plan.id}',
complainedContentType: ComplainedContent.plan,
slug: widget.plan.slug,
),
const SizedBox(width: 16),
],
),
body: const Loader(),

View File

@@ -8,6 +8,7 @@ import 'package:eatvio_app/core/enums/product_type.dart';
import 'package:eatvio_app/core/utils/localization_utils.dart';
import 'package:eatvio_app/core/utils/toasts.dart';
import 'package:eatvio_app/core/widgets/bookmark_button.dart';
import 'package:eatvio_app/core/widgets/custom_popup.dart';
import 'package:eatvio_app/core/widgets/data_error_widget.dart';
import 'package:eatvio_app/core/widgets/info_row.dart';
import 'package:eatvio_app/core/widgets/loader.dart';
@@ -54,6 +55,7 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
final textEditingController = TextEditingController();
bool isMoreOptionsVisible = false;
bool _jumped = false;
@override
void initState() {
super.initState();
@@ -142,8 +144,10 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
keyboardType: TextInputType.multiline,
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1.2),
decoration: InputDecoration(
isDense: false, // убираем true, чтобы padding учитывался корректно
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен
isDense: false,
// убираем true, чтобы padding учитывался корректно
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
// вертикальный паддинг увеличен
hintText: 'Комментарий',
hintStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.w400, height: 1.2, color: Color(0xFFAEAEB2)),
filled: true,
@@ -211,23 +215,13 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
actions: [
PortalTarget(
visible: isMoreOptionsVisible,
portalFollower: MoreOptions(
complainedContentType: ComplainedContent.recipe,
path: 'recipe/${widget.recipe.slug}',
slug: widget.recipe.slug,
),
anchor: const Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight),
child: IconButton(
onPressed: () {
setState(() {
isMoreOptionsVisible = !isMoreOptionsVisible;
});
},
icon: SvgPicture.asset('assets/icons/more_button.svg', width: 20, height: 20),
),
CustomPopup(
isAuthor: widget.recipe.author.authorIsMe,
path: 'recipe/${widget.recipe.slug}',
complainedContentType: ComplainedContent.recipe,
slug: widget.recipe.slug,
),
const SizedBox(width: 16),
],
),
body: SingleChildScrollView(