Merge pull request #919 from cypherstack/julian_working_branch

fixes
This commit is contained in:
julian-CStack 2024-07-05 11:49:36 -06:00 committed by GitHub
commit e8a2a5081b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 68 additions and 69 deletions

View file

@ -13,7 +13,6 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import '../../../../app_config.dart'; import '../../../../app_config.dart';
import '../../../../models/keys/cw_key_data.dart'; import '../../../../models/keys/cw_key_data.dart';
@ -32,6 +31,8 @@ import '../../../../widgets/background.dart';
import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../../../widgets/custom_buttons/blue_text_button.dart'; import '../../../../widgets/custom_buttons/blue_text_button.dart';
import '../../../../widgets/custom_buttons/simple_copy_button.dart'; import '../../../../widgets/custom_buttons/simple_copy_button.dart';
import '../../../../widgets/desktop/primary_button.dart';
import '../../../../widgets/desktop/secondary_button.dart';
import '../../../../widgets/detail_item.dart'; import '../../../../widgets/detail_item.dart';
import '../../../../widgets/qr.dart'; import '../../../../widgets/qr.dart';
import '../../../../widgets/rounded_white_container.dart'; import '../../../../widgets/rounded_white_container.dart';
@ -47,7 +48,6 @@ class WalletBackupView extends ConsumerWidget {
required this.walletId, required this.walletId,
required this.mnemonic, required this.mnemonic,
this.frostWalletData, this.frostWalletData,
this.clipboardInterface = const ClipboardWrapper(),
this.keyData, this.keyData,
}); });
@ -61,7 +61,6 @@ class WalletBackupView extends ConsumerWidget {
String keys, String keys,
({String config, String keys})? prevGen, ({String config, String keys})? prevGen,
})? frostWalletData; })? frostWalletData;
final ClipboardInterface clipboardInterface;
final KeyDataInterface? keyData; final KeyDataInterface? keyData;
@override @override
@ -107,40 +106,6 @@ class WalletBackupView extends ConsumerWidget {
}, },
), ),
), ),
if (!frost && keyData == null)
Padding(
padding: const EdgeInsets.all(10),
child: AspectRatio(
aspectRatio: 1,
child: AppBarIconButton(
color:
Theme.of(context).extension<StackColors>()!.background,
shadows: const [],
icon: SvgPicture.asset(
Assets.svg.copy,
width: 20,
height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.topNavIconPrimary,
),
onPressed: () async {
await clipboardInterface
.setData(ClipboardData(text: mnemonic.join(" ")));
if (context.mounted) {
unawaited(
showFloatingFlushBar(
type: FlushBarType.info,
message: "Copied to clipboard",
iconAsset: Assets.svg.copy,
context: context,
),
);
}
},
),
),
),
], ],
), ),
body: Padding( body: Padding(
@ -161,19 +126,22 @@ class WalletBackupView extends ConsumerWidget {
} }
class _Mnemonic extends ConsumerWidget { class _Mnemonic extends ConsumerWidget {
const _Mnemonic({super.key, required this.walletId, required this.mnemonic}); const _Mnemonic({
super.key,
required this.walletId,
required this.mnemonic,
this.clipboardInterface = const ClipboardWrapper(),
});
final String walletId; final String walletId;
final List<String> mnemonic; final List<String> mnemonic;
final ClipboardInterface clipboardInterface;
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
const SizedBox(
height: 4,
),
Text( Text(
ref.watch(pWalletName(walletId)), ref.watch(pWalletName(walletId)),
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -221,10 +189,28 @@ class _Mnemonic extends ConsumerWidget {
const SizedBox( const SizedBox(
height: 12, height: 12,
), ),
TextButton( SecondaryButton(
style: Theme.of(context) label: "Copy",
.extension<StackColors>()! onPressed: () async {
.getPrimaryEnabledButtonStyle(context), await clipboardInterface
.setData(ClipboardData(text: mnemonic.join(" ")));
if (context.mounted) {
unawaited(
showFloatingFlushBar(
type: FlushBarType.info,
message: "Copied to clipboard",
iconAsset: Assets.svg.copy,
context: context,
),
);
}
},
),
const SizedBox(
height: 12,
),
PrimaryButton(
label: "Show QR Code",
onPressed: () { onPressed: () {
final String data = AddressUtils.encodeQRSeedData(mnemonic); final String data = AddressUtils.encodeQRSeedData(mnemonic);
@ -293,10 +279,6 @@ class _Mnemonic extends ConsumerWidget {
}, },
); );
}, },
child: Text(
"Show QR Code",
style: STextStyles.button(context),
),
), ),
], ],
); );
@ -310,8 +292,6 @@ class _FrostKeys extends StatelessWidget {
this.frostWalletData, this.frostWalletData,
}); });
static const String routeName = "/walletBackup";
final String walletId; final String walletId;
final ({ final ({
String myName, String myName,

View file

@ -277,22 +277,6 @@ class _Mnemonic extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: SecondaryButton( child: SecondaryButton(
label: "Show QR code",
onPressed: () {
// TODO: address utils
final String value = AddressUtils.encodeQRSeedData(words);
Navigator.of(context).pushNamed(
QRCodeDesktopPopupContent.routeName,
arguments: value,
);
},
),
),
const SizedBox(
width: 16,
),
Expanded(
child: PrimaryButton(
label: "Copy", label: "Copy",
onPressed: () async { onPressed: () async {
await clipboardInterface.setData( await clipboardInterface.setData(
@ -311,6 +295,22 @@ class _Mnemonic extends StatelessWidget {
}, },
), ),
), ),
const SizedBox(
width: 16,
),
Expanded(
child: PrimaryButton(
label: "Show QR code",
onPressed: () {
// TODO: address utils
final String value = AddressUtils.encodeQRSeedData(words);
Navigator.of(context).pushNamed(
QRCodeDesktopPopupContent.routeName,
arguments: value,
);
},
),
),
], ],
), ),
), ),

