Files
eatvio_app/lib/features/diets/presentation/widgets/more_options.dart
2025-01-22 15:27:10 +03:00

109 lines
3.6 KiB
Dart

import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/core/utils/toasts.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:go_router/go_router.dart';
import 'package:share_plus/share_plus.dart';
class MoreOptions extends StatelessWidget {
const MoreOptions({super.key, this.disableActions, required this.path});
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
: () {
context.push('complainingScreen');
},
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,
);
}
}