finally working account switcher

This commit is contained in:
Kima 2023-05-27 13:04:45 +02:00
parent 08faa694f2
commit eb529f9050
2 changed files with 8 additions and 3 deletions

2
.vscode/launch.json vendored
View File

@ -10,7 +10,7 @@
"request": "launch",
"type": "dart",
"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"
]
}
]

View File

@ -43,7 +43,12 @@ class ProfileButton extends StatelessWidget {
user = Provider.of<UserProvider>(context);
try {
account = user.getUsers()[1];
user.getUsers().forEach((acc) {
if (user.name!.toLowerCase().replaceAll(' ', '') !=
acc.name.toLowerCase().replaceAll(' ', '')) {
account = acc;
}
});
} catch (err) {
account = null;
}
@ -83,7 +88,7 @@ class ProfileButton extends StatelessWidget {
},
onDoubleTap: () {
if (account != null) {
user.setUser(account.id);
user.setUser(account!.id);
restore().then((_) => user.setUser(account!.id));
}
},