clipboard_manager 0.0.4 copy "clipboard_manager: ^0.0.4" to clipboard
clipboard_manager: ^0.0.4 copied to clipboard

A flutter plugin to copy text to clipboard.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:clipboard_manager/clipboard_manager.dart';

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

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

class _MyAppState extends State<MyApp> {
  bool result = false;

  @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: () {
                      ClipboardManager.copyToClipBoard("xYZ1234AB").then((result) {
                        final snackBar = SnackBar(
                          content: Text('Copied to Clipboard'),
                          action: SnackBarAction(
                            label: 'Undo',
                            onPressed: () {},
                          ),
                        );
                        Scaffold.of(context).showSnackBar(snackBar);
                      });
                    },
                  )
                ],
              ),
            );
          },
        ),
      ),
    );
  }
}
38
likes
20
pub points
76%
popularity

Publisher

unverified uploader

A flutter plugin to copy text to clipboard.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on clipboard_manager