Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/src/ambient_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AmbientMode extends StatefulWidget {
final Widget? child;

/// Called each time the the wear device triggers an ambient update request.
final VoidCallback? onUpdate;
final Function(WearMode)? onUpdate;

/// Get current [WearMode].
static WearMode wearModeOf(BuildContext context) {
Expand Down Expand Up @@ -72,6 +72,7 @@ class _AmbientModeState extends State<AmbientMode> with AmbientCallback {
void _updateMode(bool isAmbient) {
if (mounted) {
setState(() => _ambientMode = isAmbient ? WearMode.ambient : WearMode.active);
if(widget.onUpdate != null) widget.onUpdate!(_ambientMode);
}
}

Expand All @@ -84,7 +85,6 @@ class _AmbientModeState extends State<AmbientMode> with AmbientCallback {
@override
void onUpdateAmbient() {
_updateMode(true);
widget.onUpdate?.call();
}
}

Expand Down