Skip to content

Commit 9029bfe

Browse files
committed
docs: add documentation for analytics and lock screen widgets
1 parent 6b53a39 commit 9029bfe

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

docs/features/analytics.mdx

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
---
22
title: Analytics
33
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>

docs/features/ios-lock-screen.mdx

+46-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,49 @@ title: iOS Lock Screen Widgets
33
description: Create Widgets for the iOS Lock Screen
44
---
55

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+
struct LockScreenWidgetView: 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)
49+
50+
51+

0 commit comments

Comments
 (0)