sync setting page service status
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
4a2307de2f
commit
c2287214f8
2
build.py
2
build.py
@ -71,7 +71,7 @@ def make_parser():
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--hwcodec',
|
'--hwcodec',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Enable feature hwcodec'
|
help='Enable feature hwcodec' + ('' if windows or osx else ', need libva-dev, libvdpau-dev.')
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--portable',
|
'--portable',
|
||||||
|
@ -39,6 +39,10 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
final RxBool _idInputFocused = false.obs;
|
final RxBool _idInputFocused = false.obs;
|
||||||
final FocusNode _idFocusNode = FocusNode();
|
final FocusNode _idFocusNode = FocusNode();
|
||||||
|
|
||||||
|
var svcStopped = false.obs;
|
||||||
|
var svcStatusCode = 0.obs;
|
||||||
|
var svcIsUsingPublicServer = true.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -58,6 +62,15 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
_idFocusNode.addListener(() {
|
_idFocusNode.addListener(() {
|
||||||
_idInputFocused.value = _idFocusNode.hasFocus;
|
_idInputFocused.value = _idFocusNode.hasFocus;
|
||||||
});
|
});
|
||||||
|
Get.put<RxBool>(svcStopped, tag: 'service-stop');
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_idController.dispose();
|
||||||
|
_updateTimer?.cancel();
|
||||||
|
Get.delete<RxBool>(tag: 'service-stop');
|
||||||
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -222,17 +235,6 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
constraints: const BoxConstraints(maxWidth: 600), child: w));
|
constraints: const BoxConstraints(maxWidth: 600), child: w));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_idController.dispose();
|
|
||||||
_updateTimer?.cancel();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
var svcStopped = false.obs;
|
|
||||||
var svcStatusCode = 0.obs;
|
|
||||||
var svcIsUsingPublicServer = true.obs;
|
|
||||||
|
|
||||||
Widget buildStatus() {
|
Widget buildStatus() {
|
||||||
final em = 14.0;
|
final em = 14.0;
|
||||||
return ConstrainedBox(
|
return ConstrainedBox(
|
||||||
|
@ -432,6 +432,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
|
|||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
bool locked = bind.mainIsInstalled();
|
bool locked = bind.mainIsInstalled();
|
||||||
final scrollController = ScrollController();
|
final scrollController = ScrollController();
|
||||||
|
final RxBool serviceStop = Get.find<RxBool>(tag: 'service-stop');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -465,17 +466,15 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget permissions(context) {
|
Widget permissions(context) {
|
||||||
bool enabled = !locked;
|
return Obx(() => _permissions(context, serviceStop.value));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _permissions(context, bool stopService) {
|
||||||
|
bool enabled = !locked;
|
||||||
return _futureBuilder(future: () async {
|
return _futureBuilder(future: () async {
|
||||||
bool stopService = option2bool(
|
return await bind.mainGetOption(key: 'access-mode');
|
||||||
'stop-service', await bind.mainGetOption(key: 'stop-service'));
|
|
||||||
final accessMode = await bind.mainGetOption(key: 'access-mode');
|
|
||||||
return {'stopService': stopService, 'accessMode': accessMode};
|
|
||||||
}(), hasData: (data) {
|
}(), hasData: (data) {
|
||||||
var map = data! as Map<String, dynamic>;
|
String accessMode = data! as String;
|
||||||
bool stopService = map['stopService'] as bool;
|
|
||||||
String accessMode = map['accessMode'] as String;
|
|
||||||
_AccessMode mode;
|
_AccessMode mode;
|
||||||
if (stopService) {
|
if (stopService) {
|
||||||
mode = _AccessMode.deny;
|
mode = _AccessMode.deny;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user