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),
));
}
}
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