openwebf / webf

Build flutter apps with HTML/CSS and JavaScript.
https://openwebf.com/
Apache License 2.0
1.64k stars 117 forks source link

demo不能在Windows上运行 #633

Open huangsir0 opened 3 months ago

huangsir0 commented 3 months ago

Affected version

0.16.1

Flutter versions

3.22.1

No same issues found.

Steps to Reproduce

在windows 运行以下代码,我Windows11 64位系统。

Code example


/*
 * Copyright (C) 2019-2022 The Kraken authors. All rights reserved.
 * Copyright (C) 2022-present The WebF authors. All rights reserved.
 */

import 'package:flutter/material.dart';
import 'package:webf/devtools.dart';
import 'package:webf/webf.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Kraken Browser',
      // theme: ThemeData.dark(),
      debugShowCheckedModeBanner: false,
      home: FirstPage(title: 'Landing Bay'),
    );
  }
}

class FirstPage extends StatefulWidget {
  const FirstPage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<StatefulWidget> createState() {
    return FirstPageState();
  }
}

class FirstPageState extends State<FirstPage> {
  late WebFController controller;

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
    controller = WebFController(
      context,
      devToolsService: ChromeDevToolsService(),
    );

    controller.preload(
        WebFBundle.fromUrl('https://www.baidu.com')); // The page entry point
  }

  @override
  void dispose() {
    super.dispose();
    controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            Navigator.push(context, MaterialPageRoute(builder: (context) {
              return WebFDemo(controller: controller);
            }));
          },
          child: const Text('Open WebF Page'),
        ),
      ),
    );
  }
}

class WebFDemo extends StatelessWidget {
  final WebFController controller;

  WebFDemo({required this.controller});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('WebF Demo'),
        ),
        body: Center(
          // Center is a layout widget. It takes a single child and positions it
          // in the middle of the parent.
          child: WebF(controller: controller),
        ));
  }
}

Expected results

希望能正常运行

Actual results


