forked from eatvio/eatvio_app
126 lines
4.5 KiB
Dart
126 lines
4.5 KiB
Dart
import 'package:eatvio_app/core/app_config.dart';
|
|
import 'package:eatvio_app/core/enums/complained_content.dart';
|
|
import 'package:eatvio_app/core/locator_service.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,
|
|
width: 272,
|
|
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: '${sl<AppConfig>().baseUrl}/ru/$path'));
|
|
showInfoToast(s.link_was_copied);
|
|
},
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
s.copy_link,
|
|
style: TextStyles.textMMedium.copyWith(
|
|
color: appTheme.black,
|
|
),
|
|
),
|
|
),
|
|
SvgPicture.asset('assets/icons/copy2.svg', width: 16, height: 20),
|
|
],
|
|
),
|
|
),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(vertical: 12.0),
|
|
child: CustomDivider(),
|
|
),
|
|
GestureDetector(
|
|
onTap: disableActions == true
|
|
? null
|
|
: () {
|
|
final box = context.findRenderObject() as RenderBox?;
|
|
SharePlus.instance.share(
|
|
ShareParams(
|
|
uri: Uri.parse('${sl<AppConfig>().baseUrl}/ru/$path',),
|
|
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
|
),
|
|
);
|
|
},
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
s.share,
|
|
style: TextStyles.textMMedium.copyWith(
|
|
color: appTheme.black,
|
|
),
|
|
),
|
|
),
|
|
SvgPicture.asset('assets/icons/share2.svg', width: 16, height: 20),
|
|
],
|
|
),
|
|
),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(vertical: 12.0),
|
|
child: CustomDivider(),
|
|
),
|
|
GestureDetector(
|
|
onTap: disableActions == true
|
|
? null
|
|
: () {
|
|
if (complainedContentType != null) {
|
|
showModalBottomSheet(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
builder: (context) => ComplainingBottomSheet(
|
|
complainedContentType: complainedContentType!,
|
|
id: id,
|
|
slug: slug,
|
|
),
|
|
);
|
|
}
|
|
},
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
s.complain,
|
|
style: TextStyles.textMMedium.copyWith(
|
|
color: appTheme.black,
|
|
),
|
|
),
|
|
),
|
|
SvgPicture.asset('assets/icons/complain.svg', width: 16, height: 20),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|