Add sub link share

This commit is contained in:
problematicconsumer
2023-11-12 22:22:20 +03:30
parent 577bb3ded3
commit c1d3c5445f
6 changed files with 37 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
import 'package:hiddify/core/core_providers.dart';
@@ -288,6 +289,20 @@ class ProfileActionsMenu extends HookConsumerWidget {
),
SubmenuButton(
menuChildren: [
if (profile case RemoteProfile(:final url, :final name))
MenuItemButton(
child: Text(t.profile.share.exportSubLinkToClipboard),
onPressed: () async {
final link = LinkParser.generateSubShareLink(url, name);
if (link.isNotEmpty) {
await Clipboard.setData(ClipboardData(text: link));
if (context.mounted) {
CustomToast(t.profile.share.exportToClipboardSuccess)
.show(context);
}
}
},
),
MenuItemButton(
child: Text(t.profile.share.exportConfigToClipboard),
onPressed: () async {