1

I'm using desktop_webview_window: ^0.1.6 flutter package.

import 'package:flutter/material.dart';
import 'package:desktop_webview_window/desktop_webview_window.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';

how can i only display the webview window without the white screen in flutter desktop?

enter image description here

here is full the code:

import 'package:flutter/material.dart';
import 'package:desktop_webview_window/desktop_webview_window.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';

void main(List<String> args) async {
  debugPrint('args: $args');
  WidgetsFlutterBinding.ensureInitialized();
  if (runWebViewTitleBarWidget(args)) {
    return;
  }
  runApp(const MyApp());
  doWhenWindowReady(
    () {
      final initialSize = Size(800, 650);
      final minSize = Size(600, 450);
      final maxSize = Size(1200, 850);
      appWindow.maxSize = maxSize;
      appWindow.minSize = minSize;
      appWindow.size = initialSize; //default size
      appWindow.show();

    },
  );
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Vroom',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const WebViewExample(),
    );
  }
}

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

  @override
  _WebViewExampleState createState() => _WebViewExampleState();
}

class _WebViewExampleState extends State<WebViewExample> {
  @override
  void initState() {
    super.initState();
    web();
  }

  void web() async {
    final webview = await WebviewWindow.create(
      configuration: const CreateConfiguration(title: "google"),
    );
    webview.launch("https://google.com/");
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold();
  }
}

the problem is that i want to execute this part only:

void web() async {
    final webview = await WebviewWindow.create(
      configuration: const CreateConfiguration(title: "google"),
    );
    webview.launch("https://google.com/");
  }

any help please ?

MD ZDN
  • 209
  • 2
  • 8

0 Answers0