Merge pull request #227 from cake-tech/CW-3-update-ui-for-sending-templates

update sending template
This commit is contained in:
mkyq 2022-01-14 14:25:52 +02:00 committed by GitHub
commit ec7fe81d4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 233 additions and 213 deletions

View file

@ -26,7 +26,7 @@ import 'package:cake_wallet/store/yat/yat_store.dart';
import 'package:cake_wallet/src/screens/yat/yat_sending.dart';
class SendPage extends BasePage {
SendPage({@required this.sendViewModel}) :_formKey = GlobalKey<FormState>();
SendPage({@required this.sendViewModel}) : _formKey = GlobalKey<FormState>();
final SendViewModel sendViewModel;
final GlobalKey<FormState> _formKey;
@ -96,16 +96,16 @@ class SendPage extends BasePage {
output: output,
sendViewModel: sendViewModel,
);
}
);
});
},
)
),
)),
Padding(
padding: EdgeInsets.only(top: 10, left: 24, right: 24, bottom: 10),
padding:
EdgeInsets.only(top: 10, left: 24, right: 24, bottom: 10),
child: Container(
height: 10,
child: Observer(builder: (_) {
child: Observer(
builder: (_) {
final count = sendViewModel.outputs.length;
return count > 1
@ -124,29 +124,11 @@ class SendPage extends BasePage {
activeDotColor: Theme.of(context)
.primaryTextTheme
.display3
.backgroundColor
)
.backgroundColor),
)
: Offstage();
})
)
},
),
Padding(
padding: EdgeInsets.only(left: 24, bottom: 24),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
S.of(context).send_templates,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.primaryTextTheme
.display4
.color),
)
],
),
),
Container(
@ -155,7 +137,12 @@ class SendPage extends BasePage {
padding: EdgeInsets.only(left: 24),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
child: Observer(
builder: (_) {
final templates = sendViewModel.templates;
final itemCount = templates.length;
return Row(
children: <Widget>[
GestureDetector(
onTap: () => Navigator.of(context)
@ -167,39 +154,43 @@ class SendPage extends BasePage {
dashPattern: [6, 4],
color: Theme.of(context)
.primaryTextTheme
.display2
.headline2
.decorationColor,
strokeWidth: 2,
radius: Radius.circular(20),
child: Container(
height: 34,
width: 75,
padding:
EdgeInsets.only(left: 10, right: 10),
padding: EdgeInsets.only(left: 10, right: 10),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(20)),
color: Colors.transparent,
),
child: Text(
S.of(context).send_new,
child: templates.length >= 1
? Icon(
Icons.add,
color: Theme.of(context)
.primaryTextTheme
.display3
.color,
)
: Text(
S.of(context).new_template,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.primaryTextTheme
.display3
.color),
),
)),
.color,
),
),
Observer(builder: (_) {
final templates = sendViewModel.templates;
final itemCount = templates.length;
return ListView.builder(
),
),
),
),
ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
@ -214,8 +205,7 @@ class SendPage extends BasePage {
from: template.cryptoCurrency,
onTap: () async {
final output = _defineCurrentOutput();
output.address =
template.address;
output.address = template.address;
output.setCryptoAmount(template.amount);
output.resetParsedAddress();
await output.fetchParsedAddress(context);
@ -225,32 +215,30 @@ class SendPage extends BasePage {
context: context,
builder: (dialogContext) {
return AlertWithTwoActions(
alertTitle:
S.of(context).template,
alertTitle: S.of(context).template,
alertContent: S
.of(context)
.confirm_delete_template,
rightButtonText:
S.of(context).delete,
leftButtonText:
S.of(context).cancel,
rightButtonText: S.of(context).delete,
leftButtonText: S.of(context).cancel,
actionRightButton: () {
Navigator.of(dialogContext)
.pop();
sendViewModel
.sendTemplateViewModel
Navigator.of(dialogContext).pop();
sendViewModel.sendTemplateViewModel
.removeTemplate(
template: template);
},
actionLeftButton: () =>
Navigator.of(dialogContext)
.pop());
});
},
);
});
})
},
);
},
),
],
);
},
),
),
)
@ -280,9 +268,9 @@ class SendPage extends BasePage {
.primaryTextTheme
.display2
.decorationColor,
)
),
Observer(builder: (_) {
)),
Observer(
builder: (_) {
return LoadingPrimaryButton(
onPressed: () async {
if (!_formKey.currentState.validate()) {
@ -305,8 +293,10 @@ class SendPage extends BasePage {
await sendViewModel.createTransaction();
if (!sendViewModel.isBatchSending && sendViewModel.hasYat) {
Navigator.of(context).push<void>(YatSending.createRoute(sendViewModel));
if (!sendViewModel.isBatchSending &&
sendViewModel.hasYat) {
Navigator.of(context)
.push<void>(YatSending.createRoute(sendViewModel));
}
},
text: S.of(context).send,
@ -343,8 +333,8 @@ class SendPage extends BasePage {
});
}
if (state is ExecutedSuccessfullyState
&& !(!sendViewModel.isBatchSending && sendViewModel.hasYat)) {
if (state is ExecutedSuccessfullyState &&
!(!sendViewModel.isBatchSending && sendViewModel.hasYat)) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showPopUp<void>(
context: context,
@ -354,12 +344,16 @@ class SendPage extends BasePage {
amount: S.of(context).send_amount,
amountValue:
sendViewModel.pendingTransaction.amountFormatted,
fiatAmountValue: sendViewModel.pendingTransactionFiatAmount
+ ' ' + sendViewModel.fiat.title,
fiatAmountValue:
sendViewModel.pendingTransactionFiatAmount +
' ' +
sendViewModel.fiat.title,
fee: S.of(context).send_fee,
feeValue: sendViewModel.pendingTransaction.feeFormatted,
feeFiatAmount: sendViewModel.pendingTransactionFeeFiatAmount
+ ' ' + sendViewModel.fiat.title,
feeFiatAmount:
sendViewModel.pendingTransactionFeeFiatAmount +
' ' +
sendViewModel.fiat.title,
outputs: sendViewModel.outputs,
rightButtonText: S.of(context).ok,
leftButtonText: S.of(context).cancel,
@ -380,8 +374,7 @@ class SendPage extends BasePage {
return AlertWithOneAction(
alertTitle: '',
alertContent: S.of(context).send_success(
sendViewModel.currency
.toString()),
sendViewModel.currency.toString()),
buttonText: S.of(context).ok,
buttonAction: () =>
Navigator.of(context).pop());
@ -419,8 +412,7 @@ class SendPage extends BasePage {
alertTitle: S.of(context).error,
alertContent: 'Please, check receiver forms',
buttonText: S.of(context).ok,
buttonAction: () =>
Navigator.of(context).pop());
buttonAction: () => Navigator.of(context).pop());
});
}
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "Ihr Yat ist eine einzige eindeutige Emoji-Adresse, die alle Ihre langen hexadezimalen Adressen für alle Ihre Währungen ersetzt.",
"third_intro_title" : "Yat spielt gut mit anderen",
"third_intro_content" : "Yats leben auch außerhalb von Cake Wallet. Jede Wallet-Adresse auf der Welt kann durch ein Yat ersetzt werden!",
"learn_more" : "Erfahren Sie mehr"
"learn_more" : "Erfahren Sie mehr",
"new_template" : "neue Vorlage"
}

View file

@ -519,5 +519,7 @@
"second_intro_content" : "Your Yat is a single unique emoji address that replaces all of your long hexadecimal addresses for all of your currencies.",
"third_intro_title" : "Yat plays nicely with others",
"third_intro_content" : "Yats live outside of Cake Wallet, too. Any wallet address on earth can be replaced with a Yat!",
"learn_more" : "Learn More"
"learn_more" : "Learn More",
"new_template" : "New Template"
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "Tu Yat es una única dirección emoji única que reemplaza todas tus direcciones hexadecimales largas para todas tus monedas.",
"third_intro_title" : "Yat juega muy bien con otras",
"third_intro_content" : "Los Yats también viven fuera de Cake Wallet. Cualquier dirección de billetera en la tierra se puede reemplazar con un Yat!",
"learn_more" : "Aprende más"
"learn_more" : "Aprende más",
"new_template" : "Nueva plantilla"
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "आपका Yat एक अद्वितीय इमोजी पता है जो आपकी सभी मुद्राओं के लिए आपके सभी लंबे हेक्साडेसिमल पतों को बदल देता है।",
"third_intro_title" : "Yat दूसरों के साथ अच्छा खेलता है",
"third_intro_content" : "Yats Cake Wallet के बाहर भी रहता है। धरती पर किसी भी वॉलेट पते को Yat से बदला जा सकता है!",
"learn_more" : "और अधिक जानें"
"learn_more" : "और अधिक जानें",
"new_template" : "नया टेम्पलेट"
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "Vaš Yat jedinstvena je adresa emojija koja zamjenjuje sve vaše duge heksadecimalne adrese za sve vaše valute.",
"third_intro_title" : "Yat se lijepo igra s drugima",
"third_intro_content" : "Yats žive i izvan Cake Wallet -a. Bilo koja adresa novčanika na svijetu može se zamijeniti Yat!",
"learn_more" : "Saznajte više"
"learn_more" : "Saznajte više",
"new_template" : "novi predložak"
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "Il tuo Yat è un unico indirizzo emoji univoco che sostituisce tutti i tuoi lunghi indirizzi esadecimali per tutte le tue valute.",
"third_intro_title" : "Yat gioca bene con gli altri",
"third_intro_content" : "Anche Yats vive fuori da Cake Wallet. Qualsiasi indirizzo di portafoglio sulla terra può essere sostituito con un Yat!",
"learn_more" : "Impara di più"
"learn_more" : "Impara di più",
"new_template" : "Nuovo modello"
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "Yatは、すべての通貨のすべての長い16進アドレスを置き換える単一の一意の絵文字アドレスです。",
"third_intro_title" : "Yatは他の人とうまく遊ぶ",
"third_intro_content" : "YatsはCakeWalletの外にも住んでいます。 地球上のどのウォレットアドレスもYatに置き換えることができます",
"learn_more" : "もっと詳しく知る"
"learn_more" : "もっと詳しく知る",
"new_template" : "新しいテンプレート"
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "귀하의 Yat는 귀하의 모든 통화에 대해 긴 16진수 주소를 모두 대체하는 고유한 단일 이모지 주소입니다.",
"third_intro_title" : "Yat는 다른 사람들과 잘 놉니다.",
"third_intro_content" : "Yats는 Cake Wallet 밖에서도 살고 있습니다. 지구상의 모든 지갑 주소는 Yat!",
"learn_more" : "더 알아보기"
"learn_more" : "더 알아보기",
"new_template" : "새 템플릿"
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "Je Yat is een enkel uniek emoji-adres dat al je lange hexadecimale adressen vervangt voor al je valuta's.",
"third_intro_title" : "Yat speelt leuk met anderen",
"third_intro_content" : "Yats wonen ook buiten Cake Wallet. Elk portemonnee-adres op aarde kan worden vervangen door een Yat!",
"learn_more" : "Kom meer te weten"
"learn_more" : "Kom meer te weten",
"new_template" : "Nieuwe sjabloon"
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "Twój Yat to jeden unikalny adres emoji, który zastępuje wszystkie Twoje długie adresy szesnastkowe dla wszystkich Twoich walut.",
"third_intro_title" : "Yat ładnie bawi się z innymi",
"third_intro_content" : "Yats mieszkają również poza Cake Wallet. Każdy adres portfela na ziemi można zastąpić Yat!",
"learn_more" : "Ucz się więcej"
"learn_more" : "Ucz się więcej",
"new_template" : "Nowy szablon"
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "Seu Yat é um endereço de emoji único e exclusivo que substitui todos os seus endereços hexadecimais longos para todas as suas moedas.",
"third_intro_title" : "Yat joga bem com os outros",
"third_intro_content" : "Yats também mora fora da Cake Wallet. Qualquer endereço de carteira na Terra pode ser substituído por um Yat!",
"learn_more" : "Saber mais"
"learn_more" : "Saber mais",
"new_template" : "Novo modelo"
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "Ваш Yat - это единственный уникальный адрес эмодзи, который заменяет длинные шестнадцатеричные адреса для всех ваших валют.",
"third_intro_title" : "Yat хорошо взаимодействует с другими",
"third_intro_content" : "Yat находятся за пределами Cake Wallet. Любой адрес кошелька на земле можно заменить на Yat!",
"learn_more" : "Узнать больше"
"learn_more" : "Узнать больше",
"new_template" : "Новый шаблон"
}

View file

@ -518,5 +518,7 @@
"second_intro_content" : "Ваш Yat - це єдина унікальна адреса емодзі, яка замінює довгі шістнадцятиричні адреси для всіх ваших валют.",
"third_intro_title" : "Yat добре взаємодіє з іншими",
"third_intro_content" : "Yat знаходиться за межами Cake Wallet. Будь-яку адресу гаманця на землі можна замінити на Yat!",
"learn_more" : "Дізнатися більше"
"learn_more" : "Дізнатися більше",
"new_template" : "Новий шаблон"
}

View file

@ -516,5 +516,7 @@
"second_intro_content" : "您的 Yat 是一個唯一的表情符號地址,可替換您所有貨幣的所有長十六進制地址。",
"third_intro_title" : "Yat 和別人玩得很好",
"third_intro_content" : "Yats 也住在 Cake Wallet 之外。 地球上任何一個錢包地址都可以用一個Yat來代替",
"learn_more" : "了解更多"
"learn_more" : "了解更多",
"new_template" : "新模板"
}