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
description: Check which Widgets Users have currently installed
4
-
---
4
+
---
5
+
6
+
# Analytics
7
+
8
+
Sometimes it can be useful to know which Widgets your Users have currently installed.
9
+
10
+
Using home_widget you can check which Widgets a User currently has added to their HomeScreen
11
+
12
+
```dart
13
+
final List<HomeWidgetInfo> info = await HomeWidget.getInstalledWidgets();
14
+
```
15
+
16
+
This will give you respective Information about the Widgets a User has currently installed with respective platform specific Widget Information filled.
17
+
18
+
<Info>Note that each combination of `iOSFamily`(Size) and `iOSKind`(Widget Type) will only appear once in the list due to limitations of iOS.</Info>
Copy file name to clipboardexpand all lines: docs/features/ios-lock-screen.mdx
+46-1
Original file line number
Diff line number
Diff line change
@@ -3,4 +3,49 @@ title: iOS Lock Screen Widgets
3
3
description: Create Widgets for the iOS Lock Screen
4
4
---
5
5
6
-
# iOS Lock Screen Widgets
6
+
# iOS Lock Screen Widgets
7
+
8
+
On iOS Lock Screen Widgets are a great way to show information to your Users without them having to unlock their device.
9
+
10
+
11
+
## Supported Families
12
+
Technically this works by adding another `family` to your Widgets configuration.
13
+
14
+
```swift
15
+
var body: some WidgetConfiguration {
16
+
...
17
+
.description("Lock Screen Widgets")
18
+
.supportedFamilies([
19
+
.systemSmall,
20
+
.systemMedium,
21
+
// Accessory Widgets are available on the Lock Screen only
22
+
.accessoryCircular
23
+
])
24
+
```
25
+
26
+
## Adjust Layout
27
+
28
+
To adjust the layout of the Widget you can check which Family/Size is currently requested in the Widget's layout code
29
+
30
+
```swift
31
+
structLockScreenWidgetView: View {
32
+
var entry: Provider.Entry
33
+
34
+
// Detect the current Family
35
+
@Environment(\.widgetFamily) var family
36
+
37
+
var body: some View {
38
+
if family == .accessoryCircular {
39
+
// Return Widget for Circular Lock Screen Widget
40
+
} else {
41
+
// Build Widget for other families
42
+
}
43
+
}
44
+
}
45
+
```
46
+
47
+
48
+
For more Information on Accessory Widgets check out the [official Apple Documentation](https://developer.apple.com/design/human-interface-guidelines/widgets#Interface-design)
0 commit comments