import 'package:eatvio_app/core/const.dart'; import 'package:eatvio_app/core/enums/complained_content.dart'; import 'package:eatvio_app/core/utils/toasts.dart'; import 'package:eatvio_app/features/complaining/presentation/complaining_bottom_sheet.dart'; import 'package:eatvio_app/core/widgets/custom_divider.dart'; import 'package:eatvio_app/core/widgets/main_background_bouble.dart'; import 'package:eatvio_app/generated/l10n.dart'; import 'package:eatvio_app/core/theme/custom_text_style.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:share_plus/share_plus.dart'; class MoreOptions extends StatelessWidget { const MoreOptions({super.key, this.disableActions, required this.path, this.complainedContentType, this.slug, this.id}); final ComplainedContent? complainedContentType; final int? id; final String? slug; final String path; final bool? disableActions; @override Widget build(BuildContext context) { final s = S.of(context); return MainBackgroundBouble( enableShadow: true, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), child: Column( mainAxisSize: MainAxisSize.min, children: [ GestureDetector( onTap: disableActions == true ? null : () { Clipboard.setData(ClipboardData(text: '$baseUrl/ru/$path')); showInfoToast(s.link_was_copied); }, child: Row( children: [ Text( s.copy_link, style: TextStyles.textMMedium.copyWith( color: appTheme.black, ), ), Spacer(), SvgPicture.asset('assets/icons/copy2.svg', width: 16, height: 20), ], ), ), Padding( padding: const EdgeInsets.symmetric(vertical: 12.0), child: CustomDivider(), ), GestureDetector( onTap: disableActions == true ? null : () { final box = context.findRenderObject() as RenderBox?; Share.shareUri( Uri.parse( '$baseUrl/ru/$path', ), sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, ); }, child: Row( children: [ Text( s.share, style: TextStyles.textMMedium.copyWith( color: appTheme.black, ), ), Spacer(), SvgPicture.asset('assets/icons/share2.svg', width: 16, height: 20), ], ), ), Padding( padding: const EdgeInsets.symmetric(vertical: 12.0), child: CustomDivider(), ), GestureDetector( onTap: disableActions == true ? null : () { if (complainedContentType != null) { showModalBottomSheet( context: context, builder: (context) => ComplainingBottomSheet( complainedContentType: complainedContentType!, id: id, slug: slug, ), ); } }, child: Row( children: [ Text( s.complain, style: TextStyles.textMMedium.copyWith( color: appTheme.black, ), ), Spacer(), SvgPicture.asset('assets/icons/complain.svg', width: 16, height: 20), ], ), ), ], ), ), width: 272, ); } }