openwebf / webf

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

example 运行不正确,点击 open webf page 会白屏 #632

Closed September999999999 closed 4 months ago

September999999999 commented 4 months ago

Affected version

0.16.1

Flutter versions

3.22.3

No same issues found.

Steps to Reproduce

运行https://github.com/openwebf/webf/blob/main/webf/example/lib/main.dart 的代码

Code example

/*

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

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

class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return 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 createState() { return FirstPageState(); } }

class FirstPageState extends State { late WebFController controller;

@override void didChangeDependencies() { super.didChangeDependencies(); controller = WebFController( context, devToolsService: ChromeDevToolsService(), ); controller.preload(WebFBundle.fromUrl('assets:assets/bundle.html')); }

@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

我想知道webf example正常运行的效果

Actual results

img_v3_02ct_15b21d92-b14b-4d9e-b497-ded7001a413g

Tlanglord commented 4 months ago

WX20240718-181246@2x @September999999999

andycall commented 4 months ago

源码模式执行需要看下这个 https://github.com/openwebf/webf/blob/main/.github/CONTRIBUTING.md