mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-25 08:38:45 +00:00
changed monkey files around
This commit is contained in:
parent
c6c2b42923
commit
512960d9b9
3 changed files with 350 additions and 191 deletions
272
lib/pages/monkey/monkey_loaded_view.dart
Normal file
272
lib/pages/monkey/monkey_loaded_view.dart
Normal file
|
@ -0,0 +1,272 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
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/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);
|
||||||
|
print("$imgFile");
|
||||||
|
} 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);
|
||||||
|
print("$imgFile");
|
||||||
|
|
||||||
|
// final directory = await getApplicationDocumentsDirectory();
|
||||||
|
// final docPath = directory.path;
|
||||||
|
// final filePath = "$do/monkey.png";
|
||||||
|
} 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));
|
||||||
|
bool isMonkey = false;
|
||||||
|
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
Image.network(
|
||||||
|
'https://monkey.banano.cc/api/v1/monkey/$receivingAddress?format=png&size=512',
|
||||||
|
),
|
||||||
|
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);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,9 +3,7 @@ import 'dart:io';
|
||||||
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:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:stackwallet/pages/monkey/monkey_loaded_view.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
|
||||||
import 'package:stackwallet/pages/monkey/sub_widgets/fetch_monkey_dialog.dart';
|
import 'package:stackwallet/pages/monkey/sub_widgets/fetch_monkey_dialog.dart';
|
||||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||||
import 'package:stackwallet/services/coins/manager.dart';
|
import 'package:stackwallet/services/coins/manager.dart';
|
||||||
|
@ -17,7 +15,7 @@ import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/widgets/background.dart';
|
import 'package:stackwallet/widgets/background.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/desktop/primary_button.dart';
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
class MonkeyView extends ConsumerStatefulWidget {
|
class MonkeyView extends ConsumerStatefulWidget {
|
||||||
const MonkeyView({
|
const MonkeyView({
|
||||||
|
@ -42,108 +40,6 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
||||||
|
|
||||||
String receivingAddress = "";
|
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);
|
|
||||||
print("$imgFile");
|
|
||||||
} 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);
|
|
||||||
print("$imgFile");
|
|
||||||
|
|
||||||
// final directory = await getApplicationDocumentsDirectory();
|
|
||||||
// final docPath = directory.path;
|
|
||||||
// final filePath = "$do/monkey.png";
|
|
||||||
} else {
|
|
||||||
throw Exception("Failed to get MonKey");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
walletId = widget.walletId;
|
walletId = widget.walletId;
|
||||||
|
@ -170,7 +66,6 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final Coin coin = ref.watch(managerProvider.select((value) => value.coin));
|
final Coin coin = ref.watch(managerProvider.select((value) => value.coin));
|
||||||
bool isMonkey = true;
|
|
||||||
|
|
||||||
return Background(
|
return Background(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
|
@ -231,98 +126,74 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: isMonkey
|
body: Column(
|
||||||
? Column(
|
children: [
|
||||||
|
const Spacer(
|
||||||
|
flex: 4,
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const Spacer(
|
Opacity(
|
||||||
flex: 1,
|
opacity: 0.2,
|
||||||
),
|
child: SvgPicture.file(
|
||||||
Image.network(
|
File(
|
||||||
'https://monkey.banano.cc/api/v1/monkey/$receivingAddress?format=png&size=512',
|
ref.watch(coinIconProvider(coin)),
|
||||||
),
|
),
|
||||||
const Spacer(
|
width: 200,
|
||||||
flex: 1,
|
height: 200,
|
||||||
),
|
|
||||||
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);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
const SizedBox(
|
||||||
)
|
height: 40,
|
||||||
: Column(
|
|
||||||
children: [
|
|
||||||
const Spacer(
|
|
||||||
flex: 4,
|
|
||||||
),
|
),
|
||||||
Center(
|
Text(
|
||||||
child: Column(
|
"You do not have a MonKey yet. \nFetch yours now!",
|
||||||
children: [
|
style: STextStyles.smallMed14(context).copyWith(
|
||||||
Opacity(
|
color: Theme.of(context)
|
||||||
opacity: 0.2,
|
.extension<StackColors>()!
|
||||||
child: SvgPicture.file(
|
.textDark3,
|
||||||
File(
|
|
||||||
ref.watch(coinIconProvider(coin)),
|
|
||||||
),
|
|
||||||
width: 200,
|
|
||||||
height: 200,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 40,
|
|
||||||
),
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Spacer(
|
|
||||||
flex: 6,
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: PrimaryButton(
|
|
||||||
label: "Fetch MonKey",
|
|
||||||
onPressed: () {
|
|
||||||
showDialog<dynamic>(
|
|
||||||
context: context,
|
|
||||||
useSafeArea: false,
|
|
||||||
barrierDismissible: false,
|
|
||||||
builder: (context) {
|
|
||||||
return FetchMonkeyDialog(
|
|
||||||
onCancel: () async {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
const Spacer(
|
||||||
|
flex: 6,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: PrimaryButton(
|
||||||
|
label: "Fetch MonKey",
|
||||||
|
onPressed: () async {
|
||||||
|
showDialog<dynamic>(
|
||||||
|
context: context,
|
||||||
|
useSafeArea: false,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) {
|
||||||
|
return FetchMonkeyDialog(
|
||||||
|
onCancel: () async {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
await Future<void>.delayed(const Duration(seconds: 2));
|
||||||
|
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
MonkeyLoadedView.routeName,
|
||||||
|
arguments: Tuple2(
|
||||||
|
widget.walletId,
|
||||||
|
widget.managerProvider,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -56,6 +56,7 @@ import 'package:stackwallet/pages/generic/single_field_edit_view.dart';
|
||||||
import 'package:stackwallet/pages/home_view/home_view.dart';
|
import 'package:stackwallet/pages/home_view/home_view.dart';
|
||||||
import 'package:stackwallet/pages/intro_view.dart';
|
import 'package:stackwallet/pages/intro_view.dart';
|
||||||
import 'package:stackwallet/pages/manage_favorites_view/manage_favorites_view.dart';
|
import 'package:stackwallet/pages/manage_favorites_view/manage_favorites_view.dart';
|
||||||
|
import 'package:stackwallet/pages/monkey/monkey_loaded_view.dart';
|
||||||
import 'package:stackwallet/pages/monkey/monkey_view.dart';
|
import 'package:stackwallet/pages/monkey/monkey_view.dart';
|
||||||
import 'package:stackwallet/pages/notification_views/notifications_view.dart';
|
import 'package:stackwallet/pages/notification_views/notifications_view.dart';
|
||||||
import 'package:stackwallet/pages/paynym/add_new_paynym_follow_view.dart';
|
import 'package:stackwallet/pages/paynym/add_new_paynym_follow_view.dart';
|
||||||
|
@ -391,6 +392,21 @@ class RouteGenerator {
|
||||||
}
|
}
|
||||||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
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:
|
case CoinControlView.routeName:
|
||||||
if (args is Tuple2<String, CoinControlViewType>) {
|
if (args is Tuple2<String, CoinControlViewType>) {
|
||||||
return getRoute(
|
return getRoute(
|
||||||
|
|
Loading…
Reference in a new issue