Auto hide balance
This commit is contained in:
parent
4d31b1a260
commit
cdd5ab7e3e
|
@ -166,9 +166,7 @@ class QRAddressState extends State<QRAddressWidget> {
|
||||||
final shortAddress = centerTrim(address);
|
final shortAddress = centerTrim(address);
|
||||||
final showTAddr = active.showTAddr;
|
final showTAddr = active.showTAddr;
|
||||||
final hasTAddr = active.taddress.isNotEmpty;
|
final hasTAddr = active.taddress.isNotEmpty;
|
||||||
final flat = settings.flat;
|
|
||||||
final qrSize = getScreenSize(context) / 2.5;
|
final qrSize = getScreenSize(context) / 2.5;
|
||||||
final hide = settings.autoHide && flat;
|
|
||||||
final coinDef = active.coinDef;
|
final coinDef = active.coinDef;
|
||||||
|
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
|
@ -181,7 +179,7 @@ class QRAddressState extends State<QRAddressWidget> {
|
||||||
onTap: hasTAddr ? _onQRTap : null,
|
onTap: hasTAddr ? _onQRTap : null,
|
||||||
onLongPress: _onUpdateTAddr,
|
onLongPress: _onUpdateTAddr,
|
||||||
child: RotatedBox(
|
child: RotatedBox(
|
||||||
quarterTurns: hide ? 2 : 0,
|
quarterTurns: 0,
|
||||||
child: QrImage(
|
child: QrImage(
|
||||||
data: address,
|
data: address,
|
||||||
size: qrSize,
|
size: qrSize,
|
||||||
|
@ -313,7 +311,17 @@ class BalanceWidget extends StatelessWidget {
|
||||||
final s = S.of(context);
|
final s = S.of(context);
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
final flat = settings.flat;
|
final flat = settings.flat;
|
||||||
final hide = settings.autoHide && flat;
|
final hide = () {
|
||||||
|
switch (settings.autoHide) {
|
||||||
|
case 0:
|
||||||
|
return false;
|
||||||
|
case 1:
|
||||||
|
return flat;
|
||||||
|
case 2:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}();
|
||||||
final showTAddr = active.showTAddr;
|
final showTAddr = active.showTAddr;
|
||||||
final balance = showTAddr ? active.tbalance : active.balances.balance;
|
final balance = showTAddr ? active.tbalance : active.balances.balance;
|
||||||
final balanceColor = !showTAddr
|
final balanceColor = !showTAddr
|
||||||
|
@ -342,7 +350,7 @@ class BalanceWidget extends StatelessWidget {
|
||||||
Text(' $balanceHi', style: balanceStyle),
|
Text(' $balanceHi', style: balanceStyle),
|
||||||
if (!hide) Text('${_getBalanceLo(balance)}'),
|
if (!hide) Text('${_getBalanceLo(balance)}'),
|
||||||
]),
|
]),
|
||||||
if (hide) Text(s.tiltYourDeviceUpToRevealYourBalance),
|
if (hide && settings.autoHide == 1) Text(s.tiltYourDeviceUpToRevealYourBalance),
|
||||||
if (!hide && fx != 0.0)
|
if (!hide && fx != 0.0)
|
||||||
Text("${decimalFormat(balanceFX, 2, symbol: settings.currency)}",
|
Text("${decimalFormat(balanceFX, 2, symbol: settings.currency)}",
|
||||||
style: theme.textTheme.titleLarge),
|
style: theme.textTheme.titleLarge),
|
||||||
|
|
|
@ -110,6 +110,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"advanced": MessageLookupByLibrary.simpleMessage("Advanced"),
|
"advanced": MessageLookupByLibrary.simpleMessage("Advanced"),
|
||||||
"advancedOptions":
|
"advancedOptions":
|
||||||
MessageLookupByLibrary.simpleMessage("Advanced Options"),
|
MessageLookupByLibrary.simpleMessage("Advanced Options"),
|
||||||
|
"always": MessageLookupByLibrary.simpleMessage("Always"),
|
||||||
"amount": MessageLookupByLibrary.simpleMessage("Amount"),
|
"amount": MessageLookupByLibrary.simpleMessage("Amount"),
|
||||||
"amountInSettingscurrency": m0,
|
"amountInSettingscurrency": m0,
|
||||||
"amountMustBeANumber":
|
"amountMustBeANumber":
|
||||||
|
@ -301,6 +302,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"na": MessageLookupByLibrary.simpleMessage("N/A"),
|
"na": MessageLookupByLibrary.simpleMessage("N/A"),
|
||||||
"name": MessageLookupByLibrary.simpleMessage("Name"),
|
"name": MessageLookupByLibrary.simpleMessage("Name"),
|
||||||
"nameIsEmpty": MessageLookupByLibrary.simpleMessage("Name is empty"),
|
"nameIsEmpty": MessageLookupByLibrary.simpleMessage("Name is empty"),
|
||||||
|
"never": MessageLookupByLibrary.simpleMessage("Never"),
|
||||||
"newAccount": MessageLookupByLibrary.simpleMessage("New Account"),
|
"newAccount": MessageLookupByLibrary.simpleMessage("New Account"),
|
||||||
"newLabel": MessageLookupByLibrary.simpleMessage("New"),
|
"newLabel": MessageLookupByLibrary.simpleMessage("New"),
|
||||||
"newPassword": MessageLookupByLibrary.simpleMessage("New Password"),
|
"newPassword": MessageLookupByLibrary.simpleMessage("New Password"),
|
||||||
|
|
|
@ -111,6 +111,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"advanced": MessageLookupByLibrary.simpleMessage("Avanzado"),
|
"advanced": MessageLookupByLibrary.simpleMessage("Avanzado"),
|
||||||
"advancedOptions":
|
"advancedOptions":
|
||||||
MessageLookupByLibrary.simpleMessage("Opciones Avanzadas"),
|
MessageLookupByLibrary.simpleMessage("Opciones Avanzadas"),
|
||||||
|
"always": MessageLookupByLibrary.simpleMessage("Always"),
|
||||||
"amount": MessageLookupByLibrary.simpleMessage("Monto"),
|
"amount": MessageLookupByLibrary.simpleMessage("Monto"),
|
||||||
"amountInSettingscurrency": m0,
|
"amountInSettingscurrency": m0,
|
||||||
"amountMustBeANumber": MessageLookupByLibrary.simpleMessage(
|
"amountMustBeANumber": MessageLookupByLibrary.simpleMessage(
|
||||||
|
@ -306,6 +307,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"na": MessageLookupByLibrary.simpleMessage("N/A"),
|
"na": MessageLookupByLibrary.simpleMessage("N/A"),
|
||||||
"name": MessageLookupByLibrary.simpleMessage("Nombre"),
|
"name": MessageLookupByLibrary.simpleMessage("Nombre"),
|
||||||
"nameIsEmpty": MessageLookupByLibrary.simpleMessage("Nombre vacío"),
|
"nameIsEmpty": MessageLookupByLibrary.simpleMessage("Nombre vacío"),
|
||||||
|
"never": MessageLookupByLibrary.simpleMessage("Never"),
|
||||||
"newAccount": MessageLookupByLibrary.simpleMessage("Nueva cuenta"),
|
"newAccount": MessageLookupByLibrary.simpleMessage("Nueva cuenta"),
|
||||||
"newLabel": MessageLookupByLibrary.simpleMessage("Nueva"),
|
"newLabel": MessageLookupByLibrary.simpleMessage("Nueva"),
|
||||||
"newPassword": MessageLookupByLibrary.simpleMessage("New Password"),
|
"newPassword": MessageLookupByLibrary.simpleMessage("New Password"),
|
||||||
|
|
|
@ -111,6 +111,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"advanced": MessageLookupByLibrary.simpleMessage("Avancé"),
|
"advanced": MessageLookupByLibrary.simpleMessage("Avancé"),
|
||||||
"advancedOptions":
|
"advancedOptions":
|
||||||
MessageLookupByLibrary.simpleMessage("Options avancées"),
|
MessageLookupByLibrary.simpleMessage("Options avancées"),
|
||||||
|
"always": MessageLookupByLibrary.simpleMessage("Toujours"),
|
||||||
"amount": MessageLookupByLibrary.simpleMessage("Montant"),
|
"amount": MessageLookupByLibrary.simpleMessage("Montant"),
|
||||||
"amountInSettingscurrency": m0,
|
"amountInSettingscurrency": m0,
|
||||||
"amountMustBeANumber": MessageLookupByLibrary.simpleMessage(
|
"amountMustBeANumber": MessageLookupByLibrary.simpleMessage(
|
||||||
|
@ -307,6 +308,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"na": MessageLookupByLibrary.simpleMessage("N/D"),
|
"na": MessageLookupByLibrary.simpleMessage("N/D"),
|
||||||
"name": MessageLookupByLibrary.simpleMessage("Nom"),
|
"name": MessageLookupByLibrary.simpleMessage("Nom"),
|
||||||
"nameIsEmpty": MessageLookupByLibrary.simpleMessage("Le nom est vide"),
|
"nameIsEmpty": MessageLookupByLibrary.simpleMessage("Le nom est vide"),
|
||||||
|
"never": MessageLookupByLibrary.simpleMessage("Jamais"),
|
||||||
"newAccount": MessageLookupByLibrary.simpleMessage("Nouveau Compte"),
|
"newAccount": MessageLookupByLibrary.simpleMessage("Nouveau Compte"),
|
||||||
"newLabel": MessageLookupByLibrary.simpleMessage("Nouveau"),
|
"newLabel": MessageLookupByLibrary.simpleMessage("Nouveau"),
|
||||||
"newPassword":
|
"newPassword":
|
||||||
|
|
|
@ -3101,6 +3101,26 @@ class S {
|
||||||
args: [],
|
args: [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `Never`
|
||||||
|
String get never {
|
||||||
|
return Intl.message(
|
||||||
|
'Never',
|
||||||
|
name: 'never',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Always`
|
||||||
|
String get always {
|
||||||
|
return Intl.message(
|
||||||
|
'Always',
|
||||||
|
name: 'always',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
||||||
|
|
|
@ -303,5 +303,7 @@
|
||||||
"newPasswordsDoNotMatch": "New passwords do not match",
|
"newPasswordsDoNotMatch": "New passwords do not match",
|
||||||
"databaseEncrypted": "Database Encrypted",
|
"databaseEncrypted": "Database Encrypted",
|
||||||
"invalidPassword": "Invalid Password",
|
"invalidPassword": "Invalid Password",
|
||||||
"databaseRestored": "Database Restored"
|
"databaseRestored": "Database Restored",
|
||||||
|
"never": "Never",
|
||||||
|
"always": "Always"
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,5 +301,7 @@
|
||||||
"newPasswordsDoNotMatch": "New passwords do not match",
|
"newPasswordsDoNotMatch": "New passwords do not match",
|
||||||
"databaseEncrypted": "Database Encrypted. Please Restart the App.",
|
"databaseEncrypted": "Database Encrypted. Please Restart the App.",
|
||||||
"invalidPassword": "Invalid Password",
|
"invalidPassword": "Invalid Password",
|
||||||
"databaseRestored": "Database Restored"
|
"databaseRestored": "Database Restored",
|
||||||
|
"never": "Never",
|
||||||
|
"always": "Always"
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,5 +302,7 @@
|
||||||
"newPasswordsDoNotMatch": "Les nouveaux Mots de Passe ne correspondent pas",
|
"newPasswordsDoNotMatch": "Les nouveaux Mots de Passe ne correspondent pas",
|
||||||
"databaseEncrypted": "BD encryptée",
|
"databaseEncrypted": "BD encryptée",
|
||||||
"invalidPassword": "Mot de Passe incorrect",
|
"invalidPassword": "Mot de Passe incorrect",
|
||||||
"databaseRestored": "BD Récupèrée"
|
"databaseRestored": "BD Récupèrée",
|
||||||
|
"never": "Jamais",
|
||||||
|
"always": "Toujours"
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,11 +206,17 @@ class SettingsState extends State<SettingsPage>
|
||||||
title: Text(s.retrieveTransactionDetails),
|
title: Text(s.retrieveTransactionDetails),
|
||||||
initialValue: settings.getTx,
|
initialValue: settings.getTx,
|
||||||
onSaved: _onGetTx),
|
onSaved: _onGetTx),
|
||||||
FormBuilderCheckbox(
|
FormBuilderRadioGroup<int>(
|
||||||
name: 'auto_hide',
|
orientation: OptionsOrientation.horizontal,
|
||||||
title: Text(s.autoHideBalance),
|
name: 'auto_hide',
|
||||||
initialValue: settings.autoHide,
|
decoration: InputDecoration(labelText: s.autoHideBalance),
|
||||||
onSaved: _onAutoHide),
|
initialValue: settings.autoHide,
|
||||||
|
onSaved: _onAutoHide,
|
||||||
|
options: [
|
||||||
|
FormBuilderFieldOption(child: Text(s.never), value: 0),
|
||||||
|
FormBuilderFieldOption(child: Text(s.auto), value: 1),
|
||||||
|
FormBuilderFieldOption(child: Text(s.always), value: 2),
|
||||||
|
]),
|
||||||
DropdownButtonFormField<int>(
|
DropdownButtonFormField<int>(
|
||||||
decoration:
|
decoration:
|
||||||
InputDecoration(labelText: s.minPrivacy),
|
InputDecoration(labelText: s.minPrivacy),
|
||||||
|
@ -347,8 +353,6 @@ class SettingsState extends State<SettingsPage>
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_onAutoHide(v) {
|
_onAutoHide(v) {
|
||||||
settings.setAutoHide(v);
|
settings.setAutoHide(v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ abstract class _Settings with Store {
|
||||||
bool useUA = false;
|
bool useUA = false;
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
bool autoHide = true;
|
int autoHide = 1;
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
bool includeReplyTo = false;
|
bool includeReplyTo = false;
|
||||||
|
@ -241,7 +241,8 @@ abstract class _Settings with Store {
|
||||||
chartRange = prefs.getString('chart_range') ?? "1Y";
|
chartRange = prefs.getString('chart_range') ?? "1Y";
|
||||||
autoShieldThreshold = prefs.getDouble('autoshield_threshold') ?? 0.0;
|
autoShieldThreshold = prefs.getDouble('autoshield_threshold') ?? 0.0;
|
||||||
useUA = prefs.getBool('use_ua') ?? false;
|
useUA = prefs.getBool('use_ua') ?? false;
|
||||||
autoHide = prefs.getBool('auto_hide') ?? true;
|
final autoHideOld = prefs.getBool('auto_hide') ?? true;
|
||||||
|
autoHide = prefs.getInt('auto_hide2') ?? (autoHideOld ? 1 : 0);
|
||||||
protectSend = prefs.getBool('protect_send') ?? false;
|
protectSend = prefs.getBool('protect_send') ?? false;
|
||||||
protectOpen = prefs.getBool('protect_open') ?? false;
|
protectOpen = prefs.getBool('protect_open') ?? false;
|
||||||
includeReplyTo = prefs.getBool('include_reply_to') ?? false;
|
includeReplyTo = prefs.getBool('include_reply_to') ?? false;
|
||||||
|
@ -508,10 +509,10 @@ abstract class _Settings with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
Future<void> setAutoHide(bool v) async {
|
Future<void> setAutoHide(int v) async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
autoHide = v;
|
autoHide = v;
|
||||||
prefs.setBool('auto_hide', autoHide);
|
prefs.setInt('auto_hide2', autoHide);
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
|
|
@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 1.3.6+399
|
version: 1.3.6+400
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.12.0 <3.0.0"
|
sdk: ">=2.12.0 <3.0.0"
|
||||||
|
|
Loading…
Reference in New Issue