2020-01-04 19:31:52 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
|
|
|
|
|
|
|
|
class TradeRow extends StatelessWidget {
|
2020-07-22 10:04:11 +00:00
|
|
|
TradeRow({
|
|
|
|
this.provider,
|
|
|
|
this.from,
|
|
|
|
this.to,
|
|
|
|
this.createdAtFormattedDate,
|
|
|
|
this.formattedAmount,
|
|
|
|
@required this.onTap});
|
2020-01-04 19:31:52 +00:00
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
final VoidCallback onTap;
|
|
|
|
final ExchangeProviderDescription provider;
|
|
|
|
final CryptoCurrency from;
|
|
|
|
final CryptoCurrency to;
|
|
|
|
final String createdAtFormattedDate;
|
|
|
|
final String formattedAmount;
|
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2020-04-16 18:41:04 +00:00
|
|
|
final amountCrypto = from.toString();
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
2020-07-22 10:04:11 +00:00
|
|
|
height: 52,
|
|
|
|
color: Colors.transparent,
|
|
|
|
padding: EdgeInsets.only(left: 24, right: 24),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
_getPoweredImage(provider),
|
|
|
|
Expanded(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.only(left: 12),
|
|
|
|
child: Container(
|
2020-07-23 12:20:52 +00:00
|
|
|
height: 46,
|
2020-07-22 10:04:11 +00:00
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
children: <Widget>[
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: <Widget>[
|
|
|
|
Text('${from.toString()} → ${to.toString()}',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
color: Colors.white
|
|
|
|
)),
|
|
|
|
formattedAmount != null
|
|
|
|
? Text(formattedAmount + ' ' + amountCrypto,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
color: Colors.white
|
|
|
|
))
|
|
|
|
: Container()
|
|
|
|
]),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(createdAtFormattedDate,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
2020-08-19 17:57:06 +00:00
|
|
|
color: Theme.of(context).textTheme
|
|
|
|
.overline.backgroundColor))
|
2020-07-22 10:04:11 +00:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
]),
|
2020-01-04 19:31:52 +00:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
Image _getPoweredImage(ExchangeProviderDescription provider) {
|
|
|
|
Image image;
|
|
|
|
switch (provider) {
|
|
|
|
case ExchangeProviderDescription.xmrto:
|
2020-07-22 10:04:11 +00:00
|
|
|
image = Image.asset('assets/images/xmrto.png', height: 36, width: 36);
|
2020-01-04 19:31:52 +00:00
|
|
|
break;
|
|
|
|
case ExchangeProviderDescription.changeNow:
|
2020-07-22 10:04:11 +00:00
|
|
|
image = Image.asset('assets/images/changenow.png', height: 36, width: 36);
|
2020-01-04 19:31:52 +00:00
|
|
|
break;
|
2020-02-05 20:54:55 +00:00
|
|
|
case ExchangeProviderDescription.morphToken:
|
2020-07-22 10:04:11 +00:00
|
|
|
image = Image.asset('assets/images/morph.png', height: 36, width: 36);
|
2020-02-05 20:54:55 +00:00
|
|
|
break;
|
2020-01-04 19:31:52 +00:00
|
|
|
default:
|
|
|
|
image = null;
|
|
|
|
}
|
|
|
|
return image;
|
|
|
|
}
|
2020-07-22 10:04:11 +00:00
|
|
|
}
|