desktoasts 0.0.1 desktoasts: ^0.0.1 copied to clipboard
A plugin to show native toasts on Windows.
desktoasts
A Dart package to send native :speech_balloon: toasts on Windows.
Installation #
For Flutter
dependencies:
...
desktoasts: ^0.0.1
For Dart CLI
Documentation #
Initialize the toasts service.
ToastService? service;
void main() {
service = new ToastService(
appName: 'desktoasts',
companyName: 'alexmercerind',
productName: 'desktoasts_example',
);
runApp(MyApp());
}
Show a toast containing subtitle.
Toast toast = new Toast(
type: ToastType.text02,
title: 'Hello World!',
subtitle: 'This toast contains a subtitle.',
);
service?.show(toast);
Show a toast containing an image.
Toast toast = new Toast(
type: ToastType.imageAndText02,
title: 'Hello World!',
subtitle: 'This toast contains an image.',
image: new File('C:/Windows/Web/Screen/img100.jpg')
);
service?.show(toast);
Show a toast with actions in it.
Toast toast = new Toast(
type: ToastType.imageAndText02,
title: 'Hello World!',
subtitle: 'This toast contains actions in it.',
image: new File('C:/Windows/Web/Screen/img100.jpg'),
actions: [
'Accept',
'Decline',
]
);
service?.show(toast
Progress #
Done.
- Simple toasts.
- Toasts with image.
- Toasts with actions.
Yet to be done.
- Event handling.
- Progress bar toasts.
- Large image toasts.
- Linux support.
CLI #
Currently only Flutter plugin is published to the pub.dev.
For sending toasts from Dart console apps, you may do as follows for now.
git clone https://github.com/alexmercerind/desktoasts.git
cd desktoasts/cli/example
dart main.dart
Workings #
Although, this might seem like a Flutter plugin, but this is internally based on FFI instead.
This section of the repository, contains C++ code that I compile to a shared library (which both Dart package & Flutter plugin pack along with them) for sending toasts.
Currently, features are limited. I definitely plan to improve upon this.
License #
MIT License. Contributions welcomed.
Acknowledgements #
Current package's functionality is solely based upon WinToast. Thanks to mohabouje.