Cleanup and update backup page [skip ci]

This commit is contained in:
tuxpizza 2024-12-19 22:53:37 -05:00
parent c77eebbb66
commit ee2074a328
6 changed files with 34 additions and 31 deletions

View file

@ -26,12 +26,6 @@ class BackupPage extends BasePage {
@override @override
String get title => S.current.backup; String get title => S.current.backup;
@override
Widget trailing(BuildContext context) => TrailButton(
caption: S.of(context).change_password,
onPressed: () => Navigator.of(context).pushNamed(Routes.editBackupPassword),
textColor: Palette.blueCraiola);
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
return Stack( return Stack(
@ -53,7 +47,9 @@ class BackupPage extends BasePage {
builder: (_) => GestureDetector( builder: (_) => GestureDetector(
onTap: () { onTap: () {
ClipboardUtil.setSensitiveDataToClipboard( ClipboardUtil.setSensitiveDataToClipboard(
ClipboardData(text: backupViewModelBase.backupPassword)); ClipboardData(
text: backupViewModelBase
.backupPassword));
showBar<void>( showBar<void>(
context, context,
S.of(context).transaction_details_copied( S.of(context).transaction_details_copied(
@ -74,15 +70,25 @@ class BackupPage extends BasePage {
)) ))
]))), ]))),
Positioned( Positioned(
child: Observer( child: Column(children: [
builder: (_) => LoadingPrimaryButton( PrimaryButton(
isLoading: backupViewModelBase.state is IsExecutingState, onPressed: () =>
onPressed: () => onExportBackup(context), Navigator.of(context).pushNamed(Routes.editBackupPassword),
text: S.of(context).export_backup, text: S.of(context).change_password,
color: Theme.of(context).primaryColor, color: Theme.of(context).cardColor,
textColor: Colors.white, textColor: Colors.white,
), ),
), SizedBox(height: 10),
Observer(
builder: (_) => LoadingPrimaryButton(
isLoading: backupViewModelBase.state is IsExecutingState,
onPressed: () => onExportBackup(context),
text: S.of(context).export_backup,
color: Theme.of(context).primaryColor,
textColor: Colors.white,
),
),
]),
bottom: 24, bottom: 24,
left: 24, left: 24,
right: 24, right: 24,
@ -130,7 +136,8 @@ class BackupPage extends BasePage {
rightButtonText: S.of(context).save_to_downloads, rightButtonText: S.of(context).save_to_downloads,
leftButtonText: S.of(context).share, leftButtonText: S.of(context).share,
actionRightButton: () async { actionRightButton: () async {
await backupViewModelBase.saveToDownload(backup.name, backup.content); await backupViewModelBase.saveToDownload(
backup.name, backup.content);
Navigator.of(dialogContext).pop(); Navigator.of(dialogContext).pop();
}, },
actionLeftButton: () async { actionLeftButton: () async {
@ -142,13 +149,15 @@ class BackupPage extends BasePage {
Future<void> share(BackupExportFile backup, BuildContext context) async { Future<void> share(BackupExportFile backup, BuildContext context) async {
final path = await backupViewModelBase.saveBackupFileLocally(backup); final path = await backupViewModelBase.saveBackupFileLocally(backup);
await ShareUtil.shareFile(filePath: path, fileName: backup.name, context: context); await ShareUtil.shareFile(
filePath: path, fileName: backup.name, context: context);
await backupViewModelBase.removeBackupFileLocally(backup); await backupViewModelBase.removeBackupFileLocally(backup);
} }
Future<void> _saveFile(BackupExportFile backup) async { Future<void> _saveFile(BackupExportFile backup) async {
String? outputFile = await FilePicker.platform String? outputFile = await FilePicker.platform.saveFile(
.saveFile(dialogTitle: 'Save Your File to desired location', fileName: backup.name); dialogTitle: 'Save Your File to desired location',
fileName: backup.name);
try { try {
File returnedFile = File(outputFile!); File returnedFile = File(outputFile!);

View file

@ -178,7 +178,7 @@ class ExchangePage extends BasePage {
children: <Widget>[ children: <Widget>[
_exchangeCardsSection(context), _exchangeCardsSection(context),
Padding( Padding(
padding: EdgeInsets.only(top: 24, left: 24), padding: EdgeInsets.only(top: 12, left: 24),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [

View file

@ -196,6 +196,7 @@ class ExchangeCardState<T extends Currency> extends State<ExchangeCard<T>> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
SizedBox(height: 40),
Text( Text(
key: ValueKey('${_cardInstanceName}_title_key'), key: ValueKey('${_cardInstanceName}_title_key'),
_title, _title,
@ -273,7 +274,7 @@ class ExchangeCardState<T extends Currency> extends State<ExchangeCard<T>> {
? FocusTraversalOrder( ? FocusTraversalOrder(
order: NumericFocusOrder(2), order: NumericFocusOrder(2),
child: Padding( child: Padding(
padding: widget.addressRowPadding ?? EdgeInsets.only(top: 20), padding: widget.addressRowPadding ?? EdgeInsets.only(top: 0),
child: AddressTextField( child: AddressTextField(
addressKey: ValueKey('${_cardInstanceName}_editable_address_textfield_key'), addressKey: ValueKey('${_cardInstanceName}_editable_address_textfield_key'),
focusNode: widget.addressFocusNode, focusNode: widget.addressFocusNode,
@ -313,7 +314,7 @@ class ExchangeCardState<T extends Currency> extends State<ExchangeCard<T>> {
) )
: Offstage() : Offstage()
: Padding( : Padding(
padding: EdgeInsets.only(top: 10), padding: EdgeInsets.only(top: 0),
child: Builder( child: Builder(
builder: (context) => Stack(children: <Widget>[ builder: (context) => Stack(children: <Widget>[
FocusTraversalOrder( FocusTraversalOrder(

View file

@ -23,7 +23,7 @@ class MobileExchangeCardsSection extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
padding: EdgeInsets.only(bottom: isBuySellOption ? 8 : 32, top: 12), padding: EdgeInsets.only(bottom: isBuySellOption ? 16 : 16),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(24), bottomLeft: Radius.circular(24),
@ -54,7 +54,7 @@ class MobileExchangeCardsSection extends StatelessWidget {
end: Alignment.bottomRight, end: Alignment.bottomRight,
), ),
), ),
padding: EdgeInsets.fromLTRB(24, 90, 24, isBuySellOption ? 8 : 32), padding: EdgeInsets.fromLTRB(24, 90, 24, isBuySellOption ? 24 : 16),
child: Column( child: Column(
children: [ children: [
if (isBuySellOption) Column( if (isBuySellOption) Column(

View file

@ -139,7 +139,7 @@ class CurrencyAmountTextField extends StatelessWidget {
], ],
); );
return Padding( return Padding(
padding: padding ?? const EdgeInsets.only(top: 20), padding: padding ?? const EdgeInsets.only(top: 0),
child: Row( child: Row(
children: [ children: [
isSelected isSelected

View file

@ -60,10 +60,6 @@ abstract class OtherSettingsViewModelBase with Store {
bool get changeRepresentativeEnabled => bool get changeRepresentativeEnabled =>
_wallet.type == WalletType.nano || _wallet.type == WalletType.banano; _wallet.type == WalletType.nano || _wallet.type == WalletType.banano;
@computed
bool get showAddressBookPopup => _settingsStore.showAddressBookPopupEnabled;
@computed @computed
bool get displayTransactionPriority => !(changeRepresentativeEnabled || bool get displayTransactionPriority => !(changeRepresentativeEnabled ||
_wallet.type == WalletType.solana || _wallet.type == WalletType.solana ||
@ -118,9 +114,6 @@ abstract class OtherSettingsViewModelBase with Store {
return customItem != null ? priorities.indexOf(customItem) : null; return customItem != null ? priorities.indexOf(customItem) : null;
} }
@action
void setShowAddressBookPopup(bool value) => _settingsStore.showAddressBookPopupEnabled = value;
int? get maxCustomFeeRate { int? get maxCustomFeeRate {
if (_wallet.type == WalletType.bitcoin) { if (_wallet.type == WalletType.bitcoin) {
return bitcoin!.getMaxCustomFeeRate(_wallet); return bitcoin!.getMaxCustomFeeRate(_wallet);