Updated for flutter 1.20.x

This commit is contained in:
M
2020-08-31 11:44:58 +03:00
parent 24d139e540
commit fec2ec2845
9 changed files with 155 additions and 128 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ class ElectrumClient {
print(e);
}
},
onError: (_) => _setIsConnected(false),
onError: (Error _) => _setIsConnected(false),
onDone: () => _setIsConnected(false));
keepAlive();
}
+1 -1
View File
@@ -80,7 +80,7 @@ Future<void> bootstrap(
_reconnectionTimer?.cancel();
_onWalletSyncStatusChangeReaction = reaction(
(_) => wallet.syncStatus is ConnectedSyncStatus,
(_) async => await wallet.startSync());
(Object _) async => await wallet.startSync());
_reconnectionTimer = Timer.periodic(Duration(seconds: 5), (_) async {
if (wallet.syncStatus is LostConnectionSyncStatus ||
+36 -35
View File
@@ -1,45 +1,46 @@
import 'package:mobx/mobx.dart';
Dispose connectDifferent<T, Y>(ObservableList<T> source, ObservableList<Y> dest,
Y Function(T) transform, {bool Function(T) filter}) {
return source.observe((change) {
switch (change.type) {
case OperationType.add:
final _values = change.added;
Iterable<T> values;
void connectDifferent<T, Y>(
ObservableList<T> source, ObservableList<Y> dest, Y Function(T) transform,
{bool Function(T) filter}) {
source.observe((ListChange<T> change) {
// switch (change.type) {
// case OperationType.add:
// final _values = change.added;
// Iterable<T> values;
if (filter != null) {
values = _values.where(filter);
}
// if (filter != null) {
// values = _values.where(filter);
// }
dest.addAll(values.map((e) => transform(e)));
break;
case OperationType.remove:
print(change.index);
print(change.removed);
change.removed.forEach((element) { dest.remove(element); });
// dest.addAll(values.map((e) => transform(e)));
// break;
// case OperationType.remove:
// change.removed.forEach((element) {
// dest.remove(element);
// });
// dest.removeAt(change.index);
break;
case OperationType.update:
// change.index
break;
}
// // dest.removeAt(change.index);
// break;
// case OperationType.update:
// // change.index
// break;
// }
});
}
Dispose connect<T>(ObservableList<T> source, ObservableList<T> dest) {
return source.observe((change) {
switch (change.type) {
case OperationType.add:
dest.addAll(change.added);
break;
case OperationType.remove:
dest.removeAt(change.index);
break;
case OperationType.update:
// change.index
break;
}
void connect<T>(ObservableList<T> source, ObservableList<T> dest) {
source.observe((ListChange<T> change) {
// switch (change.type) {
// case OperationType.add:
// dest.addAll(change.added);
// break;
// case OperationType.remove:
// dest.removeAt(change.index);
// break;
// case OperationType.update:
// // change.index
// break;
// }
});
}
@@ -44,7 +44,7 @@ abstract class SettingsViewModelBase with Store {
SwitcherListItem(
title: S.current.settings_save_recipient_address,
value: () => shouldSaveRecipientAddress,
onValueChange: (bool value) => shouldSaveRecipientAddress = value)
onValueChange: (bool value) => setShouldSaveRecipientAddress(value))
],
[
RegularListItem(
@@ -70,7 +70,7 @@ abstract class SettingsViewModelBase with Store {
title: S.current.settings_allow_biometrical_authentication,
value: () => allowBiometricalAuthentication,
onValueChange: (bool value) =>
allowBiometricalAuthentication = value),
setAllowBiometricalAuthentication(value)),
SwitcherListItem(
title: S.current.settings_dark_mode,
value: () => _settingsStore.isDarkTheme,
@@ -139,23 +139,23 @@ abstract class SettingsViewModelBase with Store {
bool get shouldSaveRecipientAddress =>
_settingsStore.shouldSaveRecipientAddress;
@action
set shouldSaveRecipientAddress(bool value) =>
_settingsStore.shouldSaveRecipientAddress = value;
@computed
bool get allowBiometricalAuthentication =>
_settingsStore.allowBiometricalAuthentication;
@action
set allowBiometricalAuthentication(bool value) =>
_settingsStore.allowBiometricalAuthentication = value;
final Map<String, String> itemHeaders;
final SettingsStore _settingsStore;
final WalletType _walletType;
List<List<SettingsListItem>> sections;
@action
void setShouldSaveRecipientAddress(bool value) =>
_settingsStore.shouldSaveRecipientAddress = value;
@action
void setAllowBiometricalAuthentication(bool value) =>
_settingsStore.allowBiometricalAuthentication = value;
@action
void toggleTransactionsDisplay() =>
actionlistDisplayMode.contains(ActionListDisplayMode.transactions)