cm show requesting rather than connected when not authorized

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-11-21 18:45:36 +08:00
parent 16165dae27
commit a9773035c9
27 changed files with 42 additions and 8 deletions

View File

@@ -304,7 +304,9 @@ class _CmHeaderState extends State<_CmHeader>
void initState() {
super.initState();
_timer = Timer.periodic(Duration(seconds: 1), (_) {
if (!client.disconnected) _time.value = _time.value + 1;
if (client.authorized && !client.disconnected) {
_time.value = _time.value + 1;
}
});
}
@@ -358,12 +360,15 @@ class _CmHeaderState extends State<_CmHeader>
FittedBox(
child: Row(
children: [
Text(client.disconnected
? translate("Disconnected")
: translate("Connected"))
Text(client.authorized
? client.disconnected
? translate("Disconnected")
: translate("Connected")
: "${translate("Request access to your device")}...")
.marginOnly(right: 8.0),
Obx(() => Text(
formatDurationToTime(Duration(seconds: _time.value))))
if (client.authorized)
Obx(() => Text(
formatDurationToTime(Duration(seconds: _time.value))))
],
))
],