A Flutter Plugin to Capture Desktop Screenshots and A Color Picker

ScreenshotX

The ScreenshotX package provides a cross-platform solution for capturing desktop screenshots and picking colors from the screen in Flutter applications.

 LinuxmacOSWindows
Support

Features

  • Capture Screenshots
  • Pick Colors

Getting started

To use the ScreenshotX plugin, add screenshotx as a dependency in your project's pubspec.yaml file.

Usage

  1. Capture the full screen:
Image? fullScreenImage = await screenshotX.captureFullScreen();
  1. Pick color
Color? pickedColor = await screenshotX.pickColor();

For more details on using the ScreenshotX package, check out the example provided in the example directory.

Credits

Created by @aadarshadhakalg

Feel free to report any issues or contribute to the project on GitHub. We appreciate your feedback and contributions!

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add screenshotx

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  screenshotx: ^1.0.0

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:screenshotx/screenshotx.dart'; 

example/lib/main.dart

import 'dart:typed_data';
import 'dart:ui';

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

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _screenshotX = ScreenshotX();
  Uint8List? imageBytes;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () async {
            var image = await _screenshotX.captureFullScreen();
            if (image != null) {
              final pngBytes =
                  await image.toByteData(format: ImageByteFormat.png);
              imageBytes = Uint8List.view(pngBytes!.buffer);
            }
            setState(() {});
          },
          child: const Icon(Icons.camera),
        ),
        body: Center(
          child: imageBytes != null
              ? Image.memory(imageBytes!)
              : const Text("No Screenshot Taken"),
        ),
      ),
    );
  }
} 

Download details:

Author: 

Source: https://pub.dev/packages/screenshotx

#flutter #android #ios 

A Flutter Plugin to Capture Desktop Screenshots and A Color Picker
1.00 GEEK