mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 11:29:23 +00:00
Merge remote-tracking branch 'origin_SW/staging' into ordinals
# Conflicts: # lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart # lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/more_features/more_features_dialog.dart # pubspec.yaml
This commit is contained in:
commit
46e0258737
13 changed files with 1106 additions and 71 deletions
3
assets/svg/monkey.svg
Normal file
3
assets/svg/monkey.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6.32099 5.11654C6.36635 4.1732 5.61228 3.38665 4.66934 3.38665H4.33832C3.26477 3.38665 2.34238 4.25531 2.34238 5.35395V13.0533C2.34238 15.0164 3.93487 16.6089 5.89793 16.6089H6.38407L6.39773 16.1229L6.42638 15.1044L6.42658 15.1044V15.0904C6.42658 12.5838 8.06723 10.4614 10.3343 9.74146C11.2194 10.8231 12.5669 11.5163 14.0747 11.5163C14.341 11.5163 14.5977 11.4793 14.8307 11.4349L17.2447 13.7633L17.2463 13.7649C18.1535 14.6318 18.6673 15.8317 18.6673 17.0892V17.1274C18.6673 17.4146 18.436 17.6459 18.1488 17.6459C17.8616 17.6459 17.6303 17.4146 17.6303 17.1274V17.0892C17.6303 16.1162 17.2343 15.1861 16.5298 14.5151L14.4197 12.5036L13.5747 11.6981V12.8655V16.1089V16.6089H14.0747H15.0932C15.3805 16.6089 15.6118 16.8402 15.6118 17.1274C15.6118 17.4146 15.3805 17.6459 15.0932 17.6459H5.92658C3.38996 17.6459 1.33398 15.5908 1.33398 13.0533V5.35395C1.33398 3.6952 2.67931 2.34962 4.33832 2.34962H4.66934C6.20478 2.34962 7.42841 3.6318 7.35595 5.16484L7.35592 5.16564C7.29694 6.45768 6.32086 7.52368 5.03701 7.70095L5.03698 7.70076L5.0232 7.70306L4.97418 7.71122C4.69124 7.74677 4.43295 7.54849 4.39441 7.26866C4.35516 6.98361 4.55436 6.72184 4.83595 6.68323L4.83596 6.68333L4.84599 6.68174L4.90097 6.67306C5.6898 6.56499 6.28431 5.90776 6.32099 5.11654ZM6.32099 5.11654C6.32098 5.11674 6.32097 5.11695 6.32096 5.11715L5.82154 5.09295L6.32101 5.11592C6.321 5.11612 6.32099 5.11633 6.32099 5.11654ZM11.4399 7.74158L11.3069 7.46881L11.0036 7.46089C10.1647 7.43901 9.48213 6.76462 9.48213 5.92368C9.48213 5.07034 10.1733 4.38712 10.9908 4.38665L11.308 4.38646C11.1303 4.68787 11.0284 5.03924 11.0284 5.41442C11.0284 6.26965 11.5569 6.99893 12.3044 7.29712C12.3563 8.22999 13.1288 8.96998 14.0747 8.96998C15.0206 8.96998 15.7931 8.22999 15.8451 7.29712C16.5926 6.99893 17.121 6.26965 17.121 5.41442C17.121 5.03925 17.0191 4.68789 16.8415 4.38648L17.13 4.38665C17.9808 4.38713 18.6673 5.07495 18.6673 5.92368C18.6673 6.76031 17.9892 7.43872 17.1176 7.46088L16.7929 7.46914L16.6685 7.76911C16.247 8.78503 15.2445 9.49776 14.0747 9.49776C13.2838 9.49776 12.5655 9.16901 12.0541 8.64197C11.812 8.38874 11.6082 8.08661 11.4399 7.74158ZM13.0562 3.38665C12.3341 3.38665 11.6999 3.76432 11.3406 4.33302L11.4483 4.08766C11.8986 3.0621 12.9068 2.34961 14.0747 2.34961C15.2444 2.34961 16.2469 3.06287 16.6685 4.07834L16.7212 4.20536C16.3516 3.7085 15.7599 3.38665 15.0932 3.38665H13.0562ZM13.0469 5.41442C13.0469 5.41314 13.0471 5.41269 13.0473 5.4122C13.0477 5.41135 13.0485 5.40988 13.0501 5.40831C13.0517 5.40674 13.0531 5.4059 13.054 5.40554C13.0542 5.40545 13.0544 5.40538 13.0546 5.40531C13.055 5.40522 13.0555 5.40517 13.0562 5.40517C13.0575 5.40517 13.0579 5.40533 13.0584 5.40554C13.0593 5.4059 13.0607 5.40674 13.0623 5.40831C13.0639 5.40988 13.0647 5.41135 13.0651 5.4122C13.0653 5.41269 13.0655 5.41314 13.0655 5.41442C13.0655 5.415 13.0654 5.41541 13.0654 5.41573C13.0653 5.41612 13.0652 5.41638 13.0651 5.41665C13.0647 5.41749 13.0639 5.41897 13.0623 5.42054C13.0607 5.4221 13.0593 5.42295 13.0584 5.42331C13.0579 5.42352 13.0575 5.42368 13.0562 5.42368C13.0556 5.42368 13.0551 5.42364 13.0548 5.42358C13.0545 5.42351 13.0542 5.42341 13.054 5.42331C13.0531 5.42295 13.0517 5.4221 13.0501 5.42054C13.0485 5.41897 13.0477 5.41749 13.0473 5.41665C13.0471 5.41616 13.0469 5.41571 13.0469 5.41442ZM15.1025 5.41442C15.1025 5.41571 15.1023 5.41616 15.1021 5.41665C15.1018 5.41749 15.1009 5.41897 15.0994 5.42054C15.0978 5.4221 15.0963 5.42295 15.0955 5.42331C15.095 5.42352 15.0945 5.42368 15.0932 5.42368C15.092 5.42368 15.0915 5.42352 15.091 5.42331C15.0902 5.42295 15.0887 5.4221 15.0871 5.42054C15.0856 5.41897 15.0847 5.41749 15.0844 5.41665C15.0843 5.41643 15.0842 5.41621 15.0841 5.41592C15.084 5.41557 15.084 5.41512 15.084 5.41442C15.084 5.41314 15.0842 5.41269 15.0844 5.4122C15.0845 5.41178 15.0848 5.41121 15.0853 5.41054C15.0857 5.40987 15.0863 5.4091 15.0871 5.40831C15.0887 5.40674 15.0902 5.4059 15.091 5.40554C15.0915 5.40533 15.092 5.40517 15.0932 5.40517C15.0939 5.40517 15.0943 5.4052 15.0946 5.40527C15.095 5.40534 15.0952 5.40543 15.0955 5.40554C15.0963 5.4059 15.0978 5.40674 15.0994 5.40831C15.1009 5.40988 15.1018 5.41135 15.1021 5.4122C15.1023 5.41269 15.1025 5.41314 15.1025 5.41442Z" fill="#8E9192" stroke="#8E9192"/>
|
||||
</svg>
|
After Width: | Height: | Size: 4.3 KiB |
|
@ -1 +1 @@
|
|||
Subproject commit e48952185556a10f182184fd572bcb04365f5831
|
||||
Subproject commit 407425c9fcf7a30c81f1345246c7225bc18b5cd5
|
275
lib/pages/monkey/monkey_loaded_view.dart
Normal file
275
lib/pages/monkey/monkey_loaded_view.dart
Normal file
|
@ -0,0 +1,275 @@
|
|||
// import 'dart:io';
|
||||
// import 'dart:typed_data';
|
||||
//
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
// import 'package:flutter_svg/svg.dart';
|
||||
// import 'package:http/http.dart' as http;
|
||||
// import 'package:path_provider/path_provider.dart';
|
||||
// import 'package:permission_handler/permission_handler.dart';
|
||||
// import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
|
||||
// import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||
// import 'package:stackwallet/services/coins/banano/banano_wallet.dart';
|
||||
// import 'package:stackwallet/services/coins/manager.dart';
|
||||
// import 'package:stackwallet/themes/stack_colors.dart';
|
||||
// import 'package:stackwallet/utilities/assets.dart';
|
||||
// import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
// import 'package:stackwallet/utilities/text_styles.dart';
|
||||
// import 'package:stackwallet/widgets/background.dart';
|
||||
// import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
// import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||
//
|
||||
// class MonkeyLoadedView extends ConsumerStatefulWidget {
|
||||
// const MonkeyLoadedView({
|
||||
// Key? key,
|
||||
// required this.walletId,
|
||||
// required this.managerProvider,
|
||||
// }) : super(key: key);
|
||||
//
|
||||
// static const String routeName = "/hasMonkey";
|
||||
// static const double navBarHeight = 65.0;
|
||||
//
|
||||
// final String walletId;
|
||||
// final ChangeNotifierProvider<Manager> managerProvider;
|
||||
//
|
||||
// @override
|
||||
// ConsumerState<MonkeyLoadedView> createState() => _MonkeyLoadedViewState();
|
||||
// }
|
||||
//
|
||||
// class _MonkeyLoadedViewState extends ConsumerState<MonkeyLoadedView> {
|
||||
// late final String walletId;
|
||||
// late final ChangeNotifierProvider<Manager> managerProvider;
|
||||
//
|
||||
// String receivingAddress = "";
|
||||
//
|
||||
// void getMonkeySVG(String address) async {
|
||||
// if (address.isEmpty) {
|
||||
// //address shouldn't be empty
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// final http.Response response = await http
|
||||
// .get(Uri.parse('https://monkey.banano.cc/api/v1/monkey/$address'));
|
||||
//
|
||||
// if (response.statusCode == 200) {
|
||||
// final decodedResponse = response.bodyBytes;
|
||||
// Directory directory = await getApplicationDocumentsDirectory();
|
||||
// late Directory sampleFolder;
|
||||
//
|
||||
// if (Platform.isAndroid) {
|
||||
// directory = Directory("/storage/emulated/0/");
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// } else if (Platform.isIOS) {
|
||||
// sampleFolder = Directory(directory!.path);
|
||||
// } else if (Platform.isLinux) {
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// } else if (Platform.isWindows) {
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// } else if (Platform.isMacOS) {
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// if (!sampleFolder.existsSync()) {
|
||||
// sampleFolder.createSync(recursive: true);
|
||||
// }
|
||||
// } catch (e, s) {
|
||||
// // todo: come back to this
|
||||
// debugPrint("$e $s");
|
||||
// }
|
||||
//
|
||||
// final docPath = sampleFolder.path;
|
||||
// final filePath = "$docPath/monkey.svg";
|
||||
//
|
||||
// File imgFile = File(filePath);
|
||||
// await imgFile.writeAsBytes(decodedResponse);
|
||||
// } else {
|
||||
// throw Exception("Failed to get MonKey");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void getMonkeyPNG(String address) async {
|
||||
// if (address.isEmpty) {
|
||||
// //address shouldn't be empty
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// final http.Response response = await http.get(Uri.parse(
|
||||
// 'https://monkey.banano.cc/api/v1/monkey/${address}?format=png&size=512&background=false'));
|
||||
//
|
||||
// if (response.statusCode == 200) {
|
||||
// if (Platform.isAndroid) {
|
||||
// await Permission.storage.request();
|
||||
// }
|
||||
//
|
||||
// final decodedResponse = response.bodyBytes;
|
||||
// Directory directory = await getApplicationDocumentsDirectory();
|
||||
// late Directory sampleFolder;
|
||||
//
|
||||
// if (Platform.isAndroid) {
|
||||
// directory = Directory("/storage/emulated/0/");
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// } else if (Platform.isIOS) {
|
||||
// sampleFolder = Directory(directory!.path);
|
||||
// } else if (Platform.isLinux) {
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// } else if (Platform.isWindows) {
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// } else if (Platform.isMacOS) {
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// if (!sampleFolder.existsSync()) {
|
||||
// sampleFolder.createSync(recursive: true);
|
||||
// }
|
||||
// } catch (e, s) {
|
||||
// // todo: come back to this
|
||||
// debugPrint("$e $s");
|
||||
// }
|
||||
//
|
||||
// final docPath = sampleFolder.path;
|
||||
// final filePath = "$docPath/monkey.png";
|
||||
//
|
||||
// File imgFile = File(filePath);
|
||||
// await imgFile.writeAsBytes(decodedResponse);
|
||||
// } else {
|
||||
// throw Exception("Failed to get MonKey");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// void initState() {
|
||||
// walletId = widget.walletId;
|
||||
// managerProvider = widget.managerProvider;
|
||||
//
|
||||
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
// final address = await ref
|
||||
// .read(walletsChangeNotifierProvider)
|
||||
// .getManager(walletId)
|
||||
// .currentReceivingAddress;
|
||||
// setState(() {
|
||||
// receivingAddress = address;
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// super.initState();
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// void dispose() {
|
||||
// super.dispose();
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final Coin coin = ref.watch(managerProvider.select((value) => value.coin));
|
||||
// final manager = ref.watch(walletsChangeNotifierProvider
|
||||
// .select((value) => value.getManager(widget.walletId)));
|
||||
//
|
||||
// List<int>? imageBytes;
|
||||
// imageBytes = (manager.wallet as BananoWallet).getMonkeyImageBytes();
|
||||
//
|
||||
// return Background(
|
||||
// child: Stack(
|
||||
// children: [
|
||||
// Scaffold(
|
||||
// appBar: AppBar(
|
||||
// leading: AppBarBackButton(
|
||||
// onPressed: () {
|
||||
// Navigator.of(context).popUntil(
|
||||
// ModalRoute.withName(WalletView.routeName),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// title: Text(
|
||||
// "MonKey",
|
||||
// style: STextStyles.navBarTitle(context),
|
||||
// ),
|
||||
// actions: [
|
||||
// AspectRatio(
|
||||
// aspectRatio: 1,
|
||||
// child: AppBarIconButton(
|
||||
// icon: SvgPicture.asset(Assets.svg.circleQuestion),
|
||||
// onPressed: () {
|
||||
// showDialog<dynamic>(
|
||||
// context: context,
|
||||
// useSafeArea: false,
|
||||
// barrierDismissible: true,
|
||||
// builder: (context) {
|
||||
// return Dialog(
|
||||
// child: Material(
|
||||
// borderRadius: BorderRadius.circular(
|
||||
// 20,
|
||||
// ),
|
||||
// child: Container(
|
||||
// height: 200,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Theme.of(context)
|
||||
// .extension<StackColors>()!
|
||||
// .popupBG,
|
||||
// borderRadius: BorderRadius.circular(
|
||||
// 20,
|
||||
// ),
|
||||
// ),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Center(
|
||||
// child: Text(
|
||||
// "Help",
|
||||
// style: STextStyles.pageTitleH2(
|
||||
// context),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// });
|
||||
// }),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// body: Column(
|
||||
// children: [
|
||||
// const Spacer(
|
||||
// flex: 1,
|
||||
// ),
|
||||
// if (imageBytes != null)
|
||||
// Container(
|
||||
// child: SvgPicture.memory(Uint8List.fromList(imageBytes!)),
|
||||
// width: 300,
|
||||
// height: 300,
|
||||
// ),
|
||||
// const Spacer(
|
||||
// flex: 1,
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(16.0),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// SecondaryButton(
|
||||
// label: "Download as SVG",
|
||||
// onPressed: () async {
|
||||
// getMonkeySVG(receivingAddress);
|
||||
// },
|
||||
// ),
|
||||
// const SizedBox(height: 12),
|
||||
// SecondaryButton(
|
||||
// label: "Download as PNG",
|
||||
// onPressed: () {
|
||||
// getMonkeyPNG(receivingAddress);
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
497
lib/pages/monkey/monkey_view.dart
Normal file
497
lib/pages/monkey/monkey_view.dart
Normal file
|
@ -0,0 +1,497 @@
|
|||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||
import 'package:stackwallet/services/coins/banano/banano_wallet.dart';
|
||||
import 'package:stackwallet/themes/coin_icon_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/show_loading.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.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_app_bar.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_scaffold.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 MonkeyView extends ConsumerStatefulWidget {
|
||||
const MonkeyView({
|
||||
Key? key,
|
||||
required this.walletId,
|
||||
}) : super(key: key);
|
||||
|
||||
static const String routeName = "/monkey";
|
||||
static const double navBarHeight = 65.0;
|
||||
|
||||
final String walletId;
|
||||
|
||||
@override
|
||||
ConsumerState<MonkeyView> createState() => _MonkeyViewState();
|
||||
}
|
||||
|
||||
class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
||||
late final String walletId;
|
||||
List<int>? imageBytes;
|
||||
|
||||
String receivingAddress = "";
|
||||
|
||||
Future<void> getMonkeyImage(String address) async {
|
||||
if (address.isEmpty) {
|
||||
//address shouldn't be empty
|
||||
return;
|
||||
}
|
||||
|
||||
final http.Response response = await http
|
||||
.get(Uri.parse('https://monkey.banano.cc/api/v1/monkey/$address'));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final manager =
|
||||
ref.read(walletsChangeNotifierProvider).getManager(walletId);
|
||||
final decodedResponse = response.bodyBytes;
|
||||
await (manager.wallet as BananoWallet)
|
||||
.updateMonkeyImageBytes(decodedResponse);
|
||||
} else {
|
||||
throw Exception("Failed to get MonKey");
|
||||
}
|
||||
}
|
||||
|
||||
// void getMonkeySVG(String address) async {
|
||||
// if (address.isEmpty) {
|
||||
// //address shouldn't be empty
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// final http.Response response = await http
|
||||
// .get(Uri.parse('https://monkey.banano.cc/api/v1/monkey/$address'));
|
||||
//
|
||||
// if (response.statusCode == 200) {
|
||||
// final decodedResponse = response.bodyBytes;
|
||||
// Directory directory = await getApplicationDocumentsDirectory();
|
||||
// late Directory sampleFolder;
|
||||
//
|
||||
// if (Platform.isAndroid) {
|
||||
// directory = Directory("/storage/emulated/0/");
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// } else if (Platform.isIOS) {
|
||||
// sampleFolder = Directory(directory!.path);
|
||||
// } else if (Platform.isLinux) {
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// } else if (Platform.isWindows) {
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// } else if (Platform.isMacOS) {
|
||||
// sampleFolder = Directory('${directory!.path}Documents');
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// if (!sampleFolder.existsSync()) {
|
||||
// sampleFolder.createSync(recursive: true);
|
||||
// }
|
||||
// } catch (e, s) {
|
||||
// // todo: come back to this
|
||||
// debugPrint("$e $s");
|
||||
// }
|
||||
//
|
||||
// final docPath = sampleFolder.path;
|
||||
// final filePath = "$docPath/monkey.svg";
|
||||
//
|
||||
// File imgFile = File(filePath);
|
||||
// await imgFile.writeAsBytes(decodedResponse);
|
||||
// } else {
|
||||
// throw Exception("Failed to get MonKey");
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<Directory?> getDocsDir() async {
|
||||
try {
|
||||
if (Platform.isAndroid) {
|
||||
return Directory("/storage/emulated/0/Documents");
|
||||
}
|
||||
|
||||
return await getApplicationDocumentsDirectory();
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> downloadMonkey(String address, bool isPNG) async {
|
||||
if (address.isEmpty) {
|
||||
//address shouldn't be empty
|
||||
return;
|
||||
}
|
||||
|
||||
String url = "https://monkey.banano.cc/api/v1/monkey/$address";
|
||||
|
||||
if (isPNG) {
|
||||
url += '?format=png&size=512&background=false';
|
||||
}
|
||||
|
||||
final http.Response response = await http.get(Uri.parse(url));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
if (Platform.isAndroid) {
|
||||
await Permission.storage.request();
|
||||
}
|
||||
|
||||
final decodedResponse = response.bodyBytes;
|
||||
final Directory? sampleFolder = await getDocsDir();
|
||||
|
||||
print("PATH: ${sampleFolder?.path}");
|
||||
|
||||
if (sampleFolder == null) {
|
||||
print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
|
||||
return;
|
||||
}
|
||||
|
||||
// try {
|
||||
// if (!sampleFolder.existsSync()) {
|
||||
// sampleFolder.createSync(recursive: true);
|
||||
// }
|
||||
// } catch (e, s) {
|
||||
// // todo: come back to this
|
||||
// debugPrint("$e $s");
|
||||
// }
|
||||
|
||||
final docPath = sampleFolder.path;
|
||||
String filePath = "$docPath/monkey_$address";
|
||||
|
||||
filePath += isPNG ? ".png" : ".svg";
|
||||
|
||||
// todo check if monkey.png exists
|
||||
|
||||
File imgFile = File(filePath);
|
||||
await imgFile.writeAsBytes(decodedResponse);
|
||||
} else {
|
||||
throw Exception("Failed to get MonKey");
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
walletId = widget.walletId;
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
final address = await ref
|
||||
.read(walletsChangeNotifierProvider)
|
||||
.getManager(walletId)
|
||||
.currentReceivingAddress;
|
||||
setState(() {
|
||||
receivingAddress = address;
|
||||
});
|
||||
});
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final manager = ref.watch(walletsChangeNotifierProvider
|
||||
.select((value) => value.getManager(widget.walletId)));
|
||||
final Coin coin = manager.coin;
|
||||
|
||||
final bool isDesktop = Util.isDesktop;
|
||||
|
||||
imageBytes ??= (manager.wallet as BananoWallet).getMonkeyImageBytes();
|
||||
|
||||
//edit for desktop
|
||||
return Background(
|
||||
child: ConditionalParent(
|
||||
condition: isDesktop,
|
||||
builder: (child) => DesktopScaffold(
|
||||
appBar: DesktopAppBar(
|
||||
background: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
leading: Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 32,
|
||||
),
|
||||
AppBarIconButton(
|
||||
size: 32,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFieldDefaultBG,
|
||||
shadows: const [],
|
||||
icon: SvgPicture.asset(
|
||||
Assets.svg.arrowLeft,
|
||||
width: 18,
|
||||
height: 18,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.topNavIconPrimary,
|
||||
),
|
||||
onPressed: () {
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
SvgPicture.asset(Assets.svg.monkey),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Text(
|
||||
"MonKey",
|
||||
style: STextStyles.navBarTitle(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
trailing: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
showDialog<dynamic>(
|
||||
context: context,
|
||||
useSafeArea: false,
|
||||
barrierDismissible: true,
|
||||
builder: (context) {
|
||||
return const StackDialog(
|
||||
title: "About MonKeys",
|
||||
message:
|
||||
"A MonKey is a visual representation of your Banano address.",
|
||||
);
|
||||
});
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
Assets.svg.circleQuestion,
|
||||
color: Colors.blue[800],
|
||||
),
|
||||
const SizedBox(
|
||||
width: 6,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: Text(
|
||||
"What is MonKey?",
|
||||
style: STextStyles.desktopTextSmall(context).copyWith(
|
||||
color: Colors.blue[800],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
useSpacers: false,
|
||||
isCompactHeight: true,
|
||||
),
|
||||
body: child,
|
||||
),
|
||||
child: ConditionalParent(
|
||||
condition: !isDesktop,
|
||||
builder: (child) => Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: AppBarBackButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
"MonKey",
|
||||
style: STextStyles.navBarTitle(context),
|
||||
),
|
||||
actions: [
|
||||
AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: AppBarIconButton(
|
||||
icon: SvgPicture.asset(
|
||||
Assets.svg.circleQuestion,
|
||||
),
|
||||
onPressed: () {
|
||||
showDialog<dynamic>(
|
||||
context: context,
|
||||
useSafeArea: false,
|
||||
barrierDismissible: true,
|
||||
builder: (context) {
|
||||
return const StackOkDialog(
|
||||
title: "About MonKeys",
|
||||
message:
|
||||
"A MonKey is a visual representation of your Banano address.",
|
||||
);
|
||||
});
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: child,
|
||||
),
|
||||
child: ConditionalParent(
|
||||
condition: isDesktop,
|
||||
builder: (child) => SizedBox(
|
||||
width: 318,
|
||||
child: child,
|
||||
),
|
||||
child: ConditionalParent(
|
||||
condition: imageBytes != null,
|
||||
builder: (_) => Column(
|
||||
children: [
|
||||
isDesktop
|
||||
? const SizedBox(
|
||||
height: 50,
|
||||
)
|
||||
: const Spacer(
|
||||
flex: 1,
|
||||
),
|
||||
if (imageBytes != null)
|
||||
SizedBox(
|
||||
width: 300,
|
||||
height: 300,
|
||||
child: SvgPicture.memory(Uint8List.fromList(imageBytes!)),
|
||||
),
|
||||
isDesktop
|
||||
? const SizedBox(
|
||||
height: 50,
|
||||
)
|
||||
: const Spacer(
|
||||
flex: 1,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
SecondaryButton(
|
||||
label: "Save as SVG",
|
||||
onPressed: () async {
|
||||
await showLoading(
|
||||
whileFuture:
|
||||
downloadMonkey(receivingAddress, false),
|
||||
context: context,
|
||||
isDesktop: Util.isDesktop,
|
||||
message: "Saving MonKey svg",
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
SecondaryButton(
|
||||
label: "Download as PNG",
|
||||
onPressed: () async {
|
||||
await showLoading(
|
||||
whileFuture:
|
||||
downloadMonkey(receivingAddress, true),
|
||||
context: context,
|
||||
isDesktop: Util.isDesktop,
|
||||
message: "Downloading MonKey png",
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// child,
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
isDesktop
|
||||
? const SizedBox(
|
||||
height: 100,
|
||||
)
|
||||
: const Spacer(
|
||||
flex: 4,
|
||||
),
|
||||
Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Opacity(
|
||||
opacity: 0.2,
|
||||
child: SvgPicture.file(
|
||||
File(
|
||||
ref.watch(coinIconProvider(coin)),
|
||||
),
|
||||
width: 200,
|
||||
height: 200,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 70,
|
||||
),
|
||||
Text(
|
||||
"You do not have a MonKey yet. \nFetch yours now!",
|
||||
style: STextStyles.smallMed14(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textDark3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
isDesktop
|
||||
? const SizedBox(
|
||||
height: 50,
|
||||
)
|
||||
: const Spacer(
|
||||
flex: 6,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: PrimaryButton(
|
||||
label: "Fetch MonKey",
|
||||
onPressed: () async {
|
||||
final future = Future.wait([
|
||||
getMonkeyImage(receivingAddress),
|
||||
Future<void>.delayed(const Duration(seconds: 2)),
|
||||
]);
|
||||
|
||||
await showLoading(
|
||||
whileFuture: future,
|
||||
context: context,
|
||||
isDesktop: Util.isDesktop,
|
||||
message: "Fetching MonKey",
|
||||
subMessage: "We are fetching your MonKey",
|
||||
);
|
||||
|
||||
imageBytes = (manager.wallet as BananoWallet)
|
||||
.getMonkeyImageBytes();
|
||||
|
||||
if (imageBytes != null) {
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
// if (isDesktop) {
|
||||
// Navigator.of(context).popUntil(
|
||||
// ModalRoute.withName(
|
||||
// DesktopWalletView.routeName),
|
||||
// );
|
||||
// } else {
|
||||
// Navigator.of(context).popUntil(
|
||||
// ModalRoute.withName(WalletView.routeName),
|
||||
// );
|
||||
// }
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
135
lib/pages/monkey/sub_widgets/fetch_monkey_dialog.dart
Normal file
135
lib/pages/monkey/sub_widgets/fetch_monkey_dialog.dart
Normal file
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* This file is part of Stack Wallet.
|
||||
*
|
||||
* Copyright (c) 2023 Cypher Stack
|
||||
* All Rights Reserved.
|
||||
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
||||
* Generated by Cypher Stack on 2023-05-26
|
||||
*
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/animated_widgets/rotating_arrows.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
|
||||
class FetchMonkeyDialog extends StatefulWidget {
|
||||
const FetchMonkeyDialog({
|
||||
Key? key,
|
||||
required this.onCancel,
|
||||
}) : super(key: key);
|
||||
|
||||
final Future<void> Function() onCancel;
|
||||
|
||||
@override
|
||||
State<FetchMonkeyDialog> createState() => _FetchMonkeyDialogState();
|
||||
}
|
||||
|
||||
class _FetchMonkeyDialogState extends State<FetchMonkeyDialog> {
|
||||
late final Future<void> Function() onCancel;
|
||||
@override
|
||||
void initState() {
|
||||
onCancel = widget.onCancel;
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (Util.isDesktop) {
|
||||
return DesktopDialog(
|
||||
child: Column(
|
||||
children: [
|
||||
DesktopDialogCloseButton(
|
||||
onPressedOverride: () async {
|
||||
await onCancel.call();
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
const Spacer(
|
||||
flex: 1,
|
||||
),
|
||||
const RotatingArrows(
|
||||
width: 40,
|
||||
height: 40,
|
||||
),
|
||||
const Spacer(
|
||||
flex: 2,
|
||||
),
|
||||
Text(
|
||||
"Fetching MonKey",
|
||||
style: STextStyles.desktopH2(context),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Text(
|
||||
"We are fetching your MonKey",
|
||||
style: STextStyles.desktopTextMedium(context).copyWith(
|
||||
color: Theme.of(context).extension<StackColors>()!.textDark3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const Spacer(
|
||||
flex: 2,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 32,
|
||||
right: 32,
|
||||
bottom: 32,
|
||||
),
|
||||
child: SecondaryButton(
|
||||
label: "Cancel",
|
||||
width: 272.5,
|
||||
onPressed: () async {
|
||||
await onCancel.call();
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return false;
|
||||
},
|
||||
child: StackDialog(
|
||||
title: "Fetching MonKey",
|
||||
message: "We are fetching your MonKey",
|
||||
icon: const RotatingArrows(
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
rightButton: TextButton(
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getSecondaryEnabledButtonStyle(context),
|
||||
child: Text(
|
||||
"Cancel",
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
),
|
||||
onPressed: () async {
|
||||
await onCancel.call();
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
@ -19,6 +20,7 @@ import 'package:stackwallet/pages/wallet_view/sub_widgets/wallet_refresh_button.
|
|||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/providers/wallet/public_private_balance_state_provider.dart';
|
||||
import 'package:stackwallet/providers/wallet/wallet_balance_toggle_state_provider.dart';
|
||||
import 'package:stackwallet/services/coins/banano/banano_wallet.dart';
|
||||
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
|
||||
import 'package:stackwallet/services/event_bus/events/global/balance_refreshed_event.dart';
|
||||
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
|
||||
|
@ -31,6 +33,7 @@ import 'package:stackwallet/utilities/assets.dart';
|
|||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
|
||||
class WalletSummaryInfo extends ConsumerStatefulWidget {
|
||||
const WalletSummaryInfo({
|
||||
|
@ -49,6 +52,8 @@ class WalletSummaryInfo extends ConsumerStatefulWidget {
|
|||
class _WalletSummaryInfoState extends ConsumerState<WalletSummaryInfo> {
|
||||
late StreamSubscription<BalanceRefreshedEvent> _balanceUpdated;
|
||||
|
||||
String receivingAddress = "";
|
||||
|
||||
void showSheet() {
|
||||
showModalBottomSheet<dynamic>(
|
||||
backgroundColor: Colors.transparent,
|
||||
|
@ -72,6 +77,17 @@ class _WalletSummaryInfoState extends ConsumerState<WalletSummaryInfo> {
|
|||
}
|
||||
},
|
||||
);
|
||||
|
||||
// managerProvider = widget.managerProvider;
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
final address = await ref
|
||||
.read(walletsChangeNotifierProvider)
|
||||
.getManager(widget.walletId)
|
||||
.currentReceivingAddress;
|
||||
setState(() {
|
||||
receivingAddress = address;
|
||||
});
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
@ -85,10 +101,14 @@ class _WalletSummaryInfoState extends ConsumerState<WalletSummaryInfo> {
|
|||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
bool isMonkey = true;
|
||||
|
||||
final manager = ref.watch(walletsChangeNotifierProvider
|
||||
.select((value) => value.getManager(widget.walletId)));
|
||||
|
||||
final externalCalls = ref.watch(
|
||||
prefsChangeNotifierProvider.select((value) => value.externalCalls));
|
||||
final coin = ref.watch(walletsChangeNotifierProvider
|
||||
.select((value) => value.getManager(widget.walletId).coin));
|
||||
final coin = manager.coin;
|
||||
final balance = ref.watch(walletsChangeNotifierProvider
|
||||
.select((value) => value.getManager(widget.walletId).balance));
|
||||
|
||||
|
@ -125,84 +145,104 @@ class _WalletSummaryInfoState extends ConsumerState<WalletSummaryInfo> {
|
|||
title = _showAvailable ? "Available balance" : "Full balance";
|
||||
}
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: showSheet,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: STextStyles.subtitle500(context).copyWith(
|
||||
List<int>? imageBytes;
|
||||
|
||||
if (coin == Coin.banano) {
|
||||
imageBytes = (manager.wallet as BananoWallet).getMonkeyImageBytes();
|
||||
}
|
||||
|
||||
return ConditionalParent(
|
||||
condition: imageBytes != null,
|
||||
builder: (child) => Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
left: 150.0,
|
||||
child: SvgPicture.memory(
|
||||
Uint8List.fromList(imageBytes!),
|
||||
),
|
||||
),
|
||||
child,
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: showSheet,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: STextStyles.subtitle500(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFavoriteCard,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
SvgPicture.asset(
|
||||
Assets.svg.chevronDown,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFavoriteCard,
|
||||
width: 8,
|
||||
height: 4,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
SvgPicture.asset(
|
||||
Assets.svg.chevronDown,
|
||||
],
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: SelectableText(
|
||||
ref.watch(pAmountFormatter(coin)).format(balanceToShow),
|
||||
style: STextStyles.pageTitleH1(context).copyWith(
|
||||
fontSize: 24,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFavoriteCard,
|
||||
width: 8,
|
||||
height: 4,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (externalCalls)
|
||||
Text(
|
||||
"${(priceTuple.item1 * balanceToShow.decimal).toAmount(
|
||||
fractionDigits: 2,
|
||||
).fiatString(
|
||||
locale: locale,
|
||||
)} $baseCurrency",
|
||||
style: STextStyles.subtitle500(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFavoriteCard,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
SvgPicture.file(
|
||||
File(
|
||||
ref.watch(coinIconProvider(coin)),
|
||||
),
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
const Spacer(),
|
||||
FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: SelectableText(
|
||||
ref.watch(pAmountFormatter(coin)).format(balanceToShow),
|
||||
style: STextStyles.pageTitleH1(context).copyWith(
|
||||
fontSize: 24,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFavoriteCard,
|
||||
),
|
||||
),
|
||||
WalletRefreshButton(
|
||||
walletId: widget.walletId,
|
||||
initialSyncStatus: widget.initialSyncStatus,
|
||||
),
|
||||
if (externalCalls)
|
||||
Text(
|
||||
"${(priceTuple.item1 * balanceToShow.decimal).toAmount(
|
||||
fractionDigits: 2,
|
||||
).fiatString(
|
||||
locale: locale,
|
||||
)} $baseCurrency",
|
||||
style: STextStyles.subtitle500(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFavoriteCard,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
SvgPicture.file(
|
||||
File(
|
||||
ref.watch(coinIconProvider(coin)),
|
||||
),
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
const Spacer(),
|
||||
WalletRefreshButton(
|
||||
walletId: widget.walletId,
|
||||
initialSyncStatus: widget.initialSyncStatus,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import 'package:stackwallet/pages/buy_view/buy_in_wallet_view.dart';
|
|||
import 'package:stackwallet/pages/coin_control/coin_control_view.dart';
|
||||
import 'package:stackwallet/pages/exchange_view/wallet_initiated_exchange_view.dart';
|
||||
import 'package:stackwallet/pages/home_view/home_view.dart';
|
||||
import 'package:stackwallet/pages/monkey/monkey_view.dart';
|
||||
import 'package:stackwallet/pages/notification_views/notifications_view.dart';
|
||||
import 'package:stackwallet/pages/ordinals/ordinals_view.dart';
|
||||
import 'package:stackwallet/pages/paynym/paynym_claim_view.dart';
|
||||
|
@ -926,6 +927,22 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
);
|
||||
},
|
||||
),
|
||||
WalletNavigationBarItemData(
|
||||
icon: SvgPicture.asset(
|
||||
Assets.svg.monkey,
|
||||
height: 20,
|
||||
width: 20,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.bottomNavIconIcon,
|
||||
),
|
||||
label: "MonKey",
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
MonkeyView.routeName,
|
||||
arguments: widget.walletId,
|
||||
);
|
||||
}),
|
||||
if (ref.watch(
|
||||
walletsChangeNotifierProvider.select(
|
||||
(value) => value
|
||||
|
|
|
@ -16,6 +16,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||
import 'package:stackwallet/pages/monkey/monkey_view.dart';
|
||||
import 'package:stackwallet/pages/paynym/paynym_claim_view.dart';
|
||||
import 'package:stackwallet/pages/paynym/paynym_home_view.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/coin_control/desktop_coin_control_view.dart';
|
||||
|
@ -82,6 +83,7 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
|
|||
onAnonymizeAllPressed: _onAnonymizeAllPressed,
|
||||
onWhirlpoolPressed: _onWhirlpoolPressed,
|
||||
onOrdinalsPressed: _onOrdinalsPressed,
|
||||
onMonkeyPressed: _onMonkeyPressed,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -315,6 +317,15 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _onMonkeyPressed() async {
|
||||
Navigator.of(context, rootNavigator: true).pop();
|
||||
|
||||
await (Navigator.of(context).pushNamed(
|
||||
MonkeyView.routeName,
|
||||
arguments: widget.walletId,
|
||||
));
|
||||
}
|
||||
|
||||
void _onOrdinalsPressed() {
|
||||
Navigator.of(context, rootNavigator: true).pop();
|
||||
|
||||
|
@ -342,8 +353,8 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
|
|||
manager.coin == Coin.firo ||
|
||||
manager.coin == Coin.firoTestNet ||
|
||||
manager.hasWhirlpoolSupport ||
|
||||
manager.hasOrdinalsSupport;
|
||||
|
||||
manager.coin == Coin.banano ||
|
||||
manager.hasWhirlpoolSupport;
|
||||
return Row(
|
||||
children: [
|
||||
if (Constants.enableExchange)
|
||||
|
|
|
@ -30,6 +30,7 @@ class MoreFeaturesDialog extends ConsumerStatefulWidget {
|
|||
required this.onAnonymizeAllPressed,
|
||||
required this.onWhirlpoolPressed,
|
||||
required this.onOrdinalsPressed,
|
||||
required this.onMonkeyPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
final String walletId;
|
||||
|
@ -38,6 +39,7 @@ class MoreFeaturesDialog extends ConsumerStatefulWidget {
|
|||
final VoidCallback? onAnonymizeAllPressed;
|
||||
final VoidCallback? onWhirlpoolPressed;
|
||||
final VoidCallback? onOrdinalsPressed;
|
||||
final VoidCallback? onMonkeyPressed;
|
||||
|
||||
@override
|
||||
ConsumerState<MoreFeaturesDialog> createState() => _MoreFeaturesDialogState();
|
||||
|
@ -102,7 +104,7 @@ class _MoreFeaturesDialogState extends ConsumerState<MoreFeaturesDialog> {
|
|||
_MoreFeaturesItem(
|
||||
label: "PayNym",
|
||||
detail: "Increased address privacy using BIP47",
|
||||
iconAsset: Assets.svg.ordinal,
|
||||
iconAsset: Assets.svg.robotHead,
|
||||
onPressed: () => widget.onPaynymPressed?.call(),
|
||||
),
|
||||
if (manager.hasOrdinalsSupport)
|
||||
|
@ -112,6 +114,13 @@ class _MoreFeaturesDialogState extends ConsumerState<MoreFeaturesDialog> {
|
|||
iconAsset: Assets.svg.ordinal,
|
||||
onPressed: () => widget.onOrdinalsPressed?.call(),
|
||||
),
|
||||
if (manager.coin == Coin.banano)
|
||||
_MoreFeaturesItem(
|
||||
label: "MonKey",
|
||||
detail: "Generate Banano MonKey",
|
||||
iconAsset: Assets.svg.monkey,
|
||||
onPressed: () => widget.onMonkeyPressed?.call(),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 28,
|
||||
),
|
||||
|
|
|
@ -58,6 +58,7 @@ import 'package:stackwallet/pages/generic/single_field_edit_view.dart';
|
|||
import 'package:stackwallet/pages/home_view/home_view.dart';
|
||||
import 'package:stackwallet/pages/intro_view.dart';
|
||||
import 'package:stackwallet/pages/manage_favorites_view/manage_favorites_view.dart';
|
||||
import 'package:stackwallet/pages/monkey/monkey_view.dart';
|
||||
import 'package:stackwallet/pages/notification_views/notifications_view.dart';
|
||||
import 'package:stackwallet/pages/ordinals/ordinal_details_view.dart';
|
||||
import 'package:stackwallet/pages/ordinals/ordinals_filter_view.dart';
|
||||
|
@ -381,6 +382,35 @@ class RouteGenerator {
|
|||
}
|
||||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||
|
||||
case MonkeyView.routeName:
|
||||
if (args is String) {
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => MonkeyView(
|
||||
walletId: args,
|
||||
),
|
||||
settings: RouteSettings(
|
||||
name: settings.name,
|
||||
),
|
||||
);
|
||||
}
|
||||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||
|
||||
// case MonkeyLoadedView.routeName:
|
||||
// if (args is Tuple2<String, ChangeNotifierProvider<Manager>>) {
|
||||
// return getRoute(
|
||||
// shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
// builder: (_) => MonkeyLoadedView(
|
||||
// walletId: args.item1,
|
||||
// managerProvider: args.item2,
|
||||
// ),
|
||||
// settings: RouteSettings(
|
||||
// name: settings.name,
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||
|
||||
case CoinControlView.routeName:
|
||||
if (args is Tuple2<String, CoinControlViewType>) {
|
||||
return getRoute(
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'dart:convert';
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:nanodart/nanodart.dart';
|
||||
import 'package:stackwallet/db/hive/db.dart';
|
||||
import 'package:stackwallet/db/isar/main_db.dart';
|
||||
import 'package:stackwallet/models/balance.dart';
|
||||
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
||||
|
@ -925,6 +926,21 @@ class BananoWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
await updateCachedChainHeight(height ?? 0);
|
||||
}
|
||||
|
||||
Future<void> updateMonkeyImageBytes(List<int> bytes) async {
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: _walletId,
|
||||
key: "monkeyImageBytesKey",
|
||||
value: bytes,
|
||||
);
|
||||
}
|
||||
|
||||
List<int>? getMonkeyImageBytes() {
|
||||
return DB.instance.get<dynamic>(
|
||||
boxName: _walletId,
|
||||
key: "monkeyImageBytesKey",
|
||||
) as List<int>?;
|
||||
}
|
||||
|
||||
Future<String> getCurrentRepresentative() async {
|
||||
final serverURI = Uri.parse(getCurrentNode().host);
|
||||
final address = await currentReceivingAddress;
|
||||
|
|
|
@ -92,6 +92,7 @@ class _SVG {
|
|||
|
||||
final coinControl = const _COIN_CONTROL();
|
||||
|
||||
String get monkey => "assets/svg/monkey.svg";
|
||||
String get circleSliders => "assets/svg/configuration.svg";
|
||||
String get circlePlus => "assets/svg/plus-circle.svg";
|
||||
String get circlePlusFilled => "assets/svg/circle-plus-filled.svg";
|
||||
|
|
|
@ -337,6 +337,7 @@ flutter:
|
|||
- assets/svg/trocador_rating_d.svg
|
||||
- assets/svg/send.svg
|
||||
- assets/svg/ordinal.svg
|
||||
- assets/svg/monkey.svg
|
||||
|
||||
# coin control icons
|
||||
- assets/svg/coin_control/
|
||||
|
|
Loading…
Reference in a new issue