undo unrelated from main

This commit is contained in:
Matthew Fosse 2024-04-12 14:07:06 -07:00
parent af9ef76260
commit e8d3f8dc0e
3 changed files with 89 additions and 86 deletions

View file

@ -162,7 +162,7 @@ class ReceivePage extends BasePage {
cell = HeaderTile( cell = HeaderTile(
title: S.of(context).addresses, title: S.of(context).addresses,
walletAddressListViewModel: addressListViewModel, walletAddressListViewModel: addressListViewModel,
showTrailingButton: true, showTrailingButton: !addressListViewModel.isAutoGenerateSubaddressEnabled,
showSearchButton: true, showSearchButton: true,
trailingButtonTap: () => trailingButtonTap: () =>
Navigator.of(context).pushNamed(Routes.newSubaddress), Navigator.of(context).pushNamed(Routes.newSubaddress),

View file

@ -22,7 +22,6 @@ class WalletSeedPage extends BasePage {
: seedController = TextEditingController(), : seedController = TextEditingController(),
nameController = TextEditingController(); nameController = TextEditingController();
final imageLight = Image.asset('assets/images/crypto_lock_light.png'); final imageLight = Image.asset('assets/images/crypto_lock_light.png');
final imageDark = Image.asset('assets/images/crypto_lock.png'); final imageDark = Image.asset('assets/images/crypto_lock.png');
@ -32,23 +31,20 @@ class WalletSeedPage extends BasePage {
final bool isNewWalletCreated; final bool isNewWalletCreated;
final WalletSeedViewModel walletSeedViewModel; final WalletSeedViewModel walletSeedViewModel;
@override @override
void onClose(BuildContext context) async { void onClose(BuildContext context) async {
if (isNewWalletCreated) { if (isNewWalletCreated) {
final confirmed = await showPopUp<bool>( final confirmed = await showPopUp<bool>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithTwoActions( return AlertWithTwoActions(
alertTitle: S.of(context).seed_alert_title, alertTitle: S.of(context).seed_alert_title,
alertContent: S.of(context).seed_alert_content, alertContent: S.of(context).seed_alert_content,
leftButtonText: S.of(context).seed_alert_back, leftButtonText: S.of(context).seed_alert_back,
rightButtonText: S.of(context).seed_alert_yes, rightButtonText: S.of(context).seed_alert_yes,
actionLeftButton: () => Navigator.of(context).pop(false), actionLeftButton: () => Navigator.of(context).pop(false),
actionRightButton: () => Navigator.of(context).pop(true)); actionRightButton: () => Navigator.of(context).pop(true));
}) ?? }) ??
false; false;
if (confirmed) { if (confirmed) {
@ -68,24 +64,24 @@ class WalletSeedPage extends BasePage {
Widget trailing(BuildContext context) { Widget trailing(BuildContext context) {
return isNewWalletCreated return isNewWalletCreated
? GestureDetector( ? GestureDetector(
onTap: () => onClose(context), onTap: () => onClose(context),
child: Container( child: Container(
width: 100, width: 100,
height: 32, height: 32,
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.only(left: 10), margin: EdgeInsets.only(left: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(16)), borderRadius: BorderRadius.all(Radius.circular(16)),
color: Theme.of(context).cardColor), color: Theme.of(context).cardColor),
child: Text( child: Text(
S.of(context).seed_language_next, S.of(context).seed_language_next,
style: TextStyle( style: TextStyle(
fontSize: 14, fontWeight: FontWeight.w600, color: Theme.of(context) fontSize: 14,
.extension<CakeTextTheme>()! fontWeight: FontWeight.w600,
.buttonTextColor), color: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor),
), ),
), ),
) )
: Offstage(); : Offstage();
} }
@ -94,7 +90,6 @@ class WalletSeedPage extends BasePage {
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight; final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight;
TextFormField( TextFormField(
@ -106,9 +101,9 @@ class WalletSeedPage extends BasePage {
autofillHints: [AutofillHints.password], autofillHints: [AutofillHints.password],
//initialValue: walletSeedViewModel.seed, //initialValue: walletSeedViewModel.seed,
controller: seedController controller: seedController
//walletSeedViewModel.seed, //walletSeedViewModel.seed,
); );
return WillPopScope( return WillPopScope(
onWillPop: () async => false, onWillPop: () async => false,
@ -116,7 +111,8 @@ class WalletSeedPage extends BasePage {
padding: EdgeInsets.all(24), padding: EdgeInsets.all(24),
alignment: Alignment.center, alignment: Alignment.center,
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint), constraints:
BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
@ -131,7 +127,7 @@ class WalletSeedPage extends BasePage {
TextFormField( TextFormField(
//initialValue: walletSeedViewModel.name, //initialValue: walletSeedViewModel.name,
controller: nameController, controller: nameController,
autofillHints: [AutofillHints.newUsername], autofillHints: [AutofillHints.newUsername],
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -147,7 +143,8 @@ class WalletSeedPage extends BasePage {
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor), color:
Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor),
), ),
) )
], ],
@ -157,64 +154,66 @@ class WalletSeedPage extends BasePage {
children: <Widget>[ children: <Widget>[
isNewWalletCreated isNewWalletCreated
? Padding( ? Padding(
padding: EdgeInsets.only(bottom: 43, left: 43, right: 43), padding: EdgeInsets.only(bottom: 43, left: 43, right: 43),
child: Text( child: Text(
S.of(context).seed_reminder, S.of(context).seed_reminder,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
color: Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor), color: Theme.of(context)
), .extension<TransactionTradeTheme>()!
) .detailsTitlesColor),
),
)
: Offstage(), : Offstage(),
Row( Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(right: 8.0), padding: EdgeInsets.only(right: 8.0),
child: PrimaryButton( child: PrimaryButton(
onPressed: () {
ShareUtil.share(
text: walletSeedViewModel.seed,
context: context,
);
},
text: S.of(context).save,
color: Colors.green,
textColor: Colors.white),
)),
Flexible(
child: Container(
padding: EdgeInsets.only(left: 8.0),
child: Builder(
builder: (context) => PrimaryButton(
onPressed: () { onPressed: () {
ShareUtil.share( ClipboardUtil.setSensitiveDataToClipboard(
text: walletSeedViewModel.seed, ClipboardData(text: walletSeedViewModel.seed));
context: context, showBar<void>(context, S.of(context).copied_to_clipboard);
);
}, },
text: S.of(context).save, text: S.of(context).copy,
color: Colors.green, color:
textColor: Colors.white), Theme.of(context).extension<PinCodeTheme>()!.indicatorsColor,
)), textColor: Colors.white)),
)),
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(left: 8.0), padding: EdgeInsets.only(left: 8.0),
child: Builder( child: Builder(
builder: (context) => PrimaryButton( builder: (context) => PrimaryButton(
onPressed: () { onPressed: () async {
ClipboardUtil.setSensitiveDataToClipboard( nameController.text = walletSeedViewModel.name;
ClipboardData(text: walletSeedViewModel.seed)); seedController.text = walletSeedViewModel.seed;
showBar<void>(context, S.of(context).copied_to_clipboard);
},
text: S.of(context).copy,
color: Theme.of(context).extension<PinCodeTheme>()!.indicatorsColor,
textColor: Colors.white)),
)),
Flexible(
child: Container(
padding: EdgeInsets.only(left: 8.0),
child: Builder(
builder: (context) => PrimaryButton(
onPressed: () async {
nameController.text = walletSeedViewModel.name; TextInput.finishAutofillContext();
seedController.text = walletSeedViewModel.seed; },
text: "Save2",
TextInput.finishAutofillContext(); color: Colors.blue,
}, textColor: Colors.white)),
text: "Save2", ))
color: Colors.blue,
textColor: Colors.white)),
))
], ],
) )
], ],

View file

@ -213,6 +213,10 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
return S.current.addresses; return S.current.addresses;
} }
if (isAutoGenerateSubaddressEnabled) {
return hasAccounts ? S.current.accounts : S.current.account;
}
return hasAccounts ? S.current.accounts_subaddresses : S.current.addresses; return hasAccounts ? S.current.accounts_subaddresses : S.current.addresses;
} }