desktoasts 0.0.3 copy "desktoasts: ^0.0.3" to clipboard
desktoasts: ^0.0.3 copied to clipboard

discontinuedreplaced by: win_toast
PlatformWindows

A plugin to show native toasts on Windows.

example/lib/main.dart

import 'dart:io';
import 'package:flutter/material.dart';

import 'package:desktoasts/desktoasts.dart';


ToastService? service;

void main() {
  service = new ToastService(
    appName: 'desktoasts',
    companyName: 'alexmercerind',
    productName: 'desktoasts_example',
  );
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  MyApp({Key? key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('desktoasts'),
          centerTitle: true,
        ),
        body: ListView(
          padding: EdgeInsets.all(32.0),
          children: [
            Container(
              height: 56.0,
              child: Row(
                children: [
                  Expanded(
                    child: Text('A toast with a subtitle.'),
                  ),
                  ElevatedButton(onPressed: () {
                    Toast toast = new Toast(
                      type: ToastType.text02,
                      title: 'Hello World!',
                      subtitle: 'This toast contains a subtitle.',
                    );
                    service?.show(toast);
                  }, child: Text('Show'))
                ],
              ),
            ),
            Container(
              height: 56.0,
              child: Row(
                children: [
                  Expanded(
                    child: Text('A toast with an image.'),
                  ),
                  ElevatedButton(onPressed: () {
                    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);
                  }, child: Text('Show'))
                ],
              ),
            ),
            Container(
              height: 56.0,
              child: Row(
                children: [
                  Expanded(
                    child: Text('A toast with actions.'),
                  ),
                  ElevatedButton(onPressed: () {
                    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);
                  }, child: Text('Show'))
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
30
likes
130
pub points
46%
popularity

Publisher

unverified uploader

A plugin to show native toasts on Windows.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

ffi, flutter, path

More

Packages that depend on desktoasts