View file

@ -171,7 +171,12 @@ dependencies:
convert: ^3.1.1 convert: ^3.1.1
flutter_hooks: ^0.20.3 flutter_hooks: ^0.20.3
meta: ^1.9.1 meta: ^1.9.1
coinlib_flutter: ^2.0.0 # coinlib_flutter: ^2.1.0-rc.1
coinlib_flutter:
git:
url: https://github.com/peercoin/coinlib.git
ref: b88e68e2e10ffe54d802deeed6b9e83da7721a1f
path: coinlib_flutter
electrum_adapter: electrum_adapter:
git: git:
url: https://github.com/cypherstack/electrum_adapter.git url: https://github.com/cypherstack/electrum_adapter.git
@ -180,7 +185,7 @@ dependencies:
solana: solana:
git: # TODO [prio=low]: Revert to official package once Tor support is merged upstream. git: # TODO [prio=low]: Revert to official package once Tor support is merged upstream.
url: https://github.com/cypherstack/espresso-cash-public.git url: https://github.com/cypherstack/espresso-cash-public.git
ref: a83e375678eb22fe544dc125d29bbec0fb833882 ref: 706be5f166d31736c443cca4cd311b7fcfc2a9bf
path: packages/solana path: packages/solana
calendar_date_picker2: ^1.0.2 calendar_date_picker2: ^1.0.2
sqlite3: ^2.4.3 sqlite3: ^2.4.3
@ -210,6 +215,20 @@ flutter_native_splash:
android_disable_fullscreen: true android_disable_fullscreen: true
dependency_overrides: dependency_overrides:
# coin lib git for testing while waiting for publishing
coinlib:
git:
url: https://github.com/peercoin/coinlib.git
ref: b88e68e2e10ffe54d802deeed6b9e83da7721a1f
path: coinlib
coinlib_flutter:
git:
url: https://github.com/peercoin/coinlib.git
ref: b88e68e2e10ffe54d802deeed6b9e83da7721a1f
path: coinlib_flutter
# adding here due to pure laziness # adding here due to pure laziness
tor_ffi_plugin: tor_ffi_plugin:
git: git: