mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
Cleanup and update backup page [skip ci]
This commit is contained in:
parent
c77eebbb66
commit
ee2074a328
6 changed files with 34 additions and 31 deletions
|
@ -26,12 +26,6 @@ class BackupPage extends BasePage {
|
|||
@override
|
||||
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
|
||||
Widget body(BuildContext context) {
|
||||
return Stack(
|
||||
|
@ -53,7 +47,9 @@ class BackupPage extends BasePage {
|
|||
builder: (_) => GestureDetector(
|
||||
onTap: () {
|
||||
ClipboardUtil.setSensitiveDataToClipboard(
|
||||
ClipboardData(text: backupViewModelBase.backupPassword));
|
||||
ClipboardData(
|
||||
text: backupViewModelBase
|
||||
.backupPassword));
|
||||
showBar<void>(
|
||||
context,
|
||||
S.of(context).transaction_details_copied(
|
||||
|
@ -74,15 +70,25 @@ class BackupPage extends BasePage {
|
|||
))
|
||||
]))),
|
||||
Positioned(
|
||||
child: Observer(
|
||||
builder: (_) => LoadingPrimaryButton(
|
||||
isLoading: backupViewModelBase.state is IsExecutingState,
|
||||
onPressed: () => onExportBackup(context),
|
||||
text: S.of(context).export_backup,
|
||||
color: Theme.of(context).primaryColor,
|
||||
child: Column(children: [
|
||||
PrimaryButton(
|
||||
onPressed: () =>
|
||||
Navigator.of(context).pushNamed(Routes.editBackupPassword),
|
||||
text: S.of(context).change_password,
|
||||
color: Theme.of(context).cardColor,
|
||||
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,
|
||||
left: 24,
|
||||
right: 24,
|
||||
|
@ -130,7 +136,8 @@ class BackupPage extends BasePage {
|
|||
rightButtonText: S.of(context).save_to_downloads,
|
||||
leftButtonText: S.of(context).share,
|
||||
actionRightButton: () async {
|
||||
await backupViewModelBase.saveToDownload(backup.name, backup.content);
|
||||
await backupViewModelBase.saveToDownload(
|
||||
backup.name, backup.content);
|
||||
Navigator.of(dialogContext).pop();
|
||||
},
|
||||
actionLeftButton: () async {
|
||||
|
@ -142,13 +149,15 @@ class BackupPage extends BasePage {
|
|||
|
||||
Future<void> share(BackupExportFile backup, BuildContext context) async {
|
||||
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);
|
||||
}
|
||||
|
||||
Future<void> _saveFile(BackupExportFile backup) async {
|
||||
String? outputFile = await FilePicker.platform
|
||||
.saveFile(dialogTitle: 'Save Your File to desired location', fileName: backup.name);
|
||||
String? outputFile = await FilePicker.platform.saveFile(
|
||||
dialogTitle: 'Save Your File to desired location',
|
||||
fileName: backup.name);
|
||||
|
||||
try {
|
||||
File returnedFile = File(outputFile!);
|
||||
|
|
|
@ -178,7 +178,7 @@ class ExchangePage extends BasePage {
|
|||
children: <Widget>[
|
||||
_exchangeCardsSection(context),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24, left: 24),
|
||||
padding: EdgeInsets.only(top: 12, left: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
|
|
|
@ -196,6 +196,7 @@ class ExchangeCardState<T extends Currency> extends State<ExchangeCard<T>> {
|
|||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 40),
|
||||
Text(
|
||||
key: ValueKey('${_cardInstanceName}_title_key'),
|
||||
_title,
|
||||
|
@ -273,7 +274,7 @@ class ExchangeCardState<T extends Currency> extends State<ExchangeCard<T>> {
|
|||
? FocusTraversalOrder(
|
||||
order: NumericFocusOrder(2),
|
||||
child: Padding(
|
||||
padding: widget.addressRowPadding ?? EdgeInsets.only(top: 20),
|
||||
padding: widget.addressRowPadding ?? EdgeInsets.only(top: 0),
|
||||
child: AddressTextField(
|
||||
addressKey: ValueKey('${_cardInstanceName}_editable_address_textfield_key'),
|
||||
focusNode: widget.addressFocusNode,
|
||||
|
@ -313,7 +314,7 @@ class ExchangeCardState<T extends Currency> extends State<ExchangeCard<T>> {
|
|||
)
|
||||
: Offstage()
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: Builder(
|
||||
builder: (context) => Stack(children: <Widget>[
|
||||
FocusTraversalOrder(
|
||||
|
|
|
@ -23,7 +23,7 @@ class MobileExchangeCardsSection extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(bottom: isBuySellOption ? 8 : 32, top: 12),
|
||||
padding: EdgeInsets.only(bottom: isBuySellOption ? 16 : 16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24),
|
||||
|
@ -54,7 +54,7 @@ class MobileExchangeCardsSection extends StatelessWidget {
|
|||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.fromLTRB(24, 90, 24, isBuySellOption ? 8 : 32),
|
||||
padding: EdgeInsets.fromLTRB(24, 90, 24, isBuySellOption ? 24 : 16),
|
||||
child: Column(
|
||||
children: [
|
||||
if (isBuySellOption) Column(
|
||||
|
|
|
@ -139,7 +139,7 @@ class CurrencyAmountTextField extends StatelessWidget {
|
|||
],
|
||||
);
|
||||
return Padding(
|
||||
padding: padding ?? const EdgeInsets.only(top: 20),
|
||||
padding: padding ?? const EdgeInsets.only(top: 0),
|
||||
child: Row(
|
||||
children: [
|
||||
isSelected
|
||||
|
|
|
@ -60,10 +60,6 @@ abstract class OtherSettingsViewModelBase with Store {
|
|||
bool get changeRepresentativeEnabled =>
|
||||
_wallet.type == WalletType.nano || _wallet.type == WalletType.banano;
|
||||
|
||||
@computed
|
||||
bool get showAddressBookPopup => _settingsStore.showAddressBookPopupEnabled;
|
||||
|
||||
|
||||
@computed
|
||||
bool get displayTransactionPriority => !(changeRepresentativeEnabled ||
|
||||
_wallet.type == WalletType.solana ||
|
||||
|
@ -118,9 +114,6 @@ abstract class OtherSettingsViewModelBase with Store {
|
|||
return customItem != null ? priorities.indexOf(customItem) : null;
|
||||
}
|
||||
|
||||
@action
|
||||
void setShowAddressBookPopup(bool value) => _settingsStore.showAddressBookPopupEnabled = value;
|
||||
|
||||
int? get maxCustomFeeRate {
|
||||
if (_wallet.type == WalletType.bitcoin) {
|
||||
return bitcoin!.getMaxCustomFeeRate(_wallet);
|
||||
|
|
Loading…
Reference in a new issue