Skip to content

A capable library for managing Windows tray icons in your Flutter app πŸ¦‹

License

Notifications You must be signed in to change notification settings

benthillerkus/betrayal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

skip to content

A capable tray icon plugin for Windows.

πŸ”— package on pub.dev
πŸ”— source on github.com
πŸ”— dart docs api reference

Manage multiple icons πŸ‘¨β€πŸ‘©β€πŸ‘¦β€πŸ‘¦,
generate their images at runtime 🎨
and compose them just like a widget 🎢

Features

pub score pub version (including pre-releases) pub publisher

  • Control multiple tray icons
  • Many options for setting the tray icons image
    • .ico file either from the file system or the Flutter assets directory
    • Set the pixels directly through an image buffer - you can use this to dynamically create an image via canvas!
    • Use default system icons like the ❔ or the elevation prompt πŸ›‘οΈ
  • Widget api - treat the tray icon as part of your UI and compose it in your build methods
demo.mp4

Usage

After you've added betrayal to your dependencies via flutter pub add betrayal and flutter pub get, you can start to use it:

import 'package:betrayal/betrayal.dart';

// ...

@override
Widget build(BuildContext context) => MaterialApp(
  home: Scaffold(
    appBar: AppBar(
      title: const Text("Look at the system tray πŸ‘€")
    ),
    body: Center(
      // The icon will be visible aslong as the [TrayIconWidget] will be built
      child: TrayIconWidget(
        winIcon: WinIcon.application,
        tooltip: "Here I am!"
        child: FlutterLogo()
      )
    )
  )
);

If you just want a tray icon, that's pretty much all you need to know.

There is, however, also a quick-guide README.md, four example applications and of course the API docs, if you do want to learn more.

Don't hesitate to file an issue, I'll have a look at it eventually 😊

Development

Style

Use conventionalcommits.org/en/v1.0.0 for commits.
Β Β Β Β see release.yml for a list of currently allowed commit types
Use dart.dev/guides/language/effective-dartdocumentation for docs.

Overview

Mermaid diagram of the architecture
  graph LR;
    BetrayalPlugin o----o |connects via platform channel to| betrayal_plugin.cpp
    subgraph dart
    TrayIconWidget -- manages --> TrayIcon -- calls --> BetrayalPlugin
    TrayIcon -- uses --> TrayIconImageDelegate -- calls --> BetrayalPlugin
    BetrayalLogConfig
    end
    subgraph native
    betrayal_plugin.cpp -- holds --> IconManager.hpp
    IconManager.hpp -- provides TrayIcon.hpp to --> betrayal_plugin.cpp
    betrayal_plugin.cpp -- calls --> TrayIcon.hpp
    end
    click BetrayalPlugin "https://github.com/benthillerkus/betrayal/blob/main/lib/src/plugin.dart"
    click TrayIcon "https://github.com/benthillerkus/betrayal/blob/main/lib/src/imperative.dart"
    click TrayIconWidget "https://github.com/benthillerkus/betrayal/blob/main/lib/src/widgets.dart"
    click TrayIconImageDelegate "https://github.com/benthillerkus/betrayal/blob/main/lib/src/image.dart"
    click betrayal_plugin.cpp "https://github.com/benthillerkus/betrayal/blob/main/windows/betrayal_plugin.cpp"
    click IconManager.hpp "https://github.com/benthillerkus/betrayal/blob/main/windows/icon_manager.hpp"
    click TrayIcon.hpp "https://github.com/benthillerkus/betrayal/blob/main/windows/tray_icon.hpp"
Loading