FidgetWidget

fun <T : WidgetData> FidgetWidget(configuration: WidgetConfig, dataProvider: WidgetDataProvider<T>? = null, content: @Composable (context: WidgetContext<T>) -> Unit)

Creates a Fidget widget with the specified configuration.

This is the main entry point for defining widgets. The widget content is a Composable function that receives the widget family and data, allowing you to render different layouts based on size.

Example usage:

@Composable
fun MyWidget() = FidgetWidget(
configuration = WidgetConfig(
displayName = "My Widget",
description = "A sample widget",
supportedFamilies = listOf(WidgetFamily.Small, WidgetFamily.Medium)
)
) { context ->
when (context.family) {
WidgetFamily.Small -> SmallLayout()
WidgetFamily.Medium -> MediumLayout()
else -> SmallLayout()
}
}

Parameters

configuration

The widget configuration (name, sizes, update policy, etc.)

dataProvider

Optional data provider for dynamic widget content

content

The composable content of the widget, receiving a WidgetContext


fun FidgetWidget(configuration: WidgetConfig, content: @Composable (family: WidgetFamily) -> Unit)

Overload for widgets without data.