diff --git a/assets/svg/exchange_icons/trocador.svg b/assets/svg/exchange_icons/trocador.svg new file mode 100644 index 000000000..b3d9171ff --- /dev/null +++ b/assets/svg/exchange_icons/trocador.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/svg/trocador_rating_a.svg b/assets/svg/trocador_rating_a.svg new file mode 100644 index 000000000..1e75af73b --- /dev/null +++ b/assets/svg/trocador_rating_a.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/svg/trocador_rating_b.svg b/assets/svg/trocador_rating_b.svg new file mode 100644 index 000000000..5d678305a --- /dev/null +++ b/assets/svg/trocador_rating_b.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/svg/trocador_rating_c.svg b/assets/svg/trocador_rating_c.svg new file mode 100644 index 000000000..87ecf6b24 --- /dev/null +++ b/assets/svg/trocador_rating_c.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/svg/trocador_rating_d.svg b/assets/svg/trocador_rating_d.svg new file mode 100644 index 000000000..8973c7e65 --- /dev/null +++ b/assets/svg/trocador_rating_d.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart b/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart index 72aa3a8f1..6fcf69a74 100644 --- a/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart +++ b/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart @@ -20,6 +20,8 @@ import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/widgets/animated_text.dart'; import 'package:stackwallet/widgets/conditional_parent.dart'; +import 'package:stackwallet/widgets/exchange/trocador/trocador_kyc_info_button.dart'; +import 'package:stackwallet/widgets/exchange/trocador/trocador_rating_type_enum.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart'; class ExchangeProviderOptions extends ConsumerStatefulWidget { @@ -652,7 +654,7 @@ class _ExchangeProviderOptionsState width: isDesktop ? 32 : 24, height: isDesktop ? 32 : 24, child: SvgPicture.asset( - Assets.exchange.majesticBankBlue, + Assets.exchange.trocador, width: isDesktop ? 32 : 24, height: isDesktop ? 32 : 24, ), @@ -805,6 +807,9 @@ class _ExchangeProviderOptionsState ], ), ), + const TrocadorKYCInfoButton( + kycType: TrocadorKYCType.a, + ), ], ), ), diff --git a/lib/utilities/assets.dart b/lib/utilities/assets.dart index b6e77f878..645d5d317 100644 --- a/lib/utilities/assets.dart +++ b/lib/utilities/assets.dart @@ -63,6 +63,7 @@ class _EXCHANGE { String get simpleSwap => "${_path}simpleswap-icon.svg"; String get majesticBankBlue => "${_path}mb_blue.svg"; String get majesticBankGreen => "${_path}mb_green.svg"; + String get trocador => "${_path}trocador.svg"; } class _BUY { @@ -285,6 +286,11 @@ class _SVG { String get list => "assets/svg/list-ul.svg"; String get unclaimedPaynym => "assets/svg/unclaimed.png"; + String get trocadorRatingA => "assets/svg/trocador_rating_a.svg"; + String get trocadorRatingB => "assets/svg/trocador_rating_b.svg"; + String get trocadorRatingC => "assets/svg/trocador_rating_c.svg"; + String get trocadorRatingD => "assets/svg/trocador_rating_d.svg"; + // TODO provide proper assets String get bitcoinTestnet => "assets/svg/coin_icons/Bitcoin.svg"; String get bitcoincashTestnet => "assets/svg/coin_icons/Bitcoincash.svg"; diff --git a/lib/widgets/exchange/trocador/trocador_kyc_icon.dart b/lib/widgets/exchange/trocador/trocador_kyc_icon.dart new file mode 100644 index 000000000..18250932b --- /dev/null +++ b/lib/widgets/exchange/trocador/trocador_kyc_icon.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:stackwallet/utilities/assets.dart'; +import 'package:stackwallet/utilities/theme/stack_colors.dart'; +import 'package:stackwallet/widgets/exchange/trocador/trocador_rating_type_enum.dart'; + +class TrocadorKYCIcon extends StatelessWidget { + const TrocadorKYCIcon({ + Key? key, + required this.kycType, + this.width = 18, + this.height = 18, + }) : super(key: key); + + final TrocadorKYCType kycType; + final double width; + final double height; + + String _getAssetName(TrocadorKYCType type) { + switch (type) { + case TrocadorKYCType.a: + return Assets.svg.trocadorRatingA; + case TrocadorKYCType.b: + return Assets.svg.trocadorRatingB; + case TrocadorKYCType.c: + return Assets.svg.trocadorRatingC; + case TrocadorKYCType.d: + return Assets.svg.trocadorRatingD; + } + } + + Color _getColor(TrocadorKYCType type, BuildContext context) { + switch (type) { + case TrocadorKYCType.a: + return Theme.of(context).extension()!.accentColorGreen; + case TrocadorKYCType.b: + return const Color(0xFF7AA500); + case TrocadorKYCType.c: + return Theme.of(context).extension()!.accentColorYellow; + case TrocadorKYCType.d: + return const Color(0xFFF37B58); + } + } + + @override + Widget build(BuildContext context) { + return SvgPicture.asset( + _getAssetName(kycType), + width: width, + height: height, + color: _getColor(kycType, context), + ); + } +} diff --git a/lib/widgets/exchange/trocador/trocador_kyc_info_button.dart b/lib/widgets/exchange/trocador/trocador_kyc_info_button.dart new file mode 100644 index 000000000..785ca9457 --- /dev/null +++ b/lib/widgets/exchange/trocador/trocador_kyc_info_button.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; +import 'package:stackwallet/widgets/exchange/trocador/trocador_kyc_icon.dart'; +import 'package:stackwallet/widgets/exchange/trocador/trocador_rating_type_enum.dart'; +import 'package:stackwallet/widgets/trocador_kyc_rating_info.dart'; + +class TrocadorKYCInfoButton extends StatelessWidget { + const TrocadorKYCInfoButton({ + Key? key, + required this.kycType, + }) : super(key: key); + + final TrocadorKYCType kycType; + + @override + Widget build(BuildContext context) { + return IconButton( + onPressed: () { + showDialog( + context: context, + builder: (context) => const TrocadorKYCRatingInfo(), + ); + }, + icon: TrocadorKYCIcon( + kycType: kycType, + ), + ); + } +} diff --git a/lib/widgets/exchange/trocador/trocador_rating_type_enum.dart b/lib/widgets/exchange/trocador/trocador_rating_type_enum.dart new file mode 100644 index 000000000..e0a11465d --- /dev/null +++ b/lib/widgets/exchange/trocador/trocador_rating_type_enum.dart @@ -0,0 +1,6 @@ +enum TrocadorKYCType { + a, + b, + c, + d; +} diff --git a/lib/widgets/trocador_kyc_rating_info.dart b/lib/widgets/trocador_kyc_rating_info.dart new file mode 100644 index 000000000..bfd786e9c --- /dev/null +++ b/lib/widgets/trocador_kyc_rating_info.dart @@ -0,0 +1,122 @@ +import 'package:flutter/material.dart'; +import 'package:stackwallet/utilities/text_styles.dart'; +import 'package:stackwallet/widgets/conditional_parent.dart'; +import 'package:stackwallet/widgets/desktop/secondary_button.dart'; +import 'package:stackwallet/widgets/exchange/trocador/trocador_kyc_icon.dart'; +import 'package:stackwallet/widgets/exchange/trocador/trocador_rating_type_enum.dart'; +import 'package:stackwallet/widgets/stack_dialog.dart'; + +class TrocadorKYCRatingInfo extends StatelessWidget { + const TrocadorKYCRatingInfo({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final small = MediaQuery.of(context).size.width <= 500; + return ConditionalParent( + condition: !small, + builder: (child) => child, + child: ConditionalParent( + condition: small, + builder: (child) { + return StackDialogBase( + child: child, + ); + }, + child: Column( + children: [ + Text( + "Trocador KYC Rating", + style: STextStyles.pageTitleH2(context), + ), + const SizedBox( + height: 16, + ), + const _Rating( + kycType: TrocadorKYCType.a, + text: "Never asks for user verification.", + ), + const SizedBox( + height: 16, + ), + const _Rating( + kycType: TrocadorKYCType.b, + text: "Rarely asks for verification. Refunds if refused.", + ), + const SizedBox( + height: 16, + ), + const _Rating( + kycType: TrocadorKYCType.c, + text: + "Rarely asks for verification. Refunds if refused, unless a " + "legal order prevents it.", + ), + const SizedBox( + height: 16, + ), + const _Rating( + kycType: TrocadorKYCType.d, + text: + "Rarely asks for verification. In case of refusal may block " + "funds indefinitely without a legal order.", + ), + if (small) + Padding( + padding: const EdgeInsets.only( + top: 16, + ), + child: Row( + children: [ + const Spacer(), + const SizedBox( + width: 16, + ), + Expanded( + child: SecondaryButton( + label: "Close", + onPressed: Navigator.of(context).pop, + ), + ) + ], + ), + ), + ], + ), + ), + ); + } +} + +class _Rating extends StatelessWidget { + const _Rating({ + Key? key, + required this.kycType, + required this.text, + }) : super(key: key); + + final TrocadorKYCType kycType; + final String text; + + @override + Widget build(BuildContext context) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TrocadorKYCIcon( + kycType: kycType, + width: 20, + height: 20, + ), + const SizedBox( + width: 8, + ), + Flexible( + child: Text( + text, + style: STextStyles.subtitle(context), + ), + ), + ], + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index d84d0d15d..9cda8de02 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -327,6 +327,10 @@ flutter: - assets/svg/framed-gear.svg - assets/svg/list-ul.svg - assets/svg/cc.svg + - assets/svg/trocador_rating_a.svg + - assets/svg/trocador_rating_b.svg + - assets/svg/trocador_rating_c.svg + - assets/svg/trocador_rating_d.svg # coin icons