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

PlatformmacOS

This is a Flutter plugin that allows you to create a virtual display

example/lib/main.dart

// ignore_for_file: avoid_print

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

void main() {
  runApp(
    const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MyApp(),
    ),
  );
}

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

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

class _MyAppState extends State<MyApp> {
  int? displayId;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter Virtual Display'),
      ),
      body: Center(
        child: Column(
          children: [
            Padding(
              padding: const EdgeInsets.all(8.0),
              child: Text("Virtual Display ID: $displayId"),
            ),
            const Divider(),
            const SizedBox(height: 20),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: [
                ElevatedButton(
                  onPressed: displayId != null
                      ? null
                      : () async {
                          var result =
                              await FlutterVirtualDisplay.createDisplay(
                            name: "Virtual Display",
                            width: 1920,
                            height: 1080,
                          );
                          setState(() {
                            displayId = result;
                          });
                        },
                  child: const Text('Create Virtual Display'),
                ),
                ElevatedButton(
                  onPressed: displayId == null
                      ? null
                      : () {
                          FlutterVirtualDisplay.removeDisplay(displayId!);
                          setState(() {
                            displayId = null;
                          });
                        },
                  child: const Text('Remove Display'),
                ),
              ],
            )
          ],
        ),
      ),
    );
  }
}
0
likes
150
points
19
downloads

Publisher

verified publisherrohitsangwan.in

Weekly Downloads

This is a Flutter plugin that allows you to create a virtual display

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_virtual_display