flutter option enable share rdp

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-02-10 18:42:08 +08:00
parent 9d88a06cdf
commit 5b36555faa
2 changed files with 32 additions and 0 deletions

View File

@ -701,6 +701,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
child: _OptionCheckBox(context, 'Enable RDP', 'enable-rdp',
enabled: enabled),
),
shareRdp(context, enabled),
_OptionCheckBox(context, 'Deny LAN Discovery', 'enable-lan-discovery',
reverse: true, enabled: enabled),
...directIp(context),
@ -708,6 +709,33 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
]);
}
shareRdp(BuildContext context, bool enabled) {
onChanged(bool b) async {
await bind.mainSetShareRdp(enable: b);
setState(() {});
}
bool value = bind.mainIsShareRdp();
return Offstage(
offstage: !(Platform.isWindows && bind.mainIsRdpServiceOpen()),
child: GestureDetector(
child: Row(
children: [
Checkbox(
value: value,
onChanged: enabled ? (_) => onChanged(!value) : null)
.marginOnly(right: 5),
Expanded(
child: Text(translate('Enable RDP session sharing'),
style:
TextStyle(color: _disabledTextColor(context, enabled))),
)
],
).marginOnly(left: _kCheckBoxLeftMargin),
onTap: enabled ? () => onChanged(!value) : null),
);
}
List<Widget> directIp(BuildContext context) {
TextEditingController controller = TextEditingController();
update() => setState(() {});

View File

@ -1210,6 +1210,10 @@ pub fn main_is_rdp_service_open() -> SyncReturn<bool> {
SyncReturn(is_rdp_service_open())
}
pub fn main_set_share_rdp(enable: bool) {
set_share_rdp(enable)
}
pub fn main_goto_install() -> SyncReturn<bool> {
goto_install();
SyncReturn(true)