glance_widget library

Flutter package for creating instant-updating home screen widgets for Android (Jetpack Glance) and iOS (WidgetKit).

This package provides 7 widget templates:

  • SimpleWidget: Title + Value + Subtitle (crypto prices, weather)
  • ProgressWidget: Circular/Linear progress bars (downloads, goals)
  • ListWidget: Scrollable list with optional checkboxes (to-do, news)
  • ImageWidget: Image display with title and subtitle
  • ChartWidget: Line/Bar/Sparkline data visualization
  • CalendarWidget: Date and event list display
  • GaugeWidget: Radial or dashboard-style metrics

Getting Started

import 'package:glance_widget/glance_widget.dart';

// Quick update with static API
await GlanceWidget.simple(
  id: 'crypto_btc',
  title: 'Bitcoin',
  value: '\$94,532.00',
);

// Or use type-safe controllers
final ctrl = SimpleWidgetController(widgetId: 'crypto_btc');
await ctrl.update(SimpleWidgetData(title: 'Bitcoin', value: '\$94,532'));
ctrl.dispose();

See the README for complete documentation.

Classes

CalendarEvent
Data model for a single calendar event.
CalendarWidgetController
Convenience controller for Calendar widgets.
CalendarWidgetData
Data model for Calendar Widget template.
ChartWidgetController
Convenience controller for Chart widgets.
ChartWidgetData
Data model for Chart Widget template.
DebouncedWidgetController<T extends WidgetData>
Controller that debounces rapid widget updates for real-time data.
GaugeMetric
Data model for a single gauge metric.
GaugeWidgetController
Convenience controller for Gauge widgets.
GaugeWidgetData
Data model for Gauge Widget template.
GlanceBackground
Background update and timeline refresh operations.
GlanceConfig
Package configuration.
GlanceListItem
Data model for a single list item.
GlanceTheme
Theme configuration for Glance Widgets.
GlanceWidget
Main class for creating and updating Glance widgets.
GlanceWidgetAction
Represents an action event from a Glance Widget.
GlanceWidgetController<T extends WidgetData>
Generic controller for managing a single Glance widget instance.
ImageWidgetController
Convenience controller for Image widgets.
ImageWidgetData
Data model for Image Widget template.
ListWidgetController
Convenience controller for List widgets.
ListWidgetData
Data model for List Widget template.
PlatformGuard
Static utility for guarding platform calls on unsupported platforms.
ProgressWidgetController
Convenience controller for Progress widgets.
ProgressWidgetData
Data model for Progress Widget template.
SimpleWidgetController
Convenience controller for Simple widgets.
SimpleWidgetData
Data model for Simple Widget template.
WidgetData
Base class for all widget data models. Sealed — cannot be extended outside this library.

Enums

ChartType
Chart type for Chart Widget.
GaugeType
Gauge display type.
GlanceActionType
Types of actions that can be triggered from a widget.
GlanceTemplate
Widget template types.
ImageFit
Image fit mode for Image Widget.
ProgressType
Progress type enum for Progress Widget.

Exceptions / Errors

GlanceWidgetException
Exception thrown when a Glance widget operation fails.
GlanceWidgetTimeoutException
Exception thrown when a widget operation times out.
GlanceWidgetValidationException
Exception thrown when widget data validation fails.