Build exchange workspace and shared transaction services (#28)
This commit is contained in:
1 parent
52b7135eda
commit
c496da8a55
48 files changed
+4757
-120
No files matched your search
@@ -0,0 +1,84 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:sxchnge_wallet/sxchnge_wallet.dart';
|
||||
|
||||
import 'copy.dart';
|
||||
|
||||
import '../generated/i18n/app_localizations.dart';
|
||||
|
||||
class TransferSummary extends StatelessWidget {
|
||||
const TransferSummary({super.key, required this.quote});
|
||||
final Quote quote;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final p = context.read<WalletProvider>();
|
||||
final l = AppLocalizations.of(context)!;
|
||||
final q = quote;
|
||||
final a = p.account(q.request.source);
|
||||
final b = p.account(q.request.destination) ?? a;
|
||||
if (a == null || b == null) return Text(l.wNotFound);
|
||||
return Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_row(
|
||||
context,
|
||||
q.request.kind == TransferKind.topUp ? l.wYouPay : l.wTotalDebit,
|
||||
money(context, a, q.debit),
|
||||
large: true,
|
||||
),
|
||||
const Divider(height: 32),
|
||||
_row(context, l.wFee, money(context, a, q.fee)),
|
||||
if (q.request.kind == TransferKind.exchange) ...[
|
||||
const SizedBox(height: 16),
|
||||
_row(
|
||||
context,
|
||||
l.wRate,
|
||||
'1 ${a.currency} = ${NumberFormat('0.0000', Localizations.localeOf(context).toLanguageTag()).format(q.rateNumerator / q.rateDenominator)} ${b.currency}',
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 16),
|
||||
_row(
|
||||
context,
|
||||
q.request.kind == TransferKind.payout
|
||||
? l.wRecipientGets
|
||||
: l.wCredit,
|
||||
money(context, b, q.credit),
|
||||
large: true,
|
||||
),
|
||||
if (q.request.kind == TransferKind.payout) ...[
|
||||
const Divider(height: 32),
|
||||
Text(l.wRecipient),
|
||||
SelectableText(q.request.recipient),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _row(
|
||||
BuildContext context,
|
||||
String label,
|
||||
String value, {
|
||||
bool large = false,
|
||||
}) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
value,
|
||||
style: large
|
||||
? Theme.of(context).textTheme.headlineSmall
|
||||
: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user