17
import 'package:cake_wallet/store/settings_store.dart';
18
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
19
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
20
+import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
21
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
22
import 'package:cake_wallet/utils/feature_flag.dart';
23
+import 'package:cake_wallet/utils/payment_request.dart';
24
import 'package:cake_wallet/utils/show_pop_up.dart';
25
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
26
import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart';
27
import 'package:cw_core/crypto_currency.dart';
26
-import 'package:flutter/cupertino.dart';
28
+import 'package:cw_core/unspent_coin_type.dart';
29
import 'package:flutter/material.dart';
30
import 'package:flutter_mobx/flutter_mobx.dart';
31
import 'package:url_launcher/url_launcher.dart';
839
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
840
),
841
child: Container(
840
- margin: const EdgeInsets.only(top: 0, left: 24, right: 8, bottom: 16),
842
child: Column(
843
crossAxisAlignment: CrossAxisAlignment.start,
844
children: [
844
- Stack(
845
- children: [
846
- if (currency == CryptoCurrency.ltc)
847
- Row(
848
- mainAxisAlignment: MainAxisAlignment.end,
849
- children: [
850
- Container(
851
- padding: EdgeInsets.only(right: 16, top: 16),
852
- child: Column(
853
- children: [
854
- Container(
855
- decoration: BoxDecoration(
856
- color: Colors.white,
857
- shape: BoxShape.circle,
845
+ Container(
846
+ margin: const EdgeInsets.only(top: 0, left: 24, right: 8, bottom: 16),
847
+ child: Stack(
848
+ children: [
849
+ if (currency == CryptoCurrency.ltc)
850
+ Row(
851
+ mainAxisAlignment: MainAxisAlignment.end,
852
+ children: [
853
+ Container(
854
+ padding: EdgeInsets.only(right: 16, top: 16),
855
+ child: Column(
856
+ children: [
857
+ Container(
858
+ decoration: BoxDecoration(
859
+ color: Colors.white,
860
+ shape: BoxShape.circle,
861
+ ),
862
+ child: ImageIcon(
863
+ AssetImage('assets/images/mweb_logo.png'),
864
+ color: Color.fromARGB(255, 11, 70, 129),
865
+ size: 40,
866
+ ),
867
),
859
- child: ImageIcon(
860
- AssetImage('assets/images/mweb_logo.png'),
861
- color: Color.fromARGB(255, 11, 70, 129),
862
- size: 40,
868
+ const SizedBox(height: 10),
869
+ Text(
870
+ 'MWEB',
871
+ style: TextStyle(
872
+ fontSize: 15,
873
+ fontFamily: 'Lato',
874
+ fontWeight: FontWeight.w800,
875
+ color: Theme.of(context)
876
+ .extension<BalancePageTheme>()!
877
+ .assetTitleColor,
878
+ height: 1,
879
+ ),
880
),
864
- ),
865
- const SizedBox(height: 10),
881
+ ],
882
+ ),
883
+ ),
884
+ ],
885
+ ),
886
+ if (hasSecondAvailableBalance)
887
+ Row(
888
+ children: [
889
+ Column(
890
+ crossAxisAlignment: CrossAxisAlignment.start,
891
+ children: [
892
+ SizedBox(height: 24),
893
Text(
867
- 'MWEB',
894
+ '${secondAvailableBalanceLabel}',
895
+ textAlign: TextAlign.center,
896
style: TextStyle(
869
- fontSize: 15,
897
+ fontSize: 12,
898
fontFamily: 'Lato',
871
- fontWeight: FontWeight.w800,
899
+ fontWeight: FontWeight.w400,
900
+ color: Theme.of(context)
901
+ .extension<BalancePageTheme>()!
902
+ .labelTextColor,
903
+ height: 1,
904
+ ),
905
+ ),
906
+ SizedBox(height: 8),
907
+ AutoSizeText(
908
+ secondAvailableBalance,
909
+ style: TextStyle(
910
+ fontSize: 20,
911
+ fontFamily: 'Lato',
912
+ fontWeight: FontWeight.w400,
913
color: Theme.of(context)
914
.extension<BalancePageTheme>()!
915
.assetTitleColor,
916
height: 1,
917
),
918
+ maxLines: 1,
919
+ textAlign: TextAlign.center,
920
),
921
+ SizedBox(height: 4),
922
+ if (!isTestnet)
923
+ Text(
924
+ '${secondAvailableFiatBalance}',
925
+ textAlign: TextAlign.center,
926
+ style: TextStyle(
927
+ fontSize: 12,
928
+ fontFamily: 'Lato',
929
+ fontWeight: FontWeight.w400,
930
+ color: Theme.of(context)
931
+ .extension<BalancePageTheme>()!
932
+ .textColor,
933
+ height: 1,
934
+ ),
935
+ ),
936
],
937
),
880
- ),
881
- ],
882
- ),
883
- if (hasSecondAvailableBalance)
884
- Row(
885
- children: [
886
- Column(
887
- crossAxisAlignment: CrossAxisAlignment.start,
888
- children: [
889
- SizedBox(height: 24),
890
- Text(
891
- '${secondAvailableBalanceLabel}',
892
- textAlign: TextAlign.center,
893
- style: TextStyle(
894
- fontSize: 12,
895
- fontFamily: 'Lato',
896
- fontWeight: FontWeight.w400,
897
- color: Theme.of(context)
898
- .extension<BalancePageTheme>()!
899
- .labelTextColor,
900
- height: 1,
901
- ),
902
- ),
903
- SizedBox(height: 8),
904
- AutoSizeText(
905
- secondAvailableBalance,
906
- style: TextStyle(
907
- fontSize: 20,
908
- fontFamily: 'Lato',
909
- fontWeight: FontWeight.w400,
910
- color: Theme.of(context)
911
- .extension<BalancePageTheme>()!
912
- .assetTitleColor,
913
- height: 1,
914
- ),
915
- maxLines: 1,
916
- textAlign: TextAlign.center,
917
- ),
918
- SizedBox(height: 4),
919
- if (!isTestnet)
938
+ ],
939
+ ),
940
+ ],
941
+ ),
942
+ ),
943
+ Container(
944
+ margin: const EdgeInsets.only(top: 0, left: 24, right: 8, bottom: 16),
945
+ child: Stack(
946
+ children: [
947
+ if (hasSecondAdditionalBalance)
948
+ Row(
949
+ children: [
950
+ Column(
951
+ crossAxisAlignment: CrossAxisAlignment.start,
952
+ children: [
953
+ SizedBox(height: 24),
954
Text(
921
- '${secondAvailableFiatBalance}',
955
+ '${secondAdditionalBalanceLabel}',
956
textAlign: TextAlign.center,
957
style: TextStyle(
958
fontSize: 12,
959
fontFamily: 'Lato',
960
fontWeight: FontWeight.w400,
927
- color:
928
- Theme.of(context).extension<BalancePageTheme>()!.textColor,
961
+ color: Theme.of(context)
962
+ .extension<BalancePageTheme>()!
963
+ .labelTextColor,
964
height: 1,
965
),
966
),
932
- ],
933
- ),
934
- ],
935
- ),
936
- ],
937
- ),
938
- Stack(
939
- children: [
940
- if (hasSecondAdditionalBalance)
941
- Row(
942
- children: [
943
- Column(
944
- crossAxisAlignment: CrossAxisAlignment.start,
945
- children: [
946
- SizedBox(height: 24),
947
- Text(
948
- '${secondAdditionalBalanceLabel}',
949
- textAlign: TextAlign.center,
950
- style: TextStyle(
951
- fontSize: 12,
952
- fontFamily: 'Lato',
953
- fontWeight: FontWeight.w400,
954
- color: Theme.of(context)
955
- .extension<BalancePageTheme>()!
956
- .labelTextColor,
957
- height: 1,
958
- ),
959
- ),
960
- SizedBox(height: 8),
961
- AutoSizeText(
962
- secondAdditionalBalance,
963
- style: TextStyle(
964
- fontSize: 20,
965
- fontFamily: 'Lato',
966
- fontWeight: FontWeight.w400,
967
- color: Theme.of(context)
968
- .extension<BalancePageTheme>()!
969
- .assetTitleColor,
970
- height: 1,
971
- ),
972
- maxLines: 1,
973
- textAlign: TextAlign.center,
974
- ),
975
- SizedBox(height: 4),
976
- if (!isTestnet)
977
- Text(
978
- '${secondAdditionalFiatBalance}',
979
- textAlign: TextAlign.center,
967
+ SizedBox(height: 8),
968
+ AutoSizeText(
969
+ secondAdditionalBalance,
970
style: TextStyle(
981
- fontSize: 12,
971
+ fontSize: 20,
972
fontFamily: 'Lato',
973
fontWeight: FontWeight.w400,
984
- color:
985
- Theme.of(context).extension<BalancePageTheme>()!.textColor,
974
+ color: Theme.of(context)
975
+ .extension<BalancePageTheme>()!
976
+ .assetTitleColor,
977
height: 1,
978
),
979
+ maxLines: 1,
980
+ textAlign: TextAlign.center,
981
+ ),
982
+ SizedBox(height: 4),
983
+ if (!isTestnet)
984
+ Text(
985
+ '${secondAdditionalFiatBalance}',
986
+ textAlign: TextAlign.center,
987
+ style: TextStyle(
988
+ fontSize: 12,
989
+ fontFamily: 'Lato',
990
+ fontWeight: FontWeight.w400,
991
+ color: Theme.of(context)
992
+ .extension<BalancePageTheme>()!
993
+ .textColor,
994
+ height: 1,
995
+ ),
996
+ ),
997
+ ],
998
+ ),
999
+ ],
1000
+ ),
1001
+ ],
1002
+ ),
1003
+ ),
1004
+ IntrinsicHeight(
1005
+ child: Container(
1006
+ padding: EdgeInsets.symmetric(horizontal: 24),
1007
+ child: Row(
1008
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
1009
+ children: [
1010
+ Expanded(
1011
+ child: Semantics(
1012
+ label: S.of(context).litecoin_mweb_pegin,
1013
+ child: OutlinedButton(
1014
+ onPressed: () {
1015
+ final mwebAddress =
1016
+ bitcoin!.getUnusedMwebAddress(dashboardViewModel.wallet);
1017
+ PaymentRequest? paymentRequest = null;
1018
+ if ((mwebAddress?.isNotEmpty ?? false)) {
1019
+ paymentRequest =
1020
+ PaymentRequest.fromUri(Uri.parse("litecoin:${mwebAddress}"));
1021
+ }
1022
+
1023
+ Navigator.pushNamed(
1024
+ context,
1025
+ Routes.send,
1026
+ arguments: {
1027
+ 'paymentRequest': paymentRequest,
1028
+ 'coinTypeToSpendFrom': UnspentCoinType.nonMweb,
1029
+ },
1030
+ );
1031
+ },
1032
+ style: OutlinedButton.styleFrom(
1033
+ backgroundColor: Theme.of(context)
1034
+ .extension<SendPageTheme>()!
1035
+ .textFieldButtonIconColor
1036
+ .withAlpha(50),
1037
+ side: BorderSide(color: Colors.grey.shade400, width: 0),
1038
+ shape: RoundedRectangleBorder(
1039
+ borderRadius: BorderRadius.circular(20),
1040
),
989
- ],
1041
+ ),
1042
+ child: Container(
1043
+ padding: EdgeInsets.symmetric(vertical: 12),
1044
+ child: Row(
1045
+ mainAxisAlignment: MainAxisAlignment.center,
1046
+ children: [
1047
+ Image.asset(
1048
+ height: 30,
1049
+ width: 30,
1050
+ 'assets/images/received.png',
1051
+ color: Theme.of(context)
1052
+ .extension<BalancePageTheme>()!
1053
+ .balanceAmountColor,
1054
+ ),
1055
+ const SizedBox(width: 8),
1056
+ Text(
1057
+ S.of(context).litecoin_mweb_pegin,
1058
+ style: TextStyle(
1059
+ color: Theme.of(context)
1060
+ .extension<BalancePageTheme>()!
1061
+ .assetTitleColor,
1062
+ ),
1063
+ ),
1064
+ ],
1065
+ ),
1066
+ ),
1067
+ ),
1068
),
991
- ],
992
- ),
993
- // TODO: smarter peg in / out buttons
994
- // if (currency == CryptoCurrency.ltc)
995
- // Row(
996
- // mainAxisAlignment: MainAxisAlignment.end,
997
- // children: [
998
- // Container(
999
- // margin: EdgeInsets.only(top: 24, right: 8),
1000
- // child: ElevatedButton(
1001
- // style: ElevatedButton.styleFrom(
1002
- // backgroundColor: Theme.of(context).highlightColor,
1003
- // ),
1004
- // onPressed: () {
1005
- // final mwebAddress =
1006
- // bitcoin!.getUnusedMwebAddress(dashboardViewModel.wallet);
1007
- // if (mwebAddress == null) return;
1008
- // final paymentRequest =
1009
- // PaymentRequest.fromUri(Uri.parse("litecoin:${mwebAddress}"));
1010
- // Navigator.of(context)
1011
- // .pushNamed(Routes.send, arguments: paymentRequest);
1012
- // },
1013
- // child: Container(
1014
- // color: Colors.transparent,
1015
- // margin: EdgeInsets.all(4),
1016
- // child: Column(
1017
- // mainAxisSize: MainAxisSize.max,
1018
- // crossAxisAlignment: CrossAxisAlignment.center,
1019
- // children: <Widget>[
1020
- // Container(
1021
- // alignment: Alignment.center,
1022
- // decoration: BoxDecoration(shape: BoxShape.circle),
1023
- // child: Image.asset(
1024
- // 'assets/images/received.png',
1025
- // color: Theme.of(context)
1026
- // .extension<BalancePageTheme>()!
1027
- // .balanceAmountColor,
1028
- // width: 64,
1029
- // height: 32,
1030
- // ),
1031
- // ),
1032
- // SizedBox(height: 4),
1033
- // Text(
1034
- // S.of(context).litecoin_mweb_pegin,
1035
- // style: TextStyle(
1036
- // fontSize: 10,
1037
- // color: Theme.of(context)
1038
- // .extension<DashboardPageTheme>()!
1039
- // .cardTextColor),
1040
- // )
1041
- // ],
1042
- // ),
1043
- // ),
1044
- // ),
1045
- // ),
1046
- // ],
1047
- // ),
1048
- ],
1069
+ ),
1070
+ SizedBox(width: 32),
1071
+ Expanded(
1072
+ child: Semantics(
1073
+ label: S.of(context).litecoin_mweb_pegout,
1074
+ child: OutlinedButton(
1075
+ onPressed: () {
1076
+ final litecoinAddress =
1077
+ bitcoin!.getAddress(dashboardViewModel.wallet);
1078
+ PaymentRequest? paymentRequest = null;
1079
+ if (litecoinAddress.isNotEmpty) {
1080
+ paymentRequest = PaymentRequest.fromUri(
1081
+ Uri.parse("litecoin:${litecoinAddress}"));
1082
+ }
1083
+
1084
+ Navigator.pushNamed(
1085
+ context,
1086
+ Routes.send,
1087
+ arguments: {
1088
+ 'paymentRequest': paymentRequest,
1089
+ 'coinTypeToSpendFrom': UnspentCoinType.mweb,
1090
+ },
1091
+ );
1092
+ },
1093
+ style: OutlinedButton.styleFrom(
1094
+ backgroundColor: Theme.of(context)
1095
+ .extension<SendPageTheme>()!
1096
+ .textFieldButtonIconColor
1097
+ .withAlpha(50),
1098
+ side: BorderSide(color: Colors.grey.shade400, width: 0),
1099
+ shape: RoundedRectangleBorder(
1100
+ borderRadius: BorderRadius.circular(20),
1101
+ ),
1102
+ ),
1103
+ child: Container(
1104
+ padding: EdgeInsets.symmetric(vertical: 12),
1105
+ child: Row(
1106
+ mainAxisAlignment: MainAxisAlignment.center,
1107
+ children: [
1108
+ Image.asset(
1109
+ height: 30,
1110
+ width: 30,
1111
+ 'assets/images/upload.png',
1112
+ color: Theme.of(context)
1113
+ .extension<BalancePageTheme>()!
1114
+ .balanceAmountColor,
1115
+ ),
1116
+ const SizedBox(width: 8),
1117
+ Text(
1118
+ S.of(context).litecoin_mweb_pegout,
1119
+ style: TextStyle(
1120
+ color: Theme.of(context)
1121
+ .extension<BalancePageTheme>()!
1122
+ .assetTitleColor,
1123
+ ),
1124
+ ),
1125
+ ],
1126
+ ),
1127
+ ),
1128
+ ),
1129
+ ),
1130
+ ),
1131
+ ],
1132
+ ),
1133
+ ),
1134
),
1135
+ SizedBox(height: 16),
1136
],
1137
),
1138
),