[  +44 ms] Building Windows application... (completed in 39.2s)
[   +2 ms] √ Built build\windows\x64\runner\Debug\walang.exe
[ +193 ms] VM Service URL on device: http://127.0.0.1:62445/qveTu-fAfNk=/
[   +1 ms] Caching compiled dill
[  +53 ms] Connecting to service protocol: http://127.0.0.1:62445/qveTu-fAfNk=/
[        ]     0 ������
[        ] ����ʱ�� 00:00:34.69
[  +44 ms] Building Windows application... (completed in 39.2s)
[   +2 ms] √ Built build\windows\x64\runner\Debug\walang.exe
[ +193 ms] VM Service URL on device: http://127.0.0.1:62445/qveTu-fAfNk=/
[   +1 ms] Caching compiled dill
[  +53 ms] Connecting to service protocol: http://127.0.0.1:62445/qveTu-fAfNk=/
[        ] ����ʱ�� 00:00:34.69
[  +44 ms] Building Windows application... (completed in 39.2s)
[   +2 ms] √ Built build\windows\x64\runner\Debug\walang.exe
[ +193 ms] VM Service URL on device: http://127.0.0.1:62445/qveTu-fAfNk=/
[   +1 ms] Caching compiled dill
[  +53 ms] Connecting to service protocol: http://127.0.0.1:62445/qveTu-fAfNk=/
[   +2 ms] √ Built build\windows\x64\runner\Debug\walang.exe
[ +193 ms] VM Service URL on device: http://127.0.0.1:62445/qveTu-fAfNk=/
[   +1 ms] Caching compiled dill
[  +53 ms] Connecting to service protocol: http://127.0.0.1:62445/qveTu-fAfNk=/
[  +85 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:62445/qveTu-fAfNk=/.
[ +193 ms] VM Service URL on device: http://127.0.0.1:62445/qveTu-fAfNk=/
[   +1 ms] Caching compiled dill
[  +53 ms] Connecting to service protocol: http://127.0.0.1:62445/qveTu-fAfNk=/
[  +85 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:62445/qveTu-fAfNk=/.
[   +1 ms] Caching compiled dill
[  +53 ms] Connecting to service protocol: http://127.0.0.1:62445/qveTu-fAfNk=/
[  +85 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:62445/qveTu-fAfNk=/.
[  +85 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:62445/qveTu-fAfNk=/.
[  +35 ms] DDS is listening at http://127.0.0.1:62449/SYd_TrI-y_w=/.
[  +35 ms] DDS is listening at http://127.0.0.1:62449/SYd_TrI-y_w=/.
[  +59 ms] Successfully connected to service protocol: http://127.0.0.1:62445/qveTu-fAfNk=/
[  +59 ms] Successfully connected to service protocol: http://127.0.0.1:62445/qveTu-fAfNk=/
[  +14 ms] DevFS: Creating new filesystem on the device (null)
[  +14 ms] DevFS: Created new filesystem on the device (file:///C:/Users/Admin/AppData/Local/Temp/walang5c7ee13e/walang/)
[   +3 ms] Updating assets
[  +14 ms] DevFS: Creating new filesystem on the device (null)
[  +14 ms] DevFS: Created new filesystem on the device (file:///C:/Users/Admin/AppData/Local/Temp/walang5c7ee13e/walang/)
[   +3 ms] Updating assets
[   +3 ms] Updating assets
[ +264 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466.
[   +2 ms] Syncing files to device Windows...
[   +1 ms] Compiling dart to kernel with 0 updated files
[   +1 ms] Compiling dart to kernel with 0 updated files
[        ] Processing bundle.
[        ] Processing bundle.
[        ] <- recompile package:walang/main.dart 31c6ce02-de4a-44cb-bf13-2f7f8fb83b8b
[        ] <- recompile package:walang/main.dart 31c6ce02-de4a-44cb-bf13-2f7f8fb83b8b
[        ] <- 31c6ce02-de4a-44cb-bf13-2f7f8fb83b8b
[        ] <- 31c6ce02-de4a-44cb-bf13-2f7f8fb83b8b
[  +12 ms] Bundle processing done.
[ +113 ms] Updating files.
[        ] DevFS: Sync finished
[        ] Syncing files to device Windows... (completed in 130ms)
[        ] Synced 0.0MB.
[        ] Synced 0.0MB.
[        ] <- accept
[  +33 ms] Connected to _flutterView/0x26b6a7ab8e0.
[  +33 ms] Connected to _flutterView/0x26b6a7ab8e0.
[   +1 ms] Flutter run key commands.
[        ] r Hot reload. 
[        ] R Hot restart.
[        ] h List all available interactive commands.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] A Dart VM Service on Windows is available at: http://127.0.0.1:62449/SYd_TrI-y_w=/
[ +579 ms] Service protocol connection closed.
[   +2 ms] Lost connection to device.
[   +1 ms] DevFS: Deleting filesystem on the device (file:///C:/Users/Admin/AppData/Local/Temp/walang5c7ee13e/walang/)
[ +266 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed

[   +2 ms] "flutter run" took 46,099ms.
[ +310 ms] ensureAnalyticsSent: 252ms
[        ] Running 1 shutdown hook
[  +11 ms] Shutdown hooks complete
[  +58 ms] exiting with code 0
bladeofgod commented 2 weeks ago

类似的问题,运行代码同贴主相同,加载的是微信登录url,但是页面无法展示,并报:

Message: Exception: Invalid image data
Time: 2024-10-25 11:36:00.916568
Detail: 
#0      _futurize (dart:ui/painting.dart:6980:5)
#1      ImageDescriptor.encoded (dart:ui/painting.dart:6786:12)
#2      BoxFitImage._loadAsync (package:webf/src/painting/box_fit_image.dart:88:62)
<asynchronous suspension>
#3      MultiFrameImageStreamCompleter._handleCodecReady (package:flutter/src/painting/image_stream.dart:1005:3)
<asynchronous suspension>

我的运行环境是windows 10, debug模式。

andycall commented 2 weeks ago

main 分支修复了 pthread-win32 带来的 crash 问题,可以再试试