flutter_native_view 0.0.2 copy "flutter_native_view: ^0.0.2" to clipboard
flutter_native_view: ^0.0.2 copied to clipboard

PlatformWindows

Flutter plugin to embed native windows into Flutter window.

example/lib/main.dart

import 'dart:ffi';
import 'package:ffi/ffi.dart';
import 'package:win32/win32.dart';
import 'package:flutter/material.dart';

import 'package:flutter_native_view/flutter_native_view.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await FlutterNativeView.ensureInitialized();
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

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

class _MyAppState extends State<MyApp> {
  final controller = ScrollController();
  final controllers = [
    NativeViewController(
      handle: FindWindow(
        nullptr,
        'VLC Media Player'.toNativeUtf16(),
      ),
      hitTestBehavior: HitTestBehavior.translucent,
    ),
    NativeViewController(
      handle: FindWindow(
        nullptr,
        'This PC'.toNativeUtf16(),
      ),
      hitTestBehavior: HitTestBehavior.translucent,
    ),
  ];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('flutter_native_view'),
        ),
        body: ListView(
          controller: controller,
          padding: const EdgeInsets.symmetric(vertical: 16.0),
          children: [
            Padding(
              padding:
                  const EdgeInsets.symmetric(vertical: 16.0, horizontal: 32.0),
              child: NativeView(
                controller: controllers[0],
                width: 640.0,
                height: 480.0,
              ),
            ),
            Padding(
              padding:
                  const EdgeInsets.symmetric(vertical: 16.0, horizontal: 32.0),
              child: NativeView(
                controller: controllers[1],
                width: 640.0,
                height: 480.0,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
33
likes
130
points
1.28k
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin to embed native windows into Flutter window.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, path

More

Packages that depend on flutter_native_view