clipboard_plugin 0.0.1 copy "clipboard_plugin: ^0.0.1" to clipboard
clipboard_plugin: ^0.0.1 copied to clipboard

clipboard plugin.

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
    
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Builder(
          builder: (context) {
            return Center(
              child: Column(
                children: <Widget>[
                  Text('Your coupon is xYZ1234AB'),
                  RaisedButton(
                    child: Text('Copy to Clipboard'),
                    onPressed: () {
                      ClipboardPlugin.copyToClipBoard("xYZ1234AB").then((result) {
                        final snackBar = SnackBar(
                          content: Text('Copied to Clipboard'),
                          action: SnackBarAction(
                            label: 'Undo',
                            onPressed: () {},
                          ),
                        );
                        Scaffold.of(context).showSnackBar(snackBar);
                      });
                    },
                  )
                ],
              ),
            );
          },
        ),
      ),
    );
  }
}
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

clipboard plugin.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on clipboard_plugin