demo: use mobile_ffi to get id for desktop version

This commit is contained in:
Kingtous
2022-05-25 00:28:59 +08:00
parent a81e2f9859
commit a364e7f808
12 changed files with 165 additions and 32 deletions

View File

@ -1,7 +1,10 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:wakelock/wakelock.dart';
import '../common.dart';
import '../mobile/pages/server_page.dart';
import 'model.dart';
@ -203,7 +206,10 @@ class ServerModel with ChangeNotifier {
FFI.setByName("start_service");
getIDPasswd();
updateClientState();
Wakelock.enable();
if (!Platform.isLinux) {
// current linux is not supported
Wakelock.enable();
}
}
Future<Null> stopService() async {
@ -212,7 +218,10 @@ class ServerModel with ChangeNotifier {
await FFI.invokeMethod("stop_service");
FFI.setByName("stop_service");
notifyListeners();
Wakelock.disable();
if (!Platform.isLinux) {
// current linux is not supported
Wakelock.disable();
}
}
Future<Null> initInput() async {