dev
dart 151 lines 6.47 KB
Raw
1 import 'package:cake_wallet/exchange/exchange_provider_description.dart';
2 import 'package:cake_wallet/store/dashboard/trades_store.dart';
3 import 'package:cake_wallet/utils/image_utill.dart';
4 import 'package:cake_wallet/utils/show_bar.dart';
5 import 'package:flutter/material.dart';
6 import 'package:flutter/services.dart';
7 import 'package:cake_wallet/routes.dart';
8 import 'package:cake_wallet/generated/i18n.dart';
9 import 'package:cake_wallet/src/widgets/primary_button.dart';
10 import 'package:cake_wallet/src/screens/base_page.dart';
11 import 'package:cake_wallet/exchange/trade.dart';
12
13 class ExchangeConfirmPage extends BasePage {
14 ExchangeConfirmPage({required this.tradesStore}) : trade = tradesStore.trade!;
15
16 final TradesStore tradesStore;
17 final Trade trade;
18
19 @override
20 String get title => S.current.swap;
21
22 @override
23 Widget body(BuildContext context) {
24 return Container(
25 padding: EdgeInsets.fromLTRB(24, 0, 24, 24),
26 child: Column(
27 children: <Widget>[
28 Expanded(
29 child: Column(
30 children: <Widget>[
31 Flexible(
32 child: Center(
33 child: Text(
34 S.of(context).exchange_result_write_down_trade_id,
35 textAlign: TextAlign.center,
36 style: Theme.of(context).textTheme.bodyLarge?.copyWith(
37 fontSize: 18.0,
38 fontWeight: FontWeight.w500,
39 ),
40 ),
41 ),
42 ),
43 Container(
44 height: 178,
45 decoration: BoxDecoration(
46 borderRadius: BorderRadius.all(Radius.circular(30)),
47 border: Border.all(
48 width: 0.0,
49 color: Theme.of(context).colorScheme.outlineVariant,
50 ),
51 color: Theme.of(context).colorScheme.surfaceContainer,
52 ),
53 child: Column(
54 children: <Widget>[
55 Expanded(
56 child: Padding(
57 padding: EdgeInsets.all(24),
58 child: Column(
59 mainAxisAlignment: MainAxisAlignment.spaceBetween,
60 crossAxisAlignment: CrossAxisAlignment.center,
61 children: <Widget>[
62 Text(
63 "${trade.provider.title} ${S.of(context).trade_id}",
64 style: Theme.of(context).textTheme.bodySmall?.copyWith(
65 fontWeight: FontWeight.w500,
66 ),
67 ),
68 Expanded(
69 child: Text(
70 trade.id,
71 overflow: TextOverflow.visible,
72 style: Theme.of(context).textTheme.titleLarge?.copyWith(
73 fontSize: 20,
74 fontWeight: FontWeight.w600,
75 color: Theme.of(context).colorScheme.onSurface,
76 ),
77 ),
78 ),
79 ],
80 ),
81 ),
82 ),
83 Padding(
84 padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
85 child: Builder(
86 builder: (context) => PrimaryButton(
87 key: ValueKey('exchange_confirm_page_copy_to_clipboard_button_key'),
88 onPressed: () {
89 Clipboard.setData(ClipboardData(text: trade.id));
90 showBar<void>(context, S.of(context).copied_to_clipboard);
91 },
92 text: S.of(context).copy_id,
93 color: Theme.of(context).colorScheme.surfaceContainerLow,
94 textColor: Theme.of(context).colorScheme.onSurface,
95 borderRadius: BorderRadius.circular(30.0),
96 ),
97 ),
98 )
99 ],
100 ),
101 ),
102 Expanded(
103 child: Column(
104 children: [
105 if (trade.provider == ExchangeProviderDescription.trocador)
106 Padding(
107 padding: const EdgeInsets.only(top: 8.0),
108 child: Text(
109 S.of(context).selected_trocador_provider + ':${trade.providerName}',
110 textAlign: TextAlign.center,
111 style: Theme.of(context).textTheme.bodySmall?.copyWith(
112 fontWeight: FontWeight.w500,
113 ),
114 ),
115 ),
116 Flexible(
117 child: Center(
118 child: Row(
119 mainAxisAlignment: MainAxisAlignment.center,
120 children: [
121 (trade.provider.image.isNotEmpty)
122 ? ImageUtil.getImageFromPath(
123 imagePath: trade.provider.image, height: 50, width: 50)
124 : const SizedBox(),
125 if (!trade.provider.horizontalLogo)
126 Padding(
127 padding: const EdgeInsets.symmetric(horizontal: 8.0),
128 child: Text(trade.provider.title),
129 ),
130 ],
131 ),
132 ),
133 ),
134 ],
135 ),
136 ),
137 ],
138 ),
139 ),
140 PrimaryButton(
141 key: ValueKey('exchange_confirm_page_saved_id_button_key'),
142 onPressed: () => Navigator.of(context).pushReplacementNamed(Routes.exchangeTrade),
143 text: S.of(context).saved_the_trade_id,
144 color: Theme.of(context).colorScheme.primary,
145 textColor: Theme.of(context).colorScheme.onPrimary,
146 )
147 ],
148 ),
149 );
150 }
151 }