Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/new-ui/pages/swap_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:cake_wallet/exchange/exchange_trade_state.dart';
import 'package:cake_wallet/exchange/provider/chainflip_exchange_provider.dart';
import 'package:cake_wallet/exchange/provider/thorchain_exchange.provider.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/token_image_widget.dart';
import 'package:cake_wallet/new-ui/widgets/keyboard_hide_overlay.dart';
import 'package:cake_wallet/new-ui/widgets/modern_button.dart';
import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
Expand Down Expand Up @@ -936,8 +937,10 @@ class SwapAmountBoxState extends State<SwapAmountBox> {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CakeImageWidget(imageUrl: _selectedCurrency.iconPath ?? "",
width: 28, height: 28),
TokenImageWidget(
imageUrl: _selectedCurrency.iconPath ?? "",
size: 28,
),
SizedBox(width: 10),
Text(
currencyToShow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:cake_wallet/new-ui/pages/bridge/bridge_amount_page.dart';
import 'package:cake_wallet/new-ui/pages/receive_page.dart';
import 'package:cake_wallet/new-ui/pages/send_page.dart';
import 'package:cake_wallet/new-ui/pages/swap_page.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/token_image_widget.dart';
import 'package:cake_wallet/new-ui/widgets/modern_button.dart';
import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
Expand Down Expand Up @@ -77,7 +78,10 @@ class AssetDetailsModal extends StatelessWidget {
child: Stack(
children: [
if (iconPath.isNotEmpty)
CakeImageWidget(imageUrl: iconPath, width: 75, height: 75)
TokenImageWidget(
imageUrl: iconPath,
size: 75,
)
else
Container(
width: 75,
Expand Down
64 changes: 23 additions & 41 deletions lib/new-ui/widgets/coins_page/assets_history/asset_tile.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:math' show min;

import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/asset_details_modal.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/token_image_widget.dart';
import 'package:cake_wallet/src/screens/wallet_connect/utils/string_parsing.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/wallet_base.dart';
Expand Down Expand Up @@ -83,47 +83,29 @@ class AssetTile extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 36,
height: 36,
child: Stack(
children: [
if((iconPath).isNotEmpty)
CakeImageWidget(imageUrl: iconPath)
else
Container(
width: 36,
height: 36,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
borderRadius: BorderRadius.circular(99999)),
child: Center(
child: Text(
balance.asset.name.substring(0, min(2, balance.asset.name.length)),
style: TextStyle(
fontSize: 20, color: Theme.of(context).colorScheme.onPrimary),
)),
iconPath.isNotEmpty
? TokenImageWidget(
imageUrl: iconPath,
size: 36,
)
: Container(
width: 36,
height: 36,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
shape: BoxShape.circle,
),
child: Center(
child: Text(
balance.asset.name
.substring(0, min(2, balance.asset.name.length)),
style: TextStyle(
fontSize: 20,
color: Theme.of(context).colorScheme.onPrimary,
),
),
// if (chainIconPath.isNotEmpty)
// Align(
// alignment: Alignment.bottomRight,
// child: Container(
// decoration: ShapeDecoration(
// shape: RoundedSuperellipseBorder(
// borderRadius: BorderRadius.circular(5),side: BorderSide(color: Colors.black)),
// color: Colors.white),
// child: Padding(
// padding: const EdgeInsets.all(2.0),
// child: CakeImageWidget(
// imageUrl: chainIconPath,
// width: 12,
// height: 12,
// colorFilter:
// ColorFilter.mode(Colors.black, BlendMode.srcIn),
// ),
// )))
],
)),
),
),
SizedBox(width: 12.0),
Expanded(
child: Column(
Expand Down
27 changes: 14 additions & 13 deletions lib/new-ui/widgets/coins_page/assets_history/history_tile.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_tile_base.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/token_image_widget.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/transaction_direction.dart';
Expand Down Expand Up @@ -77,22 +78,20 @@ class HistoryTile extends StatelessWidget {
child: Container(
width: 16,
height: 16,
decoration: BoxDecoration(color: Theme.of(context).colorScheme.onInverseSurface, shape: BoxShape.circle),
child: CakeImageWidget(imageUrl:
_getDirectionIconToken(),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onInverseSurface, shape: BoxShape.circle),
child: CakeImageWidget(
imageUrl: _getDirectionIconToken(),
height: 14,
width: 14,
colorFilter: ColorFilter.mode(
direction == TransactionDirection.outgoing
? Theme
.of(context)
.colorScheme
.inverseSurface.withAlpha(175)
? Theme.of(context).colorScheme.inverseSurface.withAlpha(175)
: Colors.green,
BlendMode.srcIn),
width: 14,
height: 14,
),
),
),
)
)
],
);
}
Expand All @@ -101,8 +100,10 @@ class HistoryTile extends StatelessWidget {
return Stack(children: [
Opacity(
opacity: pending ? 0.5 : 1,
child: CakeImageWidget(imageUrl: asset?.iconPath ??"", width: 34,
height: 34,),
child: CakeImageWidget(
imageUrl: asset?.iconPath ?? "",
width: 34,
),
),
Align(
alignment: Alignment.bottomRight,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:cake_wallet/entities/new_ui_entities/list_item/list_item.dart';
import 'package:cake_wallet/entities/new_ui_entities/list_item/list_item_regular_row.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/token_image_widget.dart';
import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/transaction_details/confirmations_list_item.dart';
Expand Down Expand Up @@ -70,11 +71,12 @@ class _TransactionDetailsModalState extends State<TransactionDetailsModal> {
controller: controller,
child: Column(
children: [
CakeImageWidget(
imageUrl: widget.transactionDetailsViewModel.transactionAsset.iconPath ??
"",
width: 64,
height: 64),
TokenImageWidget(
imageUrl: widget
.transactionDetailsViewModel.transactionAsset.iconPath ??
"",
size: 64,
),
SizedBox(height: 10),
Text(
widget.transactionDetailsViewModel.formattedTitle +
Expand Down
39 changes: 39 additions & 0 deletions lib/new-ui/widgets/coins_page/token_image_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:flutter/material.dart';

class TokenImageWidget extends StatelessWidget {
const TokenImageWidget({
super.key,
required this.imageUrl,
required this.size,
this.errorWidget,
});

final String imageUrl;
final double size;
final Widget? errorWidget;

@override
Widget build(BuildContext context) {
return Container(
width: size,
height: size,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.onSurface,
),
child: Transform.scale(
scale: 1.08,
child: CakeImageWidget(
imageUrl: imageUrl,
width: size,
height: size,
fit: BoxFit.cover,
errorWidget: errorWidget,
),
),
);
}
}
17 changes: 9 additions & 8 deletions lib/new-ui/widgets/receive_page/receive_amount_modal.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:cake_wallet/entities/fiat_currency.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/token_image_widget.dart';
import 'package:cake_wallet/new-ui/widgets/new_primary_button.dart';
import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker.dart';
Expand Down Expand Up @@ -84,14 +85,14 @@ class _ReceiveAmountModalState extends State<ReceiveAmountModal> {
Row(
spacing: 8,
children: [
Image.asset(
widget.walletAddressListViewModel.tokenCurrency
?.iconPath ??
widget.walletAddressListViewModel.currencies.first
.iconPath ??
"",
width: 32,
height: 32),
TokenImageWidget(
imageUrl: widget.walletAddressListViewModel.tokenCurrency
?.iconPath ??
widget.walletAddressListViewModel.currencies.first
.iconPath ??
"",
size: 32,
),
Text((widget.walletAddressListViewModel.tokenCurrency ??
widget.walletAddressListViewModel.currencies.first
as CryptoCurrency)
Expand Down
8 changes: 4 additions & 4 deletions lib/new-ui/widgets/receive_page/receive_info_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:math';

import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/token_image_widget.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/wallet_type.dart';
Expand Down Expand Up @@ -177,10 +178,9 @@ class InfoboxCurrencyRow extends StatelessWidget {
color: Theme.of(context).colorScheme.surfaceContainer,
width: iconBorder),
borderRadius: BorderRadius.circular(9999999)),
child: CakeImageWidget(
imageUrl: entry.value.iconPath,
width: 24,
height: 24,
child: TokenImageWidget(
imageUrl: entry.value.iconPath ?? '',
size: 24,
),
),
))
Expand Down
3 changes: 2 additions & 1 deletion lib/new-ui/widgets/send_page/send_amount_input.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cake_wallet/new-ui/widgets/coins_page/token_image_widget.dart';
import 'package:cake_wallet/new-ui/widgets/send_page/floating_icon_button.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -109,7 +110,7 @@ class _NewSendAmountInputState extends State<NewSendAmountInput> {
spacing: 8,
children: [
if (widget.hasPicker && widget.currencyIconPath.isNotEmpty)
CakeImageWidget(imageUrl: widget.currencyIconPath, width: 24, height: 24),
TokenImageWidget(imageUrl: widget.currencyIconPath, size: 24),
Text(widget.currency),
if (widget.hasPicker)
CakeImageWidget(imageUrl:
Expand Down
44 changes: 18 additions & 26 deletions lib/src/screens/dashboard/home_settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ import 'package:cake_wallet/entities/new_ui_entities/list_item/list_item_regular
import 'package:cake_wallet/entities/new_ui_entities/list_item/list_item_toggle.dart';
import 'package:cake_wallet/entities/sort_balance_types.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/pages/settings_page.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/token_image_widget.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/dashboard/favorite_token_modal.dart';
import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arrow.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:cake_wallet/src/screens/settings/widgets/settings_picker_cell.dart';
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
import 'package:cake_wallet/src/widgets/new_list_row/new_list_section.dart';
import 'package:cake_wallet/src/widgets/picker.dart';
Expand Down Expand Up @@ -186,30 +183,25 @@ class HomeSettingsPage extends BasePage {
'token': token,
});
},
leading: Container(
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(shape: BoxShape.circle),
child: CakeImageWidget(
imageUrl: token.iconPath,
height: 40,
width: 40,
errorWidget: Container(
height: 30.0,
width: 30.0,
child: Center(
child: Text(
token.title.substring(0, min(token.title.length, 2)),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontSize: 11,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.surfaceContainerHighest,
leading: TokenImageWidget(
imageUrl: token.iconPath ?? '',
size: 40,
errorWidget: Container(
height: 30.0,
width: 30.0,
child: Center(
child: Text(
token.title.substring(0, min(token.title.length, 2)),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontSize: 11,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.surfaceContainerHighest,
),
),
),
decoration: BoxDecoration(
Expand Down
11 changes: 4 additions & 7 deletions lib/src/screens/receive/widgets/qr_image.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/token_image_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:qr_flutter/qr_flutter.dart' as qr;

class QrImage extends StatelessWidget {
Expand Down Expand Up @@ -44,10 +42,9 @@ class QrImage extends StatelessWidget {
backgroundColor: backgroundColor,
padding: const EdgeInsets.all(12.0),
),
CakeImageWidget(imageUrl:
imagePath,
width: logoSize * 0.8,
height: logoSize * 0.8,
TokenImageWidget(
imageUrl: imagePath,
size: logoSize * 0.8,
),
],
);
Expand Down
Loading
Loading