alpha_clipboard 0.1.0 copy "alpha_clipboard: ^0.1.0" to clipboard
alpha_clipboard: ^0.1.0 copied to clipboard

A feature-rich clipboard management package for Flutter with customizable UI, history tracking, and persistent storage.

AlphaClipboard #

pub package License: MIT Developed by: Alpha Kraft

A feature-rich clipboard management package for Flutter applications that provides enhanced clipboard functionality beyond the basic system clipboard.

Features #

  • ๐Ÿ“‹ Enhanced Clipboard Operations: Copy and paste text with improved reliability
  • ๐Ÿ•’ Clipboard History: Track and access previously copied texts
  • ๐Ÿ’พ Persistent Storage: Automatically save clipboard history between app sessions
  • ๐ŸŽจ Customizable Theming: Style the clipboard widget to match your app's design
  • ๐ŸŒ“ Light/Dark Theme Support: Pre-configured themes for both modes
  • ๐Ÿงฉ Ready-to-use Widget: Flexible clipboard widget with full customization options
  • ๐Ÿงช Testing Support: Properly handles clipboard operations in test environments

Installation #

Add this to your pubspec.yaml:

dependencies:
  alpha_clipboard: ^0.1.0

Then run:

flutter pub get

Getting Started #

Initialize the clipboard at the start of your app:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Initialize with auto-save enabled and history capacity
  await AlphaClipboard.initialize(
    autoSave: true,
    maxHistoryItems: 50,
  );
  
  runApp(MyApp());
}

Basic Usage #

Copy and Paste #

// Copy text to clipboard
await AlphaClipboard.copyText("Hello World!");

// Paste text from clipboard
String? text = await AlphaClipboard.pasteText();

Using the Clipboard Widget #

AlphaClipboard.clipboardWidget(
  onCopy: (text) {
    print('Copied: $text');
  },
  onPaste: (text) {
    if (text != null) {
      print('Pasted: $text');
    }
  },
  showHistory: true,
  onHistoryItemSelected: (text) {
    print('Selected from history: $text');
  },
)

Clipboard History Management #

// Get all history items
List<String> history = AlphaClipboard.getHistory();

// Clear history
await AlphaClipboard.clearHistory();

// Manually save current history
await AlphaClipboard.saveHistory();

// Restore saved history
await AlphaClipboard.restoreHistory();

Advanced Customization #

Custom Theme #

final myTheme = ClipboardThemeData(
  backgroundColor: Colors.blue[50],
  buttonColor: Colors.indigo,
  textStyle: TextStyle(color: Colors.black87),
  borderRadius: BorderRadius.circular(12.0),
  elevation: 4.0,
  padding: EdgeInsets.all(20.0),
);

AlphaClipboard.clipboardWidget(
  onCopy: (text) {},
  onPaste: (text) {},
  theme: myTheme,
)

Using Preset Themes #

// Light theme
final lightTheme = ClipboardThemeData.light();

// Dark theme
final darkTheme = ClipboardThemeData.dark();

// Modify preset theme
final customDarkTheme = ClipboardThemeData.dark().copyWith(
  buttonColor: Colors.purple,
  elevation: 8.0,
);

Demo App #

Demo App Preview

The package includes a complete example app demonstrating all features:

cd example
flutter run

Implementation Details #

AlphaClipboard uses a combination of:

  • Flutter's Clipboard API for system clipboard access
  • SharedPreferences for persistent storage of clipboard history
  • Custom widgets and themes for UI representation

Testing #

The package properly handles clipboard operations in test environments by maintaining a local reference to the last copied text, making it testable without mocking the system clipboard.

Contributions #

Contributions are welcome! If you have ideas for improvements or found a bug, please open an issue or submit a pull request.

License #

This project is licensed under the MIT License with the following usage conditions:

  • Free for up to 100,000 package downloads
  • $1 per month license fee for use beyond 100,000 downloads

See the LICENSE file for details.

About #

Developed and maintained by Alpha Kraft.

For inquiries, please contact: alphakraft.customer@gmail.com

1
likes
130
points
114
downloads

Publisher

verified publisheralpha-kraft.blogspot.com

Weekly Downloads

A feature-rich clipboard management package for Flutter with customizable UI, history tracking, and persistent storage.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

flutter, shared_preferences

More

Packages that depend on alpha_clipboard