You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add GitHub Actions, Tests and Integration Tests to ensure further quality
* Fix double and null handling on Android
* Fix HomeWidget.updateWidget not completing on Android (Fixes#26)
HomeWidget is a Plugin to make it easier to create HomeScreen Widgets on Android and iOS.
9
-
HomeWidget does **not** allow writing Widgets with Flutter itself. It still requires writing the Widgets with native code. However it provides a unified Interface for sending data, retrieving data and updating the Widgets
10
+
HomeWidget does **not** allow writing Widgets with Flutter itself. It still requires writing the Widgets with native code. However, it provides a unified Interface for sending data, retrieving data and updating the Widgets
As stated there needs to be some platform specific setup. Check below on how to add support for Android and iOS
17
+
In order to work correctly there needs to be some platform specific setup. Check below on how to add support for Android and iOS
17
18
18
19
<details><summary>Android</summary>
19
20
@@ -44,8 +45,8 @@ As stated there needs to be some platform specific setup. Check below on how to
44
45
```
45
46
46
47
### Write your WidgetProvider
47
-
For convenience you can extend from [HomeWidgetProvider](android/src/main/kotlin/es/antonborri/home_widget/HomeWidgetProvider.kt) which gives you access to a SharedPreferences Object with the Data in the `onUpdate` method.
48
-
If you don't want to use the convenience Method you can access the Data using
48
+
For convenience, you can extend from [HomeWidgetProvider](android/src/main/kotlin/es/antonborri/home_widget/HomeWidgetProvider.kt) which gives you access to a SharedPreferences Object with the Data in the `onUpdate` method.
49
+
In case you don't want to use the convenience Method you can access the Data using
49
50
```kotlin
50
51
importes.antonborri.home_widget.HomeWidgetPlugin
51
52
...
@@ -76,10 +77,10 @@ Add this group to you Runner and the Widget Extension inside XCode `Signing & Ca
(To swap between your App and the Extension change the Target)
80
+
(To swap between your App, and the Extension change the Target)
80
81
81
82
### Sync CFBundleVersion (optional)
82
-
This step is optional, this will sync the widget extension build version with your app version so you don't get warnings of mismatch version from App Store Connect when uploading your app.
83
+
This step is optional, this will sync the widget extension build version with your app version, so you don't get warnings of mismatch version from App Store Connect when uploading your app.
@@ -97,7 +98,7 @@ Replace `HomeExampleWidget` with the name of the widget extension folder that yo
97
98
98
99
### Write your Widget
99
100
Check the [Example App](example/ios/HomeWidgetExample/HomeWidgetExample.swift) for an Implementation of a Widget
100
-
A more detailed overview on how to write Widgets for iOS 14 can fbe found on the [Apple Developer documentation](https://developer.apple.com/documentation/swiftui/widget)
101
+
A more detailed overview on how to write Widgets for iOS 14 can fbe found on the [Apple Developer documentation](https://developer.apple.com/documentation/swiftui/widget).
101
102
In order to access the Data send with Flutter can be access with
102
103
```swift
103
104
let data = UserDefaults.init(suiteName:"YOUR_GROUP_ID")
@@ -107,7 +108,7 @@ let data = UserDefaults.init(suiteName:"YOUR_GROUP_ID")
107
108
## Usage
108
109
109
110
### Setup
110
-
For iOS you need to call `HomeWidget.setAppGroupId('YOUR_GROUP_ID');`
111
+
For iOS, you need to call `HomeWidget.setAppGroupId('YOUR_GROUP_ID');`
111
112
Without this you won't be able to share data between your App and the Widget and calls to `saveWidgetData` and `getWidgetData` will return an error
112
113
113
114
### Save Data
@@ -124,7 +125,7 @@ HomeWidget.updateWidget(
124
125
```
125
126
126
127
The name for Android will be chosen by checking `androidName` if that was not provided it will fallback to `name`.
127
-
This Name needs to be equal to the Classname of the [WidgetProvider](#-write-your-widgetprovider)
128
+
This Name needs to be equal to the Classname of the [WidgetProvider](#Write-your-Widget)
128
129
129
130
The name for iOS will be chosen by checking `iOSName` if that was not provided it will fallback to `name`.
130
131
This name needs to be equal to the Kind specified in you Widget
@@ -146,7 +147,7 @@ WorkmanagerPlugin.setPluginRegistrantCallback { registry in
146
147
to [AppDelegate.swift](example/ios/Runner/AppDelegate.swift)
147
148
148
149
### Clicking
149
-
To detect if the App was initially started by clicking the Widget you can call `HomeWidget.initiallyLaunchedFromHomeWidget()` if the App was already running in the Background you can receive these Events by listening to `HomeWidget.widgetClicked`. Both methods will provide Uris so you can easily send back data from the Widget to the App to for example navigate to a content page.
150
+
To detect if the App has been initially started by clicking the Widget you can call `HomeWidget.initiallyLaunchedFromHomeWidget()` if the App was already running in the Background you can receive these Events by listening to `HomeWidget.widgetClicked`. Both methods will provide Uris, so you can easily send back data from the Widget to the App to for example navigate to a content page.
150
151
151
152
In order for these methods to work you need to follow these steps:
result.error("-3", "No Widget found with Name $className. Argument 'name' must be the same as your AppWidgetProvider you wish to update", classException)
0 commit comments