mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
desktop exchange flow tweaks and show QR code
This commit is contained in:
parent
e099089d04
commit
c935c590c7
7 changed files with 121 additions and 31 deletions
|
@ -1024,6 +1024,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return DesktopDialog(
|
return DesktopDialog(
|
||||||
maxWidth: 720,
|
maxWidth: 720,
|
||||||
|
@ -1052,6 +1053,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return DesktopDialog(
|
return DesktopDialog(
|
||||||
maxWidth: 720,
|
maxWidth: 720,
|
||||||
|
|
|
@ -104,6 +104,7 @@ class DesktopStep1 extends ConsumerWidget {
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierColor: Colors.transparent,
|
barrierColor: Colors.transparent,
|
||||||
|
barrierDismissible: false,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return DesktopDialog(
|
return DesktopDialog(
|
||||||
maxWidth: 720,
|
maxWidth: 720,
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package: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/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart';
|
||||||
|
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_3.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart';
|
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/address_book_address_chooser.dart';
|
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/address_book_address_chooser.dart';
|
||||||
import 'package:stackwallet/providers/exchange/exchange_send_from_wallet_id_provider.dart';
|
import 'package:stackwallet/providers/exchange/exchange_send_from_wallet_id_provider.dart';
|
||||||
|
@ -13,6 +16,8 @@ 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/widgets/custom_buttons/blue_text_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_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:stackwallet/widgets/desktop/secondary_button.dart';
|
||||||
import 'package:stackwallet/widgets/icon_widgets/addressbook_icon.dart';
|
import 'package:stackwallet/widgets/icon_widgets/addressbook_icon.dart';
|
||||||
|
@ -22,10 +27,6 @@ import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
import 'package:stackwallet/widgets/stack_text_field.dart';
|
import 'package:stackwallet/widgets/stack_text_field.dart';
|
||||||
import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
||||||
|
|
||||||
import '../../../../models/contact_address_entry.dart';
|
|
||||||
import '../../../../widgets/desktop/desktop_dialog.dart';
|
|
||||||
import '../../../../widgets/desktop/desktop_dialog_close_button.dart';
|
|
||||||
|
|
||||||
class DesktopStep2 extends ConsumerStatefulWidget {
|
class DesktopStep2 extends ConsumerStatefulWidget {
|
||||||
const DesktopStep2({
|
const DesktopStep2({
|
||||||
Key? key,
|
Key? key,
|
||||||
|
@ -552,8 +553,25 @@ class _DesktopStep2State extends ConsumerState<DesktopStep2> {
|
||||||
child: PrimaryButton(
|
child: PrimaryButton(
|
||||||
label: "Next",
|
label: "Next",
|
||||||
buttonHeight: ButtonHeight.l,
|
buttonHeight: ButtonHeight.l,
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
// todo
|
await showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
barrierColor: Colors.transparent,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) {
|
||||||
|
return DesktopDialog(
|
||||||
|
maxWidth: 720,
|
||||||
|
maxHeight: double.infinity,
|
||||||
|
child: StepScaffold(
|
||||||
|
step: 3,
|
||||||
|
model: model,
|
||||||
|
body: DesktopStep3(
|
||||||
|
model: model,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -4,8 +4,9 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.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/pages/exchange_view/exchange_step_views/step_4_view.dart';
|
|
||||||
import 'package:stackwallet/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart';
|
import 'package:stackwallet/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart';
|
||||||
|
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart';
|
||||||
|
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_4.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_item.dart';
|
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_item.dart';
|
||||||
import 'package:stackwallet/providers/exchange/current_exchange_name_state_provider.dart';
|
import 'package:stackwallet/providers/exchange/current_exchange_name_state_provider.dart';
|
||||||
import 'package:stackwallet/providers/exchange/exchange_provider.dart';
|
import 'package:stackwallet/providers/exchange/exchange_provider.dart';
|
||||||
|
@ -16,10 +17,11 @@ import 'package:stackwallet/utilities/assets.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/widgets/custom_loading_overlay.dart';
|
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/desktop_dialog.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:stackwallet/widgets/desktop/secondary_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/simple_desktop_dialog.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
|
||||||
|
|
||||||
class DesktopStep3 extends ConsumerStatefulWidget {
|
class DesktopStep3 extends ConsumerStatefulWidget {
|
||||||
const DesktopStep3({
|
const DesktopStep3({
|
||||||
|
@ -76,14 +78,15 @@ class _DesktopStep3State extends ConsumerState<DesktopStep3> {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
unawaited(showDialog<void>(
|
unawaited(
|
||||||
context: context,
|
showDialog<void>(
|
||||||
barrierDismissible: true,
|
context: context,
|
||||||
builder: (_) => StackDialog(
|
barrierDismissible: true,
|
||||||
title: "Failed to create trade",
|
builder: (_) => SimpleDesktopDialog(
|
||||||
message: response.exception?.toString(),
|
title: "Failed to create trade",
|
||||||
|
message: response.exception?.toString() ?? ""),
|
||||||
),
|
),
|
||||||
));
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,22 +109,40 @@ class _DesktopStep3State extends ConsumerState<DesktopStep3> {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
unawaited(NotificationApi.showNotification(
|
unawaited(
|
||||||
changeNowId: model.trade!.tradeId,
|
NotificationApi.showNotification(
|
||||||
title: status,
|
changeNowId: model.trade!.tradeId,
|
||||||
body: "Trade ID ${model.trade!.tradeId}",
|
title: status,
|
||||||
walletId: "",
|
body: "Trade ID ${model.trade!.tradeId}",
|
||||||
iconAssetName: Assets.svg.arrowRotate,
|
walletId: "",
|
||||||
date: model.trade!.timestamp,
|
iconAssetName: Assets.svg.arrowRotate,
|
||||||
shouldWatchForUpdates: true,
|
date: model.trade!.timestamp,
|
||||||
coinName: "coinName",
|
shouldWatchForUpdates: true,
|
||||||
));
|
coinName: "coinName",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
unawaited(Navigator.of(context).pushNamed(
|
unawaited(
|
||||||
Step4View.routeName,
|
showDialog<void>(
|
||||||
arguments: model,
|
context: context,
|
||||||
));
|
barrierColor: Colors.transparent,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) {
|
||||||
|
return DesktopDialog(
|
||||||
|
maxWidth: 720,
|
||||||
|
maxHeight: double.infinity,
|
||||||
|
child: StepScaffold(
|
||||||
|
step: 4,
|
||||||
|
model: model,
|
||||||
|
body: DesktopStep4(
|
||||||
|
model: model,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,14 @@ import 'dart:async';
|
||||||
|
|
||||||
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:qr_flutter/qr_flutter.dart';
|
||||||
import 'package:stackwallet/models/exchange/incomplete_exchange.dart';
|
import 'package:stackwallet/models/exchange/incomplete_exchange.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_item.dart';
|
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_item.dart';
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.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/widgets/desktop/desktop_dialog.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:stackwallet/widgets/desktop/secondary_button.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_container.dart';
|
import 'package:stackwallet/widgets/rounded_container.dart';
|
||||||
|
@ -148,7 +150,7 @@ class _DesktopStep4State extends ConsumerState<DesktopStep4> {
|
||||||
DesktopStepItem(
|
DesktopStepItem(
|
||||||
label: "Amount",
|
label: "Amount",
|
||||||
value:
|
value:
|
||||||
"${model.sendAmount.toString()} ${model.sendTicker.toUpperCase()}",
|
"${model.sendAmount.toStringAsFixed(8)} ${model.sendTicker.toUpperCase()}",
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 1,
|
height: 1,
|
||||||
|
@ -208,7 +210,50 @@ class _DesktopStep4State extends ConsumerState<DesktopStep4> {
|
||||||
label: "Show QR code",
|
label: "Show QR code",
|
||||||
buttonHeight: ButtonHeight.l,
|
buttonHeight: ButtonHeight.l,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// todo
|
showDialog<dynamic>(
|
||||||
|
context: context,
|
||||||
|
barrierColor: Colors.transparent,
|
||||||
|
barrierDismissible: true,
|
||||||
|
builder: (_) {
|
||||||
|
return DesktopDialog(
|
||||||
|
maxHeight: 720,
|
||||||
|
maxWidth: 720,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Send ${model.sendAmount.toStringAsFixed(8)} ${model.sendTicker} to this address",
|
||||||
|
style: STextStyles.desktopH3(context),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 48,
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: QrImage(
|
||||||
|
// TODO: grab coin uri scheme from somewhere
|
||||||
|
// data: "${coin.uriScheme}:$receivingAddress",
|
||||||
|
data: model.trade!.payInAddress,
|
||||||
|
size: 290,
|
||||||
|
foregroundColor: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorDark,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 48,
|
||||||
|
),
|
||||||
|
SecondaryButton(
|
||||||
|
label: "Cancel",
|
||||||
|
width: 310,
|
||||||
|
buttonHeight: ButtonHeight.l,
|
||||||
|
onPressed: Navigator.of(context).pop,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -24,6 +24,7 @@ class DesktopStepItem extends StatelessWidget {
|
||||||
child: ConditionalParent(
|
child: ConditionalParent(
|
||||||
condition: vertical,
|
condition: vertical,
|
||||||
builder: (child) => Column(
|
builder: (child) => Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
child,
|
child,
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
|
|
@ -31,6 +31,8 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
|
||||||
|
|
||||||
if (hasHistory) {
|
if (hasHistory) {
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
|
shrinkWrap: true,
|
||||||
|
primary: false,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return TradeCard(
|
return TradeCard(
|
||||||
key: Key("tradeCard_${trades[index].uuid}"),
|
key: Key("tradeCard_${trades[index].uuid}"),
|
||||||
|
|
Loading…
Reference in a new issue