Merge pull request #3069 from fufesou/refact/sync_option_after_toggle
sync option after toggle
This commit is contained in:
		
						commit
						a7f0b63623
					
				| @ -273,6 +273,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> { | |||||||
|       menu.add(MenuEntryDivider<String>()); |       menu.add(MenuEntryDivider<String>()); | ||||||
|       menu.add(() { |       menu.add(() { | ||||||
|         final state = ShowRemoteCursorState.find(key); |         final state = ShowRemoteCursorState.find(key); | ||||||
|  |         final optKey = 'show-remote-cursor'; | ||||||
|         return MenuEntrySwitch2<String>( |         return MenuEntrySwitch2<String>( | ||||||
|           switchType: SwitchType.scheckbox, |           switchType: SwitchType.scheckbox, | ||||||
|           text: translate('Show remote cursor'), |           text: translate('Show remote cursor'), | ||||||
| @ -280,9 +281,8 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> { | |||||||
|             return state; |             return state; | ||||||
|           }, |           }, | ||||||
|           setter: (bool v) async { |           setter: (bool v) async { | ||||||
|             state.value = v; |             await bind.sessionToggleOption(id: key, value: optKey); | ||||||
|             await bind.sessionToggleOption( |             state.value = bind.sessionGetToggleOptionSync(id: key, arg: optKey); | ||||||
|                 id: key, value: 'show-remote-cursor'); |  | ||||||
|             cancelFunc(); |             cancelFunc(); | ||||||
|           }, |           }, | ||||||
|           padding: padding, |           padding: padding, | ||||||
|  | |||||||
| @ -1160,6 +1160,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> { | |||||||
|     if (!widget.ffi.canvasModel.cursorEmbedded) { |     if (!widget.ffi.canvasModel.cursorEmbedded) { | ||||||
|       displayMenu.add(() { |       displayMenu.add(() { | ||||||
|         final state = ShowRemoteCursorState.find(widget.id); |         final state = ShowRemoteCursorState.find(widget.id); | ||||||
|  |         final optKey = 'show-remote-cursor'; | ||||||
|         return MenuEntrySwitch2<String>( |         return MenuEntrySwitch2<String>( | ||||||
|           switchType: SwitchType.scheckbox, |           switchType: SwitchType.scheckbox, | ||||||
|           text: translate('Show remote cursor'), |           text: translate('Show remote cursor'), | ||||||
| @ -1167,9 +1168,9 @@ class _RemoteMenubarState extends State<RemoteMenubar> { | |||||||
|             return state; |             return state; | ||||||
|           }, |           }, | ||||||
|           setter: (bool v) async { |           setter: (bool v) async { | ||||||
|             state.value = v; |             await bind.sessionToggleOption(id: widget.id, value: optKey); | ||||||
|             await bind.sessionToggleOption( |             state.value = | ||||||
|                 id: widget.id, value: 'show-remote-cursor'); |                 bind.sessionGetToggleOptionSync(id: widget.id, arg: optKey); | ||||||
|           }, |           }, | ||||||
|           padding: padding, |           padding: padding, | ||||||
|           dismissOnClicked: true, |           dismissOnClicked: true, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user