Skip to content

Commit

Permalink
add example to AccentColorListener
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian-Samoticha committed Aug 15, 2023
1 parent 7fa0f23 commit 3e50ae4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/src/utils/accent_color_listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ import 'package:macos_ui/src/enums/accent_color.dart';
/// A class that listens to changes to the user’s selected system accent color.
///
/// Native macOS applications respond to such changes immediately.
///
/// Example using [StreamBuilder]:
///
/// ```dart
/// StreamBuilder(
/// stream: AccentColorListener.instance.onChangedStream,
/// builder: (context, _) {
/// final AccentColor? accentColor =
/// AccentColorListener.instance.currentAccentColor;
///
/// return SomeWidget(
/// accentColor: accentColor,
/// child: ...
/// );
/// },
/// );
/// ```
class AccentColorListener {
/// A shared instance of [AccentColorListener].
static final instance = AccentColorListener();
Expand Down

0 comments on commit 3e50ae4

Please sign in to comment.