mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
minor fixes
This commit is contained in:
parent
6c3a960381
commit
b437a3f622
4 changed files with 25 additions and 54 deletions
|
@ -3,6 +3,7 @@ import 'package:cake_wallet/entities/contact_base.dart';
|
|||
import 'package:cake_wallet/entities/contact_record.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
|
||||
import 'package:cake_wallet/utils/icon_from_path.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -113,7 +114,7 @@ class ContactListPage extends BasePage {
|
|||
}
|
||||
|
||||
Widget generateRaw(BuildContext context, ContactBase contact) {
|
||||
final currencyIcon = getIcon(contact.type.iconPath);
|
||||
final currencyIcon = buildIconFromPath(contact.type.iconPath);
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
|
@ -154,25 +155,6 @@ class ContactListPage extends BasePage {
|
|||
);
|
||||
}
|
||||
|
||||
Widget getIcon(String? image) {
|
||||
if (image != null && image.contains('svg')) {
|
||||
return SvgPicture.asset(
|
||||
image,
|
||||
height: 24,
|
||||
width: 24,
|
||||
fit: BoxFit.contain,
|
||||
);
|
||||
} else if (image != null && image.isNotEmpty) {
|
||||
return Image.asset(
|
||||
image,
|
||||
height: 24,
|
||||
width: 24,
|
||||
);
|
||||
} else {
|
||||
return const SizedBox(height: 24, width: 24);
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> showAlertDialog(BuildContext context) async {
|
||||
return await showPopUp<bool>(
|
||||
context: context,
|
||||
|
|
|
@ -7,6 +7,7 @@ import 'package:cake_wallet/routes.dart';
|
|||
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/dropdown_item_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
||||
import 'package:cake_wallet/utils/icon_from_path.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
|
||||
|
@ -135,23 +136,6 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
|
|||
}
|
||||
}
|
||||
|
||||
Widget buildIconFromPath(String? iconPath) {
|
||||
if (iconPath != null && iconPath.contains('svg')) {
|
||||
return SvgPicture.asset(
|
||||
iconPath,
|
||||
height: 24,
|
||||
width: 24,
|
||||
fit: BoxFit.contain,
|
||||
);
|
||||
} else {
|
||||
return Image.asset(
|
||||
iconPath ?? '',
|
||||
height: 24,
|
||||
width: 24,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _loadWallet(WalletListItem wallet) async {
|
||||
widget._authService.authenticateAction(context,
|
||||
onAuthSuccess: (isAuthenticatedSuccessfully) async {
|
||||
|
|
|
@ -6,6 +6,7 @@ import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
|||
import 'package:cake_wallet/src/widgets/search_bar_widget.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/utils/icon_from_path.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/wallet_types.g.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
|
@ -128,21 +129,4 @@ class WalletTypeFormState extends State<WalletTypeForm> {
|
|||
|
||||
widget.onTypeSelected(context, selected!);
|
||||
}
|
||||
|
||||
Widget buildIconFromPath(String? iconPath) {
|
||||
if (iconPath != null && iconPath.contains('svg')) {
|
||||
return SvgPicture.asset(
|
||||
iconPath,
|
||||
height: 24,
|
||||
width: 24,
|
||||
fit: BoxFit.contain,
|
||||
);
|
||||
} else {
|
||||
return Image.asset(
|
||||
iconPath ?? '',
|
||||
height: 24,
|
||||
width: 24,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
21
lib/utils/icon_from_path.dart
Normal file
21
lib/utils/icon_from_path.dart
Normal file
|
@ -0,0 +1,21 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
Widget buildIconFromPath(String? iconPath, {double height = 24.0, double width = 24.0}) {
|
||||
if (iconPath != null && iconPath.contains('svg')) {
|
||||
return SvgPicture.asset(
|
||||
iconPath,
|
||||
height: height,
|
||||
width: width,
|
||||
fit: BoxFit.contain,
|
||||
);
|
||||
} else if (iconPath != null && iconPath.isNotEmpty) {
|
||||
return Image.asset(
|
||||
iconPath,
|
||||
height: height,
|
||||
width: width,
|
||||
);
|
||||
} else {
|
||||
return SizedBox(height: height, width: width);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue