finally working account switcher
This commit is contained in:
parent
08faa694f2
commit
eb529f9050
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -10,7 +10,7 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"toolArgs": [
|
"toolArgs": [
|
||||||
"--dart-define=APPVER=$(cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1)"
|
"--dart-define=APPVER=$(cat pubspec.yaml | grep version: | cut -d' ' -f2 | cut -d+ -f1) --release"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -43,7 +43,12 @@ class ProfileButton extends StatelessWidget {
|
|||||||
|
|
||||||
user = Provider.of<UserProvider>(context);
|
user = Provider.of<UserProvider>(context);
|
||||||
try {
|
try {
|
||||||
account = user.getUsers()[1];
|
user.getUsers().forEach((acc) {
|
||||||
|
if (user.name!.toLowerCase().replaceAll(' ', '') !=
|
||||||
|
acc.name.toLowerCase().replaceAll(' ', '')) {
|
||||||
|
account = acc;
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
account = null;
|
account = null;
|
||||||
}
|
}
|
||||||
@ -83,7 +88,7 @@ class ProfileButton extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
onDoubleTap: () {
|
onDoubleTap: () {
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
user.setUser(account.id);
|
user.setUser(account!.id);
|
||||||
restore().then((_) => user.setUser(account!.id));
|
restore().then((_) => user.setUser(account!.id));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user