Skip to main content

copy_from_clipboard 1.0.0 copy "copy_from_clipboard: ^1.0.0" to clipboard
copy_from_clipboard: ^1.0.0 copied to clipboard

A Flutter package that provides a simple widget to copy dynamic text to the system clipboard with user feedback.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: HomePage());
  }
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  int count = 1;
  String pastedText = '';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Copy & Paste Test')),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Text('CODE-$count'),
            const SizedBox(height: 10),

            CopyToClipboardButton(
              valueBuilder: () => 'CODE-$count',
              snackbarMessage: 'Text copied!',
            ),

            const SizedBox(height: 20),

            PasteFromClipboardButton(
              onPasted: (text) {
                setState(() {
                  pastedText = text ?? 'No text found';
                });
              },
              snackbarMessage: 'Text pasted!',
            ),

            const SizedBox(height: 20),

            Text('Pasted: $pastedText'),
          ],
        ),
      ),
    );
  }
}
0
likes
140
points
55
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter package that provides a simple widget to copy dynamic text to the system clipboard with user feedback.

Repository (GitLab)

License

MIT (license)

Dependencies

flutter

More

Packages that depend on copy_from_clipboard