mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 19:39:22 +00:00
add paynym share
This commit is contained in:
parent
bc5dc9a5d7
commit
266a433aa3
7 changed files with 36 additions and 33 deletions
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||
import 'package:stackwallet/pages/paynym/add_new_paynym_follow_view.dart';
|
||||
import 'package:stackwallet/pages/paynym/dialogs/paynym_qr_popup.dart';
|
||||
|
@ -358,8 +359,25 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
|||
.extension<StackColors>()!
|
||||
.textDark,
|
||||
),
|
||||
onPressed: () {
|
||||
// copy to clipboard
|
||||
onPressed: () async {
|
||||
Rect? sharePositionOrigin;
|
||||
if (await Util.isIPad) {
|
||||
final box =
|
||||
context.findRenderObject() as RenderBox?;
|
||||
if (box != null) {
|
||||
sharePositionOrigin =
|
||||
box.localToGlobal(Offset.zero) & box.size;
|
||||
}
|
||||
}
|
||||
|
||||
await Share.share(
|
||||
ref
|
||||
.read(myPaynymAccountStateProvider.state)
|
||||
.state!
|
||||
.codes
|
||||
.first
|
||||
.code,
|
||||
sharePositionOrigin: sharePositionOrigin);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
abstract class Util {
|
||||
|
@ -22,6 +23,14 @@ abstract class Util {
|
|||
return Platform.isLinux || Platform.isMacOS || Platform.isWindows;
|
||||
}
|
||||
|
||||
static Future<bool> get isIPad async {
|
||||
final deviceInfo = (await DeviceInfoPlugin().deviceInfo);
|
||||
if (deviceInfo is IosDeviceInfo) {
|
||||
return (deviceInfo).name?.toLowerCase().contains("ipad") == true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static MaterialColor createMaterialColor(Color color) {
|
||||
List<double> strengths = <double>[.05];
|
||||
final swatch = <int, Color>{};
|
||||
|
|
|
@ -14,7 +14,7 @@ import flutter_secure_storage_macos
|
|||
import isar_flutter_libs
|
||||
import package_info_plus_macos
|
||||
import path_provider_macos
|
||||
import share_plus_macos
|
||||
import share_plus
|
||||
import shared_preferences_macos
|
||||
import stack_wallet_backup
|
||||
import url_launcher_macos
|
||||
|
|
30
pubspec.lock
30
pubspec.lock
|
@ -1237,21 +1237,7 @@ packages:
|
|||
name: share_plus
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.5.3"
|
||||
share_plus_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
share_plus_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "6.3.0"
|
||||
share_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1259,20 +1245,6 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.2.0"
|
||||
share_plus_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
share_plus_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
shared_preferences:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -126,7 +126,7 @@ dependencies:
|
|||
tuple: ^2.0.0
|
||||
flutter_riverpod: ^1.0.3
|
||||
qr_flutter: ^4.0.0
|
||||
share_plus: ^4.0.10
|
||||
share_plus: ^6.3.0
|
||||
emojis: ^0.9.9
|
||||
pointycastle: ^3.6.0
|
||||
package_info_plus: ^1.4.2
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
|
||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||
#include <share_plus/share_plus_windows_plugin_c_api.h>
|
||||
#include <stack_wallet_backup/stack_wallet_backup_plugin_c_api.h>
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
#include <window_size/window_size_plugin.h>
|
||||
|
@ -26,6 +27,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
|||
registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin"));
|
||||
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||
SharePlusWindowsPluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
|
||||
StackWalletBackupPluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("StackWalletBackupPluginCApi"));
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
|
|
|
@ -8,6 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||
flutter_secure_storage_windows
|
||||
isar_flutter_libs
|
||||
permission_handler_windows
|
||||
share_plus
|
||||
stack_wallet_backup
|
||||
url_launcher_windows
|
||||
window_size
|
||||
|
|
Loading…
Reference in a new issue