mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-21 22:58:49 +00:00
commit
7064db6b7a
23 changed files with 1259 additions and 603 deletions
1
.github/workflows/test.yaml
vendored
1
.github/workflows/test.yaml
vendored
|
@ -23,6 +23,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
cargo install cargo-ndk
|
cargo install cargo-ndk
|
||||||
rustup target add x86_64-unknown-linux-gnu
|
rustup target add x86_64-unknown-linux-gnu
|
||||||
|
sudo apt clean
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake openjdk-8-jre-headless libgit2-dev clang libncurses5-dev libncursesw5-dev zlib1g-dev llvm
|
sudo apt install -y unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake openjdk-8-jre-headless libgit2-dev clang libncurses5-dev libncursesw5-dev zlib1g-dev llvm
|
||||||
sudo apt install -y debhelper libclang-dev cargo rustc opencl-headers libssl-dev ocl-icd-opencl-dev
|
sudo apt install -y debhelper libclang-dev cargo rustc opencl-headers libssl-dev ocl-icd-opencl-dev
|
||||||
|
|
|
@ -18,16 +18,28 @@ import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||||
|
|
||||||
class BuyWarningPopup extends StatelessWidget {
|
class BuyWarningPopup extends StatefulWidget {
|
||||||
BuyWarningPopup({
|
const BuyWarningPopup({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.quote,
|
required this.quote,
|
||||||
this.order,
|
this.order,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final SimplexQuote quote;
|
final SimplexQuote quote;
|
||||||
|
final SimplexOrder? order;
|
||||||
|
@override
|
||||||
|
State<BuyWarningPopup> createState() => _BuyWarningPopupState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BuyWarningPopupState extends State<BuyWarningPopup> {
|
||||||
|
late final bool isDesktop;
|
||||||
SimplexOrder? order;
|
SimplexOrder? order;
|
||||||
|
|
||||||
|
String get title => "Buy ${widget.quote.crypto.ticker}";
|
||||||
|
String get message =>
|
||||||
|
"This purchase is provided and fulfilled by Simplex by nuvei "
|
||||||
|
"(a third party). You will be taken to their website. Please follow "
|
||||||
|
"their instructions.";
|
||||||
|
|
||||||
Future<BuyResponse<SimplexOrder>> newOrder(SimplexQuote quote) async {
|
Future<BuyResponse<SimplexOrder>> newOrder(SimplexQuote quote) async {
|
||||||
final orderResponse = await SimplexAPI.instance.newOrder(quote);
|
final orderResponse = await SimplexAPI.instance.newOrder(quote);
|
||||||
|
|
||||||
|
@ -38,174 +50,241 @@ class BuyWarningPopup extends StatelessWidget {
|
||||||
return SimplexAPI.instance.redirect(order);
|
return SimplexAPI.instance.redirect(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
Future<void> _buyInvoice() async {
|
||||||
Widget build(BuildContext context) {
|
await showDialog<void>(
|
||||||
final isDesktop = Util.isDesktop;
|
context: context,
|
||||||
|
// useRootNavigator: isDesktop,
|
||||||
Future<void> _buyInvoice() async {
|
builder: (context) {
|
||||||
await showDialog<void>(
|
return isDesktop
|
||||||
context: context,
|
? DesktopDialog(
|
||||||
// useRootNavigator: isDesktop,
|
maxHeight: 700,
|
||||||
builder: (context) {
|
maxWidth: 580,
|
||||||
return isDesktop
|
child: Column(
|
||||||
? DesktopDialog(
|
children: [
|
||||||
maxHeight: 700,
|
Row(
|
||||||
maxWidth: 580,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
child: Column(
|
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Padding(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
padding: const EdgeInsets.only(
|
||||||
|
left: 32,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
"Order details",
|
||||||
|
style: STextStyles.desktopH3(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const DesktopDialogCloseButton(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 32,
|
||||||
|
right: 32,
|
||||||
|
bottom: 32,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Expanded(
|
||||||
padding: const EdgeInsets.only(
|
child: RoundedWhiteContainer(
|
||||||
left: 32,
|
padding: const EdgeInsets.all(16),
|
||||||
),
|
borderColor: Theme.of(context)
|
||||||
child: Text(
|
.extension<StackColors>()!
|
||||||
"Order details",
|
.background,
|
||||||
style: STextStyles.desktopH3(context),
|
child: BuyOrderDetailsView(
|
||||||
|
order: order as SimplexOrder,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const DesktopDialogCloseButton(),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: BuyOrderDetailsView(
|
||||||
|
order: order as SimplexOrder,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> onContinue() async {
|
||||||
|
BuyResponse<SimplexOrder> orderResponse = await newOrder(widget.quote);
|
||||||
|
if (orderResponse.exception == null) {
|
||||||
|
await redirect(orderResponse.value as SimplexOrder)
|
||||||
|
.then((_response) async {
|
||||||
|
order = orderResponse.value as SimplexOrder;
|
||||||
|
Navigator.of(context, rootNavigator: isDesktop).pop();
|
||||||
|
Navigator.of(context, rootNavigator: isDesktop).pop();
|
||||||
|
await _buyInvoice();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await showDialog<dynamic>(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: true,
|
||||||
|
builder: (context) {
|
||||||
|
if (isDesktop) {
|
||||||
|
return DesktopDialog(
|
||||||
|
maxWidth: 450,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(32),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Simplex API error",
|
||||||
|
style: STextStyles.desktopH3(context),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"${orderResponse.exception?.errorMessage}",
|
||||||
|
style: STextStyles.smallMed14(context),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 56,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Spacer(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: PrimaryButton(
|
||||||
padding: const EdgeInsets.only(
|
buttonHeight: ButtonHeight.l,
|
||||||
left: 32,
|
label: "Ok",
|
||||||
right: 32,
|
onPressed: () {
|
||||||
bottom: 32,
|
Navigator.of(context).pop();
|
||||||
),
|
Navigator.of(context).pop();
|
||||||
child: Row(
|
Navigator.of(context).pop(); // weee
|
||||||
children: [
|
},
|
||||||
Expanded(
|
|
||||||
child: RoundedWhiteContainer(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
borderColor: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.background,
|
|
||||||
child: BuyOrderDetailsView(
|
|
||||||
order: order as SimplexOrder,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
)
|
],
|
||||||
: BuyOrderDetailsView(
|
),
|
||||||
order: order as SimplexOrder,
|
),
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return StackDialog(
|
|
||||||
title: "Buy ${quote.crypto.ticker}",
|
|
||||||
message: "This purchase is provided and fulfilled by Simplex by nuvei "
|
|
||||||
"(a third party). You will be taken to their website. Please follow "
|
|
||||||
"their instructions.",
|
|
||||||
leftButton: SecondaryButton(
|
|
||||||
label: "Cancel",
|
|
||||||
onPressed: Navigator.of(context, rootNavigator: isDesktop).pop,
|
|
||||||
),
|
|
||||||
rightButton: PrimaryButton(
|
|
||||||
label: "Continue",
|
|
||||||
onPressed: () async {
|
|
||||||
BuyResponse<SimplexOrder> orderResponse = await newOrder(quote);
|
|
||||||
if (orderResponse.exception == null) {
|
|
||||||
await redirect(orderResponse.value as SimplexOrder)
|
|
||||||
.then((_response) async {
|
|
||||||
this.order = orderResponse.value as SimplexOrder;
|
|
||||||
Navigator.of(context, rootNavigator: isDesktop).pop();
|
|
||||||
Navigator.of(context, rootNavigator: isDesktop).pop();
|
|
||||||
await _buyInvoice();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
await showDialog<dynamic>(
|
return StackDialog(
|
||||||
context: context,
|
title: "Simplex API error",
|
||||||
barrierDismissible: true,
|
message: "${orderResponse.exception?.errorMessage}",
|
||||||
builder: (context) {
|
// "${quoteResponse.exception?.errorMessage.substring(8, (quoteResponse.exception?.errorMessage?.length ?? 109) - (8 + 6))}",
|
||||||
if (isDesktop) {
|
rightButton: TextButton(
|
||||||
return DesktopDialog(
|
style: Theme.of(context)
|
||||||
maxWidth: 450,
|
.extension<StackColors>()!
|
||||||
child: Padding(
|
.getSecondaryEnabledButtonStyle(context),
|
||||||
padding: const EdgeInsets.all(32),
|
child: Text(
|
||||||
child: Column(
|
"Ok",
|
||||||
mainAxisSize: MainAxisSize.min,
|
style: STextStyles.button(context).copyWith(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
color: Theme.of(context)
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Simplex API error",
|
|
||||||
style: STextStyles.desktopH3(context),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 24,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"${orderResponse.exception?.errorMessage}",
|
|
||||||
style: STextStyles.smallMed14(context),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 56,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
const Spacer(),
|
|
||||||
Expanded(
|
|
||||||
child: PrimaryButton(
|
|
||||||
buttonHeight: ButtonHeight.l,
|
|
||||||
label: "Ok",
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
Navigator.of(context).pop(); // weee
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return StackDialog(
|
|
||||||
title: "Simplex API error",
|
|
||||||
message: "${orderResponse.exception?.errorMessage}",
|
|
||||||
// "${quoteResponse.exception?.errorMessage.substring(8, (quoteResponse.exception?.errorMessage?.length ?? 109) - (8 + 6))}",
|
|
||||||
rightButton: TextButton(
|
|
||||||
style: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.getSecondaryEnabledButtonStyle(context),
|
.accentColorDark),
|
||||||
child: Text(
|
),
|
||||||
"Ok",
|
onPressed: () {
|
||||||
style: STextStyles.button(context).copyWith(
|
Navigator.of(context).pop();
|
||||||
color: Theme.of(context)
|
Navigator.of(context).pop();
|
||||||
.extension<StackColors>()!
|
Navigator.of(context).pop(); // weee
|
||||||
.accentColorDark),
|
},
|
||||||
),
|
),
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
Navigator.of(context).pop(); // weee
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
);
|
||||||
icon: SizedBox(
|
}
|
||||||
width: 64,
|
}
|
||||||
height: 32,
|
|
||||||
child: SvgPicture.asset(
|
@override
|
||||||
Assets.buy.simplexLogo(context),
|
void initState() {
|
||||||
|
order = widget.order;
|
||||||
|
isDesktop = Util.isDesktop;
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (isDesktop) {
|
||||||
|
return DesktopDialog(
|
||||||
|
maxWidth: 580,
|
||||||
|
maxHeight: 350,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(32),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: STextStyles.desktopH3(context),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 64,
|
||||||
|
height: 32,
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
Assets.buy.simplexLogo(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Text(
|
||||||
|
message,
|
||||||
|
style: STextStyles.desktopTextSmall(context),
|
||||||
|
),
|
||||||
|
const Spacer(
|
||||||
|
flex: 2,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SecondaryButton(
|
||||||
|
label: "Cancel",
|
||||||
|
buttonHeight: ButtonHeight.l,
|
||||||
|
onPressed:
|
||||||
|
Navigator.of(context, rootNavigator: isDesktop).pop,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 16,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: PrimaryButton(
|
||||||
|
buttonHeight: ButtonHeight.l,
|
||||||
|
label: "Continue",
|
||||||
|
onPressed: onContinue,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
} else {
|
||||||
|
return StackDialog(
|
||||||
|
title: title,
|
||||||
|
message: message,
|
||||||
|
leftButton: SecondaryButton(
|
||||||
|
label: "Cancel",
|
||||||
|
onPressed: Navigator.of(context, rootNavigator: isDesktop).pop,
|
||||||
|
),
|
||||||
|
rightButton: PrimaryButton(
|
||||||
|
label: "Continue",
|
||||||
|
onPressed: onContinue,
|
||||||
|
),
|
||||||
|
icon: SizedBox(
|
||||||
|
width: 64,
|
||||||
|
height: 32,
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
Assets.buy.simplexLogo(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
height: 20,
|
height: 20,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.textDark,
|
.accentColorDark,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
|
@ -223,7 +223,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
height: 20,
|
height: 20,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.textDark,
|
.accentColorDark,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// todo info ?
|
// todo info ?
|
||||||
|
@ -322,7 +322,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
height: 12,
|
height: 12,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.textDark,
|
.buttonTextSecondary,
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Clipboard.setData(
|
await Clipboard.setData(
|
||||||
|
@ -359,7 +359,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
height: 12,
|
height: 12,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.textDark,
|
.buttonTextSecondary,
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Rect? sharePositionOrigin;
|
Rect? sharePositionOrigin;
|
||||||
|
@ -396,7 +396,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
height: 12,
|
height: 12,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.textDark,
|
.buttonTextSecondary,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog<void>(
|
showDialog<void>(
|
||||||
|
|
|
@ -3,11 +3,17 @@ import 'dart:math';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:stackwallet/pages/paynym/subwidgets/paynym_card_button.dart';
|
import 'package:stackwallet/pages/paynym/subwidgets/paynym_card_button.dart';
|
||||||
|
import 'package:stackwallet/providers/global/paynym_api_provider.dart';
|
||||||
|
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||||
import 'package:stackwallet/providers/wallet/my_paynym_account_state_provider.dart';
|
import 'package:stackwallet/providers/wallet/my_paynym_account_state_provider.dart';
|
||||||
|
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
|
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
||||||
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
|
|
||||||
class PaynymFollowersList extends ConsumerStatefulWidget {
|
class PaynymFollowersList extends ConsumerStatefulWidget {
|
||||||
|
@ -54,61 +60,97 @@ class _PaynymFollowersListState extends ConsumerState<PaynymFollowersList> {
|
||||||
ref.watch(myPaynymAccountStateProvider.state).state?.followers;
|
ref.watch(myPaynymAccountStateProvider.state).state?.followers;
|
||||||
final count = followers?.length ?? 0;
|
final count = followers?.length ?? 0;
|
||||||
|
|
||||||
return ListView.separated(
|
return ConditionalParent(
|
||||||
itemCount: max(count, 1),
|
condition: !isDesktop,
|
||||||
separatorBuilder: (BuildContext context, int index) => Container(
|
builder: (child) => RefreshIndicator(
|
||||||
height: 1.5,
|
child: child,
|
||||||
color: Colors.transparent,
|
onRefresh: () async {
|
||||||
),
|
try {
|
||||||
itemBuilder: (BuildContext context, int index) {
|
final manager = ref
|
||||||
if (count == 0) {
|
.read(walletsChangeNotifierProvider)
|
||||||
return RoundedWhiteContainer(
|
.getManager(widget.walletId);
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Your PayNym followers will appear here",
|
|
||||||
style: isDesktop
|
|
||||||
? STextStyles.desktopTextExtraExtraSmall(context)
|
|
||||||
.copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textSubtitle1,
|
|
||||||
)
|
|
||||||
: STextStyles.label(context),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else if (count == 1) {
|
|
||||||
return RoundedWhiteContainer(
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
child: PaynymCardButton(
|
|
||||||
walletId: widget.walletId,
|
|
||||||
accountLite: followers![0],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
BorderRadius? borderRadius;
|
|
||||||
if (index == 0) {
|
|
||||||
borderRadius = _borderRadiusFirst;
|
|
||||||
} else if (index == count - 1) {
|
|
||||||
borderRadius = _borderRadiusLast;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Container(
|
// get wallet to access paynym calls
|
||||||
key: Key("paynymCardKey_${followers![index].nymId}"),
|
final wallet = manager.wallet as PaynymWalletInterface;
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: borderRadius,
|
// get payment code
|
||||||
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
final pCode = await wallet.getPaymentCode(
|
||||||
),
|
DerivePathTypeExt.primaryFor(manager.coin),
|
||||||
child: PaynymCardButton(
|
);
|
||||||
walletId: widget.walletId,
|
|
||||||
accountLite: followers[index],
|
// get account from api
|
||||||
),
|
final account =
|
||||||
);
|
await ref.read(paynymAPIProvider).nym(pCode.toString());
|
||||||
}
|
|
||||||
},
|
// update my account
|
||||||
|
if (account.value != null) {
|
||||||
|
ref.read(myPaynymAccountStateProvider.state).state =
|
||||||
|
account.value!;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Logging.instance.log(
|
||||||
|
"Failed pull down refresh of paynym home page: $e",
|
||||||
|
level: LogLevel.Warning,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
child: ListView.separated(
|
||||||
|
itemCount: max(count, 1),
|
||||||
|
separatorBuilder: (BuildContext context, int index) => Container(
|
||||||
|
height: 1.5,
|
||||||
|
color: Colors.transparent,
|
||||||
|
),
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
if (count == 0) {
|
||||||
|
return RoundedWhiteContainer(
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Your PayNym followers will appear here",
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles.desktopTextExtraExtraSmall(context)
|
||||||
|
.copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
)
|
||||||
|
: STextStyles.label(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (count == 1) {
|
||||||
|
return RoundedWhiteContainer(
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
child: PaynymCardButton(
|
||||||
|
walletId: widget.walletId,
|
||||||
|
accountLite: followers![0],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
BorderRadius? borderRadius;
|
||||||
|
if (index == 0) {
|
||||||
|
borderRadius = _borderRadiusFirst;
|
||||||
|
} else if (index == count - 1) {
|
||||||
|
borderRadius = _borderRadiusLast;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
key: Key("paynymCardKey_${followers![index].nymId}"),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: borderRadius,
|
||||||
|
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
|
),
|
||||||
|
child: PaynymCardButton(
|
||||||
|
walletId: widget.walletId,
|
||||||
|
accountLite: followers[index],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,17 @@ import 'dart:math';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:stackwallet/pages/paynym/subwidgets/paynym_card_button.dart';
|
import 'package:stackwallet/pages/paynym/subwidgets/paynym_card_button.dart';
|
||||||
|
import 'package:stackwallet/providers/global/paynym_api_provider.dart';
|
||||||
|
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||||
import 'package:stackwallet/providers/wallet/my_paynym_account_state_provider.dart';
|
import 'package:stackwallet/providers/wallet/my_paynym_account_state_provider.dart';
|
||||||
|
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
|
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
||||||
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
|
|
||||||
class PaynymFollowingList extends ConsumerStatefulWidget {
|
class PaynymFollowingList extends ConsumerStatefulWidget {
|
||||||
|
@ -54,61 +60,97 @@ class _PaynymFollowingListState extends ConsumerState<PaynymFollowingList> {
|
||||||
ref.watch(myPaynymAccountStateProvider.state).state?.following;
|
ref.watch(myPaynymAccountStateProvider.state).state?.following;
|
||||||
final count = following?.length ?? 0;
|
final count = following?.length ?? 0;
|
||||||
|
|
||||||
return ListView.separated(
|
return ConditionalParent(
|
||||||
itemCount: max(count, 1),
|
condition: !isDesktop,
|
||||||
separatorBuilder: (BuildContext context, int index) => Container(
|
builder: (child) => RefreshIndicator(
|
||||||
height: 1.5,
|
child: child,
|
||||||
color: Colors.transparent,
|
onRefresh: () async {
|
||||||
),
|
try {
|
||||||
itemBuilder: (BuildContext context, int index) {
|
final manager = ref
|
||||||
if (count == 0) {
|
.read(walletsChangeNotifierProvider)
|
||||||
return RoundedWhiteContainer(
|
.getManager(widget.walletId);
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Your PayNym contacts will appear here",
|
|
||||||
style: isDesktop
|
|
||||||
? STextStyles.desktopTextExtraExtraSmall(context)
|
|
||||||
.copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textSubtitle1,
|
|
||||||
)
|
|
||||||
: STextStyles.label(context),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else if (count == 1) {
|
|
||||||
return RoundedWhiteContainer(
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
child: PaynymCardButton(
|
|
||||||
walletId: widget.walletId,
|
|
||||||
accountLite: following![0],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
BorderRadius? borderRadius;
|
|
||||||
if (index == 0) {
|
|
||||||
borderRadius = _borderRadiusFirst;
|
|
||||||
} else if (index == count - 1) {
|
|
||||||
borderRadius = _borderRadiusLast;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Container(
|
// get wallet to access paynym calls
|
||||||
key: Key("paynymCardKey_${following![index].nymId}"),
|
final wallet = manager.wallet as PaynymWalletInterface;
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: borderRadius,
|
// get payment code
|
||||||
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
final pCode = await wallet.getPaymentCode(
|
||||||
),
|
DerivePathTypeExt.primaryFor(manager.coin),
|
||||||
child: PaynymCardButton(
|
);
|
||||||
walletId: widget.walletId,
|
|
||||||
accountLite: following[index],
|
// get account from api
|
||||||
),
|
final account =
|
||||||
);
|
await ref.read(paynymAPIProvider).nym(pCode.toString());
|
||||||
}
|
|
||||||
},
|
// update my account
|
||||||
|
if (account.value != null) {
|
||||||
|
ref.read(myPaynymAccountStateProvider.state).state =
|
||||||
|
account.value!;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Logging.instance.log(
|
||||||
|
"Failed pull down refresh of paynym home page: $e",
|
||||||
|
level: LogLevel.Warning,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
child: ListView.separated(
|
||||||
|
itemCount: max(count, 1),
|
||||||
|
separatorBuilder: (BuildContext context, int index) => Container(
|
||||||
|
height: 1.5,
|
||||||
|
color: Colors.transparent,
|
||||||
|
),
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
if (count == 0) {
|
||||||
|
return RoundedWhiteContainer(
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Your PayNym contacts will appear here",
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles.desktopTextExtraExtraSmall(context)
|
||||||
|
.copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
)
|
||||||
|
: STextStyles.label(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (count == 1) {
|
||||||
|
return RoundedWhiteContainer(
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
child: PaynymCardButton(
|
||||||
|
walletId: widget.walletId,
|
||||||
|
accountLite: following![0],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
BorderRadius? borderRadius;
|
||||||
|
if (index == 0) {
|
||||||
|
borderRadius = _borderRadiusFirst;
|
||||||
|
} else if (index == count - 1) {
|
||||||
|
borderRadius = _borderRadiusLast;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
key: Key("paynymCardKey_${following![index].nymId}"),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: borderRadius,
|
||||||
|
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
|
),
|
||||||
|
child: PaynymCardButton(
|
||||||
|
walletId: widget.walletId,
|
||||||
|
accountLite: following[index],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
132
lib/pages/receive_view/addresses/address_card.dart
Normal file
132
lib/pages/receive_view/addresses/address_card.dart
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
||||||
|
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||||
|
import 'package:stackwallet/pages/receive_view/addresses/address_qr_popup.dart';
|
||||||
|
import 'package:stackwallet/pages/receive_view/addresses/edit_address_label_view.dart';
|
||||||
|
import 'package:stackwallet/utilities/clipboard_interface.dart';
|
||||||
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/icon_widgets/copy_icon.dart';
|
||||||
|
import 'package:stackwallet/widgets/icon_widgets/qrcode_icon.dart';
|
||||||
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
|
class AddressCard extends StatelessWidget {
|
||||||
|
const AddressCard({
|
||||||
|
Key? key,
|
||||||
|
required this.address,
|
||||||
|
required this.walletId,
|
||||||
|
required this.coin,
|
||||||
|
this.clipboard = const ClipboardWrapper(),
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final Address address;
|
||||||
|
final String walletId;
|
||||||
|
final Coin coin;
|
||||||
|
final ClipboardInterface clipboard;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return RoundedWhiteContainer(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"TODO: label",
|
||||||
|
style: STextStyles.itemSubtitle(context),
|
||||||
|
),
|
||||||
|
CustomTextButton(
|
||||||
|
text: "Edit label",
|
||||||
|
textSize: 14,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
EditAddressLabelView.routeName,
|
||||||
|
arguments: Tuple2(
|
||||||
|
address,
|
||||||
|
walletId,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SelectableText(
|
||||||
|
address.value,
|
||||||
|
style: STextStyles.itemSubtitle12(context),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SecondaryButton(
|
||||||
|
label: "Copy address",
|
||||||
|
icon: CopyIcon(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.buttonTextSecondary,
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
await clipboard.setData(
|
||||||
|
ClipboardData(
|
||||||
|
text: address.value,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
unawaited(
|
||||||
|
showFloatingFlushBar(
|
||||||
|
type: FlushBarType.info,
|
||||||
|
message: "Copied to clipboard",
|
||||||
|
context: context,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: SecondaryButton(
|
||||||
|
label: "Show QR Code",
|
||||||
|
icon: QrCodeIcon(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.buttonTextSecondary,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AddressQrPopup(
|
||||||
|
address: address,
|
||||||
|
coin: coin,
|
||||||
|
clipboard: clipboard,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
193
lib/pages/receive_view/addresses/address_qr_popup.dart
Normal file
193
lib/pages/receive_view/addresses/address_qr_popup.dart
Normal file
|
@ -0,0 +1,193 @@
|
||||||
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/rendering.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
||||||
|
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||||
|
import 'package:stackwallet/utilities/address_utils.dart';
|
||||||
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
|
import 'package:stackwallet/utilities/clipboard_interface.dart';
|
||||||
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||||
|
|
||||||
|
class AddressQrPopup extends StatefulWidget {
|
||||||
|
const AddressQrPopup({
|
||||||
|
Key? key,
|
||||||
|
required this.address,
|
||||||
|
required this.coin,
|
||||||
|
this.clipboard = const ClipboardWrapper(),
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final Address address;
|
||||||
|
final Coin coin;
|
||||||
|
final ClipboardInterface clipboard;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddressQrPopup> createState() => _AddressQrPopupState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddressQrPopupState extends State<AddressQrPopup> {
|
||||||
|
final _qrKey = GlobalKey();
|
||||||
|
final isDesktop = Util.isDesktop;
|
||||||
|
|
||||||
|
Future<void> _capturePng(bool shouldSaveInsteadOfShare) async {
|
||||||
|
try {
|
||||||
|
RenderRepaintBoundary boundary =
|
||||||
|
_qrKey.currentContext?.findRenderObject() as RenderRepaintBoundary;
|
||||||
|
ui.Image image = await boundary.toImage();
|
||||||
|
ByteData? byteData =
|
||||||
|
await image.toByteData(format: ui.ImageByteFormat.png);
|
||||||
|
Uint8List pngBytes = byteData!.buffer.asUint8List();
|
||||||
|
|
||||||
|
if (shouldSaveInsteadOfShare) {
|
||||||
|
if (isDesktop) {
|
||||||
|
final dir = Directory("${Platform.environment['HOME']}");
|
||||||
|
if (!dir.existsSync()) {
|
||||||
|
throw Exception(
|
||||||
|
"Home dir not found while trying to open filepicker on QR image save");
|
||||||
|
}
|
||||||
|
final path = await FilePicker.platform.saveFile(
|
||||||
|
fileName: "qrcode.png",
|
||||||
|
initialDirectory: dir.path,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (path != null) {
|
||||||
|
final file = File(path);
|
||||||
|
if (file.existsSync()) {
|
||||||
|
unawaited(
|
||||||
|
showFloatingFlushBar(
|
||||||
|
type: FlushBarType.warning,
|
||||||
|
message: "$path already exists!",
|
||||||
|
context: context,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
await file.writeAsBytes(pngBytes);
|
||||||
|
unawaited(
|
||||||
|
showFloatingFlushBar(
|
||||||
|
type: FlushBarType.success,
|
||||||
|
message: "$path saved!",
|
||||||
|
context: context,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// await DocumentFileSavePlus.saveFile(
|
||||||
|
// pngBytes,
|
||||||
|
// "receive_qr_code_${DateTime.now().toLocal().toIso8601String()}.png",
|
||||||
|
// "image/png");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final tempDir = await getTemporaryDirectory();
|
||||||
|
final file = await File("${tempDir.path}/qrcode.png").create();
|
||||||
|
await file.writeAsBytes(pngBytes);
|
||||||
|
|
||||||
|
await Share.shareFiles(["${tempDir.path}/qrcode.png"],
|
||||||
|
text: "Receive URI QR Code");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
//todo: comeback to this
|
||||||
|
debugPrint(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return StackDialogBase(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"todo: custom label",
|
||||||
|
style: STextStyles.pageTitleH2(context),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
widget.address.value,
|
||||||
|
style: STextStyles.itemSubtitle(context),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: RepaintBoundary(
|
||||||
|
key: _qrKey,
|
||||||
|
child: QrImage(
|
||||||
|
data: AddressUtils.buildUriString(
|
||||||
|
widget.coin,
|
||||||
|
widget.address.value,
|
||||||
|
{},
|
||||||
|
),
|
||||||
|
size: 220,
|
||||||
|
backgroundColor:
|
||||||
|
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
|
foregroundColor:
|
||||||
|
Theme.of(context).extension<StackColors>()!.accentColorDark,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SecondaryButton(
|
||||||
|
width: 170,
|
||||||
|
buttonHeight: isDesktop ? ButtonHeight.l : null,
|
||||||
|
onPressed: () async {
|
||||||
|
await _capturePng(false);
|
||||||
|
},
|
||||||
|
label: "Share",
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
Assets.svg.share,
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.buttonTextSecondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 16,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: PrimaryButton(
|
||||||
|
width: 170,
|
||||||
|
onPressed: () async {
|
||||||
|
await _capturePng(true);
|
||||||
|
},
|
||||||
|
label: "Save",
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
Assets.svg.arrowDown,
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.buttonTextPrimary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
241
lib/pages/receive_view/addresses/edit_address_label_view.dart
Normal file
241
lib/pages/receive_view/addresses/edit_address_label_view.dart
Normal file
|
@ -0,0 +1,241 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:stackwallet/models/isar/models/address/address.dart';
|
||||||
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
import 'package:stackwallet/widgets/background.dart';
|
||||||
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
|
||||||
|
import 'package:stackwallet/widgets/stack_text_field.dart';
|
||||||
|
import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
||||||
|
|
||||||
|
class EditAddressLabelView extends ConsumerStatefulWidget {
|
||||||
|
const EditAddressLabelView({
|
||||||
|
Key? key,
|
||||||
|
required this.address,
|
||||||
|
required this.walletId,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
static const String routeName = "/editAddressLabel";
|
||||||
|
|
||||||
|
final Address address;
|
||||||
|
final String walletId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
ConsumerState<EditAddressLabelView> createState() =>
|
||||||
|
_EditAddressLabelViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EditAddressLabelViewState extends ConsumerState<EditAddressLabelView> {
|
||||||
|
late final TextEditingController _labelFieldController;
|
||||||
|
final labelFieldFocusNode = FocusNode();
|
||||||
|
|
||||||
|
late final bool isDesktop;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
isDesktop = Util.isDesktop;
|
||||||
|
_labelFieldController = TextEditingController();
|
||||||
|
_labelFieldController.text = "todo: address.label";
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_labelFieldController.dispose();
|
||||||
|
labelFieldFocusNode.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ConditionalParent(
|
||||||
|
condition: !isDesktop,
|
||||||
|
builder: (child) => Background(
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor: isDesktop
|
||||||
|
? Colors.transparent
|
||||||
|
: Theme.of(context).extension<StackColors>()!.background,
|
||||||
|
appBar: isDesktop
|
||||||
|
? null
|
||||||
|
: AppBar(
|
||||||
|
backgroundColor:
|
||||||
|
Theme.of(context).extension<StackColors>()!.background,
|
||||||
|
leading: AppBarBackButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (FocusScope.of(context).hasFocus) {
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
await Future<void>.delayed(
|
||||||
|
const Duration(milliseconds: 75));
|
||||||
|
}
|
||||||
|
if (mounted) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
"Edit label",
|
||||||
|
style: STextStyles.navBarTitle(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: ConditionalParent(
|
||||||
|
condition: !isDesktop,
|
||||||
|
builder: (child) => Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
minHeight: constraints.maxHeight,
|
||||||
|
),
|
||||||
|
child: IntrinsicHeight(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(4),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
if (isDesktop)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 32,
|
||||||
|
bottom: 12,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Edit label",
|
||||||
|
style: STextStyles.desktopH3(context),
|
||||||
|
),
|
||||||
|
const DesktopDialogCloseButton(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.symmetric(
|
||||||
|
horizontal: 32,
|
||||||
|
)
|
||||||
|
: const EdgeInsets.all(0),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
|
autocorrect: Util.isDesktop ? false : true,
|
||||||
|
enableSuggestions: Util.isDesktop ? false : true,
|
||||||
|
controller: _labelFieldController,
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldActiveText,
|
||||||
|
height: 1.8,
|
||||||
|
)
|
||||||
|
: STextStyles.field(context),
|
||||||
|
focusNode: labelFieldFocusNode,
|
||||||
|
decoration: standardInputDecoration(
|
||||||
|
"Address label",
|
||||||
|
labelFieldFocusNode,
|
||||||
|
context,
|
||||||
|
desktopMed: isDesktop,
|
||||||
|
).copyWith(
|
||||||
|
contentPadding: isDesktop
|
||||||
|
? const EdgeInsets.only(
|
||||||
|
left: 16,
|
||||||
|
top: 11,
|
||||||
|
bottom: 12,
|
||||||
|
right: 5,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
suffixIcon: _labelFieldController.text.isNotEmpty
|
||||||
|
? Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 0),
|
||||||
|
child: UnconstrainedBox(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
TextFieldIconButton(
|
||||||
|
child: const XIcon(),
|
||||||
|
onTap: () async {
|
||||||
|
setState(() {
|
||||||
|
_labelFieldController.text = "";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// if (!isDesktop)
|
||||||
|
const Spacer(),
|
||||||
|
if (isDesktop)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(32),
|
||||||
|
child: PrimaryButton(
|
||||||
|
label: "Save",
|
||||||
|
onPressed: () async {
|
||||||
|
// todo: update address
|
||||||
|
// await ref
|
||||||
|
// .read(notesServiceChangeNotifierProvider(
|
||||||
|
// widget.walletId))
|
||||||
|
// .editOrAddNote(
|
||||||
|
// txid: widget.txid,
|
||||||
|
// note: _labelFieldController.text,
|
||||||
|
// );
|
||||||
|
// if (mounted) {
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (!isDesktop)
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
// todo: update address
|
||||||
|
// await ref
|
||||||
|
// .read(
|
||||||
|
// notesServiceChangeNotifierProvider(widget.walletId))
|
||||||
|
// .editOrAddNote(
|
||||||
|
// txid: widget.txid,
|
||||||
|
// note: _labelFieldController.text,
|
||||||
|
// );
|
||||||
|
// if (mounted) {
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
style: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.getPrimaryEnabledButtonStyle(context),
|
||||||
|
child: Text(
|
||||||
|
"Save",
|
||||||
|
style: STextStyles.button(context),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
import 'package:stackwallet/db/main_db.dart';
|
import 'package:stackwallet/db/main_db.dart';
|
||||||
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
||||||
|
import 'package:stackwallet/pages/receive_view/addresses/address_card.dart';
|
||||||
|
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||||
import 'package:stackwallet/utilities/clipboard_interface.dart';
|
import 'package:stackwallet/utilities/clipboard_interface.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
@ -10,7 +12,6 @@ import 'package:stackwallet/widgets/background.dart';
|
||||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import 'package:stackwallet/widgets/loading_indicator.dart';
|
import 'package:stackwallet/widgets/loading_indicator.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
|
||||||
|
|
||||||
class ReceivingAddressesView extends ConsumerWidget {
|
class ReceivingAddressesView extends ConsumerWidget {
|
||||||
const ReceivingAddressesView({
|
const ReceivingAddressesView({
|
||||||
|
@ -28,6 +29,8 @@ class ReceivingAddressesView extends ConsumerWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final coin = ref.watch(walletsChangeNotifierProvider
|
||||||
|
.select((value) => value.getManager(walletId).coin));
|
||||||
return ConditionalParent(
|
return ConditionalParent(
|
||||||
condition: !isDesktop,
|
condition: !isDesktop,
|
||||||
builder: (child) => Background(
|
builder: (child) => Background(
|
||||||
|
@ -73,7 +76,9 @@ class ReceivingAddressesView extends ConsumerWidget {
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
itemBuilder: (_, index) => AddressCard(
|
itemBuilder: (_, index) => AddressCard(
|
||||||
|
walletId: walletId,
|
||||||
address: snapshot.data![index],
|
address: snapshot.data![index],
|
||||||
|
coin: coin,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,28 +94,3 @@ class ReceivingAddressesView extends ConsumerWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AddressCard extends StatelessWidget {
|
|
||||||
const AddressCard({
|
|
||||||
Key? key,
|
|
||||||
required this.address,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
final Address address;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return RoundedWhiteContainer(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
address.value,
|
|
||||||
style: STextStyles.itemSubtitle12(context),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:qr_flutter/qr_flutter.dart';
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||||
|
import 'package:stackwallet/pages/receive_view/addresses/receiving_addresses_view.dart';
|
||||||
import 'package:stackwallet/pages/receive_view/generate_receiving_uri_qr_code_view.dart';
|
import 'package:stackwallet/pages/receive_view/generate_receiving_uri_qr_code_view.dart';
|
||||||
import 'package:stackwallet/pages/receive_view/receiving_addresses_view.dart';
|
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/route_generator.dart';
|
import 'package:stackwallet/route_generator.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
|
@ -187,11 +187,21 @@ class _ReceiveViewState extends ConsumerState<ReceiveView> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: RoundedWhiteContainer(
|
child: RoundedWhiteContainer(
|
||||||
|
boxShadow: [
|
||||||
|
Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.standardBoxShadow,
|
||||||
|
],
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: Text(
|
child: Padding(
|
||||||
"Address list",
|
padding: const EdgeInsets.symmetric(
|
||||||
style: STextStyles.baseXS(context),
|
horizontal: 12,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
"Address list",
|
||||||
|
style: STextStyles.field(context),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1338,6 +1338,7 @@ class _SendViewState extends ConsumerState<SendView> {
|
||||||
Constants.decimalPlacesForCoin(
|
Constants.decimalPlacesForCoin(
|
||||||
coin));
|
coin));
|
||||||
}
|
}
|
||||||
|
_cryptoAmountChanged();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -6,6 +6,7 @@ import 'package:stackwallet/models/buy/response_objects/quote.dart';
|
||||||
import 'package:stackwallet/models/contact_address_entry.dart';
|
import 'package:stackwallet/models/contact_address_entry.dart';
|
||||||
import 'package:stackwallet/models/exchange/incomplete_exchange.dart';
|
import 'package:stackwallet/models/exchange/incomplete_exchange.dart';
|
||||||
import 'package:stackwallet/models/exchange/response_objects/trade.dart';
|
import 'package:stackwallet/models/exchange/response_objects/trade.dart';
|
||||||
|
import 'package:stackwallet/models/isar/models/address/address.dart';
|
||||||
import 'package:stackwallet/models/paynym/paynym_account_lite.dart';
|
import 'package:stackwallet/models/paynym/paynym_account_lite.dart';
|
||||||
import 'package:stackwallet/models/send_view_auto_fill_data.dart';
|
import 'package:stackwallet/models/send_view_auto_fill_data.dart';
|
||||||
import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart';
|
import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart';
|
||||||
|
@ -44,9 +45,10 @@ import 'package:stackwallet/pages/paynym/add_new_paynym_follow_view.dart';
|
||||||
import 'package:stackwallet/pages/paynym/paynym_claim_view.dart';
|
import 'package:stackwallet/pages/paynym/paynym_claim_view.dart';
|
||||||
import 'package:stackwallet/pages/paynym/paynym_home_view.dart';
|
import 'package:stackwallet/pages/paynym/paynym_home_view.dart';
|
||||||
import 'package:stackwallet/pages/pinpad_views/create_pin_view.dart';
|
import 'package:stackwallet/pages/pinpad_views/create_pin_view.dart';
|
||||||
|
import 'package:stackwallet/pages/receive_view/addresses/edit_address_label_view.dart';
|
||||||
|
import 'package:stackwallet/pages/receive_view/addresses/receiving_addresses_view.dart';
|
||||||
import 'package:stackwallet/pages/receive_view/generate_receiving_uri_qr_code_view.dart';
|
import 'package:stackwallet/pages/receive_view/generate_receiving_uri_qr_code_view.dart';
|
||||||
import 'package:stackwallet/pages/receive_view/receive_view.dart';
|
import 'package:stackwallet/pages/receive_view/receive_view.dart';
|
||||||
import 'package:stackwallet/pages/receive_view/receiving_addresses_view.dart';
|
|
||||||
import 'package:stackwallet/pages/send_view/confirm_transaction_view.dart';
|
import 'package:stackwallet/pages/send_view/confirm_transaction_view.dart';
|
||||||
import 'package:stackwallet/pages/send_view/send_view.dart';
|
import 'package:stackwallet/pages/send_view/send_view.dart';
|
||||||
import 'package:stackwallet/pages/settings_views/global_settings_view/about_view.dart';
|
import 'package:stackwallet/pages/settings_views/global_settings_view/about_view.dart';
|
||||||
|
@ -474,6 +476,21 @@ class RouteGenerator {
|
||||||
}
|
}
|
||||||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||||
|
|
||||||
|
case EditAddressLabelView.routeName:
|
||||||
|
if (args is Tuple2<Address, String>) {
|
||||||
|
return getRoute(
|
||||||
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||||
|
builder: (_) => EditAddressLabelView(
|
||||||
|
address: args.item1,
|
||||||
|
walletId: args.item2,
|
||||||
|
),
|
||||||
|
settings: RouteSettings(
|
||||||
|
name: settings.name,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||||
|
|
||||||
case EditTradeNoteView.routeName:
|
case EditTradeNoteView.routeName:
|
||||||
if (args is Tuple2<String, String>) {
|
if (args is Tuple2<String, String>) {
|
||||||
return getRoute(
|
return getRoute(
|
||||||
|
|
|
@ -1267,46 +1267,31 @@ class BitcoinWallet extends CoinServiceAPI
|
||||||
// transactions locally in a good way
|
// transactions locally in a good way
|
||||||
@override
|
@override
|
||||||
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
||||||
// final priceData =
|
final transaction = isar_models.Transaction(
|
||||||
// await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
|
walletId: walletId,
|
||||||
// Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
|
txid: txData["txid"] as String,
|
||||||
// final locale =
|
timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
// Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
type: isar_models.TransactionType.outgoing,
|
||||||
// final String worthNow = Format.localizedStringAsFixed(
|
subType: isar_models.TransactionSubType.none,
|
||||||
// value:
|
amount: txData["recipientAmt"] as int,
|
||||||
// ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
|
fee: txData["fee"] as int,
|
||||||
// Decimal.fromInt(Constants.satsPerCoin(coin)))
|
height: null,
|
||||||
// .toDecimal(scaleOnInfinitePrecision: 2),
|
isCancelled: false,
|
||||||
// decimalPlaces: 2,
|
isLelantus: false,
|
||||||
// locale: locale!);
|
otherData: null,
|
||||||
//
|
slateId: null,
|
||||||
// final tx = models.Transaction(
|
);
|
||||||
// txid: txData["txid"] as String,
|
|
||||||
// confirmedStatus: false,
|
final address = txData["address"] is String
|
||||||
// timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
? await db.getAddress(walletId, txData["address"] as String)
|
||||||
// txType: "Sent",
|
: null;
|
||||||
// amount: txData["recipientAmt"] as int,
|
|
||||||
// worthNow: worthNow,
|
await db.addNewTransactionData(
|
||||||
// worthAtBlockTimestamp: worthNow,
|
[
|
||||||
// fees: txData["fee"] as int,
|
Tuple4(transaction, [], [], address),
|
||||||
// inputSize: 0,
|
],
|
||||||
// outputSize: 0,
|
walletId,
|
||||||
// inputs: [],
|
);
|
||||||
// outputs: [],
|
|
||||||
// address: txData["address"] as String,
|
|
||||||
// height: -1,
|
|
||||||
// confirmations: 0,
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (cachedTxData == null) {
|
|
||||||
// final data = await _fetchTransactionData();
|
|
||||||
// _transactionData = Future(() => data);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final transactions = cachedTxData!.getAllTransactions();
|
|
||||||
// transactions[tx.txid] = tx;
|
|
||||||
// cachedTxData = models.TransactionData.fromMap(transactions);
|
|
||||||
// _transactionData = Future(() => cachedTxData!);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -1200,46 +1200,31 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
// transactions locally in a good way
|
// transactions locally in a good way
|
||||||
@override
|
@override
|
||||||
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
||||||
// final priceData =
|
final transaction = isar_models.Transaction(
|
||||||
// await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
|
walletId: walletId,
|
||||||
// Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
|
txid: txData["txid"] as String,
|
||||||
// final locale =
|
timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
// Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
type: isar_models.TransactionType.outgoing,
|
||||||
// final String worthNow = Format.localizedStringAsFixed(
|
subType: isar_models.TransactionSubType.none,
|
||||||
// value:
|
amount: txData["recipientAmt"] as int,
|
||||||
// ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
|
fee: txData["fee"] as int,
|
||||||
// Decimal.fromInt(Constants.satsPerCoin(coin)))
|
height: null,
|
||||||
// .toDecimal(scaleOnInfinitePrecision: 2),
|
isCancelled: false,
|
||||||
// decimalPlaces: 2,
|
isLelantus: false,
|
||||||
// locale: locale!);
|
otherData: null,
|
||||||
//
|
slateId: null,
|
||||||
// final tx = models.Transaction(
|
);
|
||||||
// txid: txData["txid"] as String,
|
|
||||||
// confirmedStatus: false,
|
final address = txData["address"] is String
|
||||||
// timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
? await db.getAddress(walletId, txData["address"] as String)
|
||||||
// txType: "Sent",
|
: null;
|
||||||
// amount: txData["recipientAmt"] as int,
|
|
||||||
// worthNow: worthNow,
|
await db.addNewTransactionData(
|
||||||
// worthAtBlockTimestamp: worthNow,
|
[
|
||||||
// fees: txData["fee"] as int,
|
Tuple4(transaction, [], [], address),
|
||||||
// inputSize: 0,
|
],
|
||||||
// outputSize: 0,
|
walletId,
|
||||||
// inputs: [],
|
);
|
||||||
// outputs: [],
|
|
||||||
// address: txData["address"] as String,
|
|
||||||
// height: -1,
|
|
||||||
// confirmations: 0,
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (cachedTxData == null) {
|
|
||||||
// final data = await _fetchTransactionData();
|
|
||||||
// _transactionData = Future(() => data);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final transactions = cachedTxData!.getAllTransactions();
|
|
||||||
// transactions[tx.txid] = tx;
|
|
||||||
// cachedTxData = models.TransactionData.fromMap(transactions);
|
|
||||||
// _transactionData = Future(() => cachedTxData!);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool validateCashAddr(String cashAddr) {
|
bool validateCashAddr(String cashAddr) {
|
||||||
|
|
|
@ -1059,46 +1059,31 @@ class DogecoinWallet extends CoinServiceAPI
|
||||||
// transactions locally in a good way
|
// transactions locally in a good way
|
||||||
@override
|
@override
|
||||||
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
||||||
// final priceData =
|
final transaction = isar_models.Transaction(
|
||||||
// await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
|
walletId: walletId,
|
||||||
// Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
|
txid: txData["txid"] as String,
|
||||||
// final locale =
|
timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
// Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
type: isar_models.TransactionType.outgoing,
|
||||||
// final String worthNow = Format.localizedStringAsFixed(
|
subType: isar_models.TransactionSubType.none,
|
||||||
// value:
|
amount: txData["recipientAmt"] as int,
|
||||||
// ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
|
fee: txData["fee"] as int,
|
||||||
// Decimal.fromInt(Constants.satsPerCoin(coin)))
|
height: null,
|
||||||
// .toDecimal(scaleOnInfinitePrecision: 2),
|
isCancelled: false,
|
||||||
// decimalPlaces: 2,
|
isLelantus: false,
|
||||||
// locale: locale!);
|
otherData: null,
|
||||||
//
|
slateId: null,
|
||||||
// final tx = models.Transaction(
|
);
|
||||||
// txid: txData["txid"] as String,
|
|
||||||
// confirmedStatus: false,
|
final address = txData["address"] is String
|
||||||
// timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
? await db.getAddress(walletId, txData["address"] as String)
|
||||||
// txType: "Sent",
|
: null;
|
||||||
// amount: txData["recipientAmt"] as int,
|
|
||||||
// worthNow: worthNow,
|
await db.addNewTransactionData(
|
||||||
// worthAtBlockTimestamp: worthNow,
|
[
|
||||||
// fees: txData["fee"] as int,
|
Tuple4(transaction, [], [], address),
|
||||||
// inputSize: 0,
|
],
|
||||||
// outputSize: 0,
|
walletId,
|
||||||
// inputs: [],
|
);
|
||||||
// outputs: [],
|
|
||||||
// address: txData["address"] as String,
|
|
||||||
// height: -1,
|
|
||||||
// confirmations: 0,
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (cachedTxData == null) {
|
|
||||||
// final data = await _fetchTransactionData();
|
|
||||||
// _transactionData = Future(() => data);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final transactions = cachedTxData!.getAllTransactions();
|
|
||||||
// transactions[tx.txid] = tx;
|
|
||||||
// cachedTxData = models.TransactionData.fromMap(transactions);
|
|
||||||
// _transactionData = Future(() => cachedTxData!);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -818,44 +818,31 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
|
||||||
// transactions locally in a good way
|
// transactions locally in a good way
|
||||||
@override
|
@override
|
||||||
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
||||||
// final currentPrice = await firoPrice;
|
final transaction = isar_models.Transaction(
|
||||||
// final locale =
|
walletId: walletId,
|
||||||
// Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
txid: txData["txid"] as String,
|
||||||
// final String worthNow = Format.localizedStringAsFixed(
|
timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
// value:
|
type: isar_models.TransactionType.outgoing,
|
||||||
// ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
|
subType: isar_models.TransactionSubType.none,
|
||||||
// Decimal.fromInt(Constants.satsPerCoin(coin)))
|
amount: txData["recipientAmt"] as int,
|
||||||
// .toDecimal(scaleOnInfinitePrecision: 2),
|
fee: txData["fee"] as int,
|
||||||
// decimalPlaces: 2,
|
height: null,
|
||||||
// locale: locale!);
|
isCancelled: false,
|
||||||
//
|
isLelantus: false,
|
||||||
// final tx = models.Transaction(
|
otherData: null,
|
||||||
// txid: txData["txid"] as String,
|
slateId: null,
|
||||||
// confirmedStatus: false,
|
);
|
||||||
// timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
|
||||||
// txType: "Sent",
|
final address = txData["address"] is String
|
||||||
// amount: txData["recipientAmt"] as int,
|
? await db.getAddress(walletId, txData["address"] as String)
|
||||||
// worthNow: worthNow,
|
: null;
|
||||||
// worthAtBlockTimestamp: worthNow,
|
|
||||||
// fees: txData["fee"] as int,
|
await db.addNewTransactionData(
|
||||||
// inputSize: 0,
|
[
|
||||||
// outputSize: 0,
|
Tuple4(transaction, [], [], address),
|
||||||
// inputs: [],
|
],
|
||||||
// outputs: [],
|
walletId,
|
||||||
// address: txData["address"] as String,
|
);
|
||||||
// height: -1,
|
|
||||||
// confirmations: 0,
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (cachedTxData == null) {
|
|
||||||
// final data = await _fetchTransactionData();
|
|
||||||
// _transactionData = Future(() => data);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final transactions = cachedTxData!.getAllTransactions();
|
|
||||||
// transactions[tx.txid] = tx;
|
|
||||||
// cachedTxData = models.TransactionData.fromMap(transactions);
|
|
||||||
// _transactionData = Future(() => cachedTxData!);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Holds the max fee that can be sent
|
/// Holds the max fee that can be sent
|
||||||
|
|
|
@ -1214,46 +1214,31 @@ class LitecoinWallet extends CoinServiceAPI
|
||||||
// transactions locally in a good way
|
// transactions locally in a good way
|
||||||
@override
|
@override
|
||||||
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
||||||
// final priceData =
|
final transaction = isar_models.Transaction(
|
||||||
// await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
|
walletId: walletId,
|
||||||
// Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
|
txid: txData["txid"] as String,
|
||||||
// final locale =
|
timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
// Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
type: isar_models.TransactionType.outgoing,
|
||||||
// final String worthNow = Format.localizedStringAsFixed(
|
subType: isar_models.TransactionSubType.none,
|
||||||
// value:
|
amount: txData["recipientAmt"] as int,
|
||||||
// ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
|
fee: txData["fee"] as int,
|
||||||
// Decimal.fromInt(Constants.satsPerCoin(coin)))
|
height: null,
|
||||||
// .toDecimal(scaleOnInfinitePrecision: 2),
|
isCancelled: false,
|
||||||
// decimalPlaces: 2,
|
isLelantus: false,
|
||||||
// locale: locale!);
|
otherData: null,
|
||||||
//
|
slateId: null,
|
||||||
// final tx = models.Transaction(
|
);
|
||||||
// txid: txData["txid"] as String,
|
|
||||||
// confirmedStatus: false,
|
final address = txData["address"] is String
|
||||||
// timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
? await db.getAddress(walletId, txData["address"] as String)
|
||||||
// txType: "Sent",
|
: null;
|
||||||
// amount: txData["recipientAmt"] as int,
|
|
||||||
// worthNow: worthNow,
|
await db.addNewTransactionData(
|
||||||
// worthAtBlockTimestamp: worthNow,
|
[
|
||||||
// fees: txData["fee"] as int,
|
Tuple4(transaction, [], [], address),
|
||||||
// inputSize: 0,
|
],
|
||||||
// outputSize: 0,
|
walletId,
|
||||||
// inputs: [],
|
);
|
||||||
// outputs: [],
|
|
||||||
// address: txData["address"] as String,
|
|
||||||
// height: -1,
|
|
||||||
// confirmations: 0,
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (cachedTxData == null) {
|
|
||||||
// final data = await _refreshTransactions();
|
|
||||||
// _transactionData = Future(() => data);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final transactions = cachedTxData!.getAllTransactions();
|
|
||||||
// transactions[tx.txid] = tx;
|
|
||||||
// cachedTxData = models.TransactionData.fromMap(transactions);
|
|
||||||
// _transactionData = Future(() => cachedTxData!);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -110,8 +110,15 @@ class Manager with ChangeNotifier {
|
||||||
try {
|
try {
|
||||||
final txid = await _currentWallet.confirmSend(txData: txData);
|
final txid = await _currentWallet.confirmSend(txData: txData);
|
||||||
|
|
||||||
txData["txid"] = txid;
|
try {
|
||||||
await _currentWallet.updateSentCachedTxData(txData);
|
txData["txid"] = txid;
|
||||||
|
await _currentWallet.updateSentCachedTxData(txData);
|
||||||
|
} catch (e, s) {
|
||||||
|
// do not rethrow as that would get handled as a send failure further up
|
||||||
|
// also this is not critical code and transaction should show up on \
|
||||||
|
// refresh regardless
|
||||||
|
Logging.instance.log("$e\n$s", level: LogLevel.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return txid;
|
return txid;
|
||||||
|
|
|
@ -1203,46 +1203,31 @@ class NamecoinWallet extends CoinServiceAPI
|
||||||
// transactions locally in a good way
|
// transactions locally in a good way
|
||||||
@override
|
@override
|
||||||
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
||||||
// final priceData =
|
final transaction = isar_models.Transaction(
|
||||||
// await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
|
walletId: walletId,
|
||||||
// Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
|
txid: txData["txid"] as String,
|
||||||
// final locale =
|
timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
// Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
type: isar_models.TransactionType.outgoing,
|
||||||
// final String worthNow = Format.localizedStringAsFixed(
|
subType: isar_models.TransactionSubType.none,
|
||||||
// value:
|
amount: txData["recipientAmt"] as int,
|
||||||
// ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
|
fee: txData["fee"] as int,
|
||||||
// Decimal.fromInt(Constants.satsPerCoin(coin)))
|
height: null,
|
||||||
// .toDecimal(scaleOnInfinitePrecision: 2),
|
isCancelled: false,
|
||||||
// decimalPlaces: 2,
|
isLelantus: false,
|
||||||
// locale: locale!);
|
otherData: null,
|
||||||
//
|
slateId: null,
|
||||||
// final tx = models.Transaction(
|
);
|
||||||
// txid: txData["txid"] as String,
|
|
||||||
// confirmedStatus: false,
|
final address = txData["address"] is String
|
||||||
// timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
? await db.getAddress(walletId, txData["address"] as String)
|
||||||
// txType: "Sent",
|
: null;
|
||||||
// amount: txData["recipientAmt"] as int,
|
|
||||||
// worthNow: worthNow,
|
await db.addNewTransactionData(
|
||||||
// worthAtBlockTimestamp: worthNow,
|
[
|
||||||
// fees: txData["fee"] as int,
|
Tuple4(transaction, [], [], address),
|
||||||
// inputSize: 0,
|
],
|
||||||
// outputSize: 0,
|
walletId,
|
||||||
// inputs: [],
|
);
|
||||||
// outputs: [],
|
|
||||||
// address: txData["address"] as String,
|
|
||||||
// height: -1,
|
|
||||||
// confirmations: 0,
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (cachedTxData == null) {
|
|
||||||
// final data = await _refreshTransactions();
|
|
||||||
// _transactionData = Future(() => data);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final transactions = cachedTxData!.getAllTransactions();
|
|
||||||
// transactions[tx.txid] = tx;
|
|
||||||
// cachedTxData = models.TransactionData.fromMap(transactions);
|
|
||||||
// _transactionData = Future(() => cachedTxData!);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -1438,17 +1423,21 @@ class NamecoinWallet extends CoinServiceAPI
|
||||||
Logging.instance
|
Logging.instance
|
||||||
.log("IS_INTEGRATION_TEST: $integrationTestFlag", level: LogLevel.Info);
|
.log("IS_INTEGRATION_TEST: $integrationTestFlag", level: LogLevel.Info);
|
||||||
if (!integrationTestFlag) {
|
if (!integrationTestFlag) {
|
||||||
final features = await electrumXClient.getServerFeatures();
|
try {
|
||||||
Logging.instance.log("features: $features", level: LogLevel.Info);
|
final features = await electrumXClient.getServerFeatures();
|
||||||
switch (coin) {
|
Logging.instance.log("features: $features", level: LogLevel.Info);
|
||||||
case Coin.namecoin:
|
switch (coin) {
|
||||||
if (features['genesis_hash'] != GENESIS_HASH_MAINNET) {
|
case Coin.namecoin:
|
||||||
throw Exception("genesis hash does not match main net!");
|
if (features['genesis_hash'] != GENESIS_HASH_MAINNET) {
|
||||||
}
|
throw Exception("genesis hash does not match main net!");
|
||||||
break;
|
}
|
||||||
default:
|
break;
|
||||||
throw Exception(
|
default:
|
||||||
"Attempted to generate a NamecoinWallet using a non namecoin coin type: ${coin.name}");
|
throw Exception(
|
||||||
|
"Attempted to generate a NamecoinWallet using a non namecoin coin type: ${coin.name}");
|
||||||
|
}
|
||||||
|
} catch (e, s) {
|
||||||
|
Logging.instance.log("$e/n$s", level: LogLevel.Info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1131,46 +1131,31 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
// transactions locally in a good way
|
// transactions locally in a good way
|
||||||
@override
|
@override
|
||||||
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
||||||
// final priceData =
|
final transaction = isar_models.Transaction(
|
||||||
// await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
|
walletId: walletId,
|
||||||
// Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
|
txid: txData["txid"] as String,
|
||||||
// final locale =
|
timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
// Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
type: isar_models.TransactionType.outgoing,
|
||||||
// final String worthNow = Format.localizedStringAsFixed(
|
subType: isar_models.TransactionSubType.none,
|
||||||
// value:
|
amount: txData["recipientAmt"] as int,
|
||||||
// ((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
|
fee: txData["fee"] as int,
|
||||||
// Decimal.fromInt(Constants.satsPerCoin(coin)))
|
height: null,
|
||||||
// .toDecimal(scaleOnInfinitePrecision: 2),
|
isCancelled: false,
|
||||||
// decimalPlaces: 2,
|
isLelantus: false,
|
||||||
// locale: locale!);
|
otherData: null,
|
||||||
//
|
slateId: null,
|
||||||
// final tx = models.Transaction(
|
);
|
||||||
// txid: txData["txid"] as String,
|
|
||||||
// confirmedStatus: false,
|
final address = txData["address"] is String
|
||||||
// timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
? await db.getAddress(walletId, txData["address"] as String)
|
||||||
// txType: "Sent",
|
: null;
|
||||||
// amount: txData["recipientAmt"] as int,
|
|
||||||
// worthNow: worthNow,
|
await db.addNewTransactionData(
|
||||||
// worthAtBlockTimestamp: worthNow,
|
[
|
||||||
// fees: txData["fee"] as int,
|
Tuple4(transaction, [], [], address),
|
||||||
// inputSize: 0,
|
],
|
||||||
// outputSize: 0,
|
walletId,
|
||||||
// inputs: [],
|
);
|
||||||
// outputs: [],
|
|
||||||
// address: txData["address"] as String,
|
|
||||||
// height: -1,
|
|
||||||
// confirmations: 0,
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (cachedTxData == null) {
|
|
||||||
// final data = await _refreshTransactions();
|
|
||||||
// _transactionData = Future(() => data);
|
|
||||||
// } else {
|
|
||||||
// final transactions = cachedTxData!.getAllTransactions();
|
|
||||||
// transactions[tx.txid] = tx;
|
|
||||||
// cachedTxData = models.TransactionData.fromMap(transactions);
|
|
||||||
// _transactionData = Future(() => cachedTxData!);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -1353,17 +1338,21 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
Logging.instance
|
Logging.instance
|
||||||
.log("IS_INTEGRATION_TEST: $integrationTestFlag", level: LogLevel.Info);
|
.log("IS_INTEGRATION_TEST: $integrationTestFlag", level: LogLevel.Info);
|
||||||
if (!integrationTestFlag) {
|
if (!integrationTestFlag) {
|
||||||
final features = await electrumXClient.getServerFeatures();
|
try {
|
||||||
Logging.instance.log("features: $features", level: LogLevel.Info);
|
final features = await electrumXClient.getServerFeatures();
|
||||||
switch (coin) {
|
Logging.instance.log("features: $features", level: LogLevel.Info);
|
||||||
case Coin.particl:
|
switch (coin) {
|
||||||
if (features['genesis_hash'] != GENESIS_HASH_MAINNET) {
|
case Coin.particl:
|
||||||
throw Exception("genesis hash does not match main net!");
|
if (features['genesis_hash'] != GENESIS_HASH_MAINNET) {
|
||||||
}
|
throw Exception("genesis hash does not match main net!");
|
||||||
break;
|
}
|
||||||
default:
|
break;
|
||||||
throw Exception(
|
default:
|
||||||
"Attempted to generate a ParticlWallet using a non particl coin type: ${coin.name}");
|
throw Exception(
|
||||||
|
"Attempted to generate a ParticlWallet using a non particl coin type: ${coin.name}");
|
||||||
|
}
|
||||||
|
} catch (e, s) {
|
||||||
|
Logging.instance.log("$e/n$s", level: LogLevel.Info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ class OceanBreezeColors extends StackColorTheme {
|
||||||
@override
|
@override
|
||||||
Color get buttonTextPrimary => const Color(0xFFFFFFFF);
|
Color get buttonTextPrimary => const Color(0xFFFFFFFF);
|
||||||
@override
|
@override
|
||||||
Color get buttonTextSecondary => const Color(0xFF232323);
|
Color get buttonTextSecondary => accentColorDark;
|
||||||
@override
|
@override
|
||||||
Color get buttonTextPrimaryDisabled => const Color(0xFFFFFFFF);
|
Color get buttonTextPrimaryDisabled => const Color(0xFFFFFFFF);
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -11,6 +11,7 @@ class RoundedContainer extends StatelessWidget {
|
||||||
this.width,
|
this.width,
|
||||||
this.height,
|
this.height,
|
||||||
this.borderColor,
|
this.borderColor,
|
||||||
|
this.boxShadow,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final Widget? child;
|
final Widget? child;
|
||||||
|
@ -20,6 +21,7 @@ class RoundedContainer extends StatelessWidget {
|
||||||
final double? width;
|
final double? width;
|
||||||
final double? height;
|
final double? height;
|
||||||
final Color? borderColor;
|
final Color? borderColor;
|
||||||
|
final List<BoxShadow>? boxShadow;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -32,6 +34,7 @@ class RoundedContainer extends StatelessWidget {
|
||||||
Constants.size.circularBorderRadius * radiusMultiplier,
|
Constants.size.circularBorderRadius * radiusMultiplier,
|
||||||
),
|
),
|
||||||
border: borderColor == null ? null : Border.all(color: borderColor!),
|
border: borderColor == null ? null : Border.all(color: borderColor!),
|
||||||
|
boxShadow: boxShadow,
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: padding,
|
padding: padding,
|
||||||
|
|
|
@ -11,6 +11,7 @@ class RoundedWhiteContainer extends StatelessWidget {
|
||||||
this.width,
|
this.width,
|
||||||
this.height,
|
this.height,
|
||||||
this.borderColor,
|
this.borderColor,
|
||||||
|
this.boxShadow,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final Widget? child;
|
final Widget? child;
|
||||||
|
@ -19,6 +20,7 @@ class RoundedWhiteContainer extends StatelessWidget {
|
||||||
final double? width;
|
final double? width;
|
||||||
final double? height;
|
final double? height;
|
||||||
final Color? borderColor;
|
final Color? borderColor;
|
||||||
|
final List<BoxShadow>? boxShadow;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -29,6 +31,7 @@ class RoundedWhiteContainer extends StatelessWidget {
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
borderColor: borderColor,
|
borderColor: borderColor,
|
||||||
|
boxShadow: boxShadow,
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue