pushNamed navigation route, WIP

This commit is contained in:
sneurlax 2023-01-20 20:32:57 -06:00
parent 8ddc825ea5
commit 824b3bb9a7
3 changed files with 8 additions and 6 deletions

View file

@ -4,6 +4,8 @@ import 'package:stackwallet/pages/buy_view/buy_form.dart';
class BuyView extends StatefulWidget {
const BuyView({Key? key}) : super(key: key);
static const String routeName = "/stackBuyView";
@override
State<BuyView> createState() => _BuyViewState();
}

View file

@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/models/buy/response_objects/order.dart';
import 'package:stackwallet/models/buy/response_objects/quote.dart';
import 'package:stackwallet/pages/buy_view/buy_view.dart';
import 'package:stackwallet/pages_desktop_specific/desktop_buy/desktop_buy_view.dart';
import 'package:stackwallet/services/buy/buy_response.dart';
import 'package:stackwallet/services/buy/simplex/simplex_api.dart';
import 'package:stackwallet/utilities/assets.dart';
@ -46,14 +48,12 @@ class BuyWarningPopup extends StatelessWidget {
label: "Continue",
onPressed: () async {
BuyResponse<SimplexOrder> order = await newOrder(quote);
// BuyResponse<bool> response =
// await redirect(order.value as SimplexOrder);
// // TODO save order
// Navigator.of(context, rootNavigator: isDesktop).pop;
BuyResponse<bool> response =
await redirect(order.value as SimplexOrder).then((order) {
// TODO save order
Navigator.of(context, rootNavigator: isDesktop).pop;
Navigator.of(context, rootNavigator: isDesktop).pushNamed(
isDesktop ? DesktopBuyView.routeName : BuyView.routeName,
); // TODO fix this for desktop, test for mobile. popUntil?
return order;
});
},

View file

@ -8,7 +8,7 @@ import 'package:stackwallet/widgets/rounded_white_container.dart';
class DesktopBuyView extends StatefulWidget {
const DesktopBuyView({Key? key}) : super(key: key);
static const String routeName = "/desktopBuy";
static const String routeName = "/desktopBuyView";
@override
State<DesktopBuyView> createState() => _DesktopBuyViewState();