Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to allow user select value on iOS ? #61

Closed
sunjianan9900 opened this issue Dec 24, 2021 · 1 comment
Closed

How to allow user select value on iOS ? #61

sunjianan9900 opened this issue Dec 24, 2021 · 1 comment
Labels
p:iOS iOS Home Screen Widgets

Comments

@sunjianan9900
Copy link

When the user long presses the HomeWidget, the Event selector will be displayed, and then select the corresponding value to display
How should it be achieved?
like this:
IMG_5095

@ABausG ABausG added the p:iOS iOS Home Screen Widgets label Jun 5, 2022
@ABausG
Copy link
Owner

ABausG commented Jun 5, 2022

Please refer to the official iOS documentation for this as this is all native code

https://developer.apple.com/documentation/widgetkit/making-a-configurable-widget

In order to write these values back you can use the same storage method as the widget itself. So on the iOS side of things you use:

let preferences = UserDefaults.init(suiteName: SwiftHomeWidgetPlugin.groupId)
preferences?.setValue(data, forKey: "HomeWidgetConfiguration")

and then on the flutter side

final data = await HomeWidget.getWidgetData('HomeWidgetConfiguration');

@ABausG ABausG closed this as completed Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p:iOS iOS Home Screen Widgets
Projects
None yet
Development

No branches or pull requests

2 participants