fix desktop stop-service
This commit is contained in:
parent
cb88a3abb6
commit
42f27922bf
@ -376,13 +376,20 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
||||
width: 8,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: Colors.green,
|
||||
color: svcStopped.value ? Colors.redAccent : Colors.green,
|
||||
),
|
||||
).paddingSymmetric(horizontal: 8.0);
|
||||
).paddingSymmetric(horizontal: 10.0);
|
||||
if (svcStopped.value) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [light, Text(translate("Service is not running"))],
|
||||
children: [
|
||||
light,
|
||||
Text(translate("Service is not running")),
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
bind.mainSetOption(key: "stop-service", value: ""),
|
||||
child: Text(translate("Start Service")))
|
||||
],
|
||||
);
|
||||
} else {
|
||||
if (svcStatusCode.value == 0) {
|
||||
@ -425,7 +432,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
||||
}
|
||||
|
||||
updateStatus() async {
|
||||
svcStopped.value = bind.mainGetOption(key: "stop-service") == "Y";
|
||||
svcStopped.value = await bind.mainGetOption(key: "stop-service") == "Y";
|
||||
final status =
|
||||
jsonDecode(await bind.mainGetConnectStatus()) as Map<String, dynamic>;
|
||||
svcStatusCode.value = status["status_num"];
|
||||
|
@ -513,7 +513,12 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
||||
Future<PopupMenuItem<String>> genEnablePopupMenuItem(
|
||||
String label, String key) async {
|
||||
final v = await bind.mainGetOption(key: key);
|
||||
bool enable = v != "N";
|
||||
bool enable;
|
||||
if (key == "stop-service") {
|
||||
enable = v != "Y";
|
||||
} else {
|
||||
enable = v != "N";
|
||||
}
|
||||
|
||||
return PopupMenuItem(
|
||||
child: Row(
|
||||
|
Loading…
x
Reference in New Issue
Block a user