mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-17 05:25:53 +00:00
fix abModel multi request and state didn't refresh bug
This commit is contained in:
@@ -500,7 +500,6 @@ Future<bool> loginDialog() async {
|
||||
close();
|
||||
}
|
||||
|
||||
// 登录dialog
|
||||
return CustomAlertDialog(
|
||||
title: Text(translate("Login")),
|
||||
content: ConstrainedBox(
|
||||
|
||||
@@ -761,20 +761,18 @@ class _AccountState extends State<_Account> {
|
||||
Widget accountAction() {
|
||||
return _futureBuilder(future: () async {
|
||||
return await gFFI.userModel.getUserName();
|
||||
}(), hasData: (data) {
|
||||
String username = data as String;
|
||||
return _Button(
|
||||
username.isEmpty ? 'Login' : 'Logout',
|
||||
}(), hasData: (_) {
|
||||
return Obx(() => _Button(
|
||||
gFFI.userModel.userName.value.isEmpty ? 'Login' : 'Logout',
|
||||
() => {
|
||||
username.isEmpty
|
||||
gFFI.userModel.userName.value.isEmpty
|
||||
? loginDialog().then((success) {
|
||||
if (success) {
|
||||
// refresh frame
|
||||
setState(() {});
|
||||
gFFI.abModel.pullAb();
|
||||
}
|
||||
})
|
||||
: gFFI.userModel.logOut()
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user