Code Monkey home page Code Monkey logo

webf's Introduction

WebF (Web on Flutter) is a W3C standards compliant Web rendering engine based on Flutter, it can run web applications on Flutter natively.

  • W3C Standards Compliant: WebF use HTML/CSS and JavaScript to render contents on flutter. It can achieve 100% consistency with browser rendering.
  • Front-End Framework Supports: WebF is W3C standards compliant, so it can be used by many Front-End frameworks, such as React, Vue.
  • Expand your Web app with Flutter: WebF is fully customizable. You can define a customized HTML element with Flutter Widget and use it in your application. Or add a JavaScript API for any Dart library from <pub.dev> registry.
  • Web Development Experience: WebF supports inspecting DOM structure, CSS styles and debugging JavaScript with Chrome DevTools, just like the web development experience of your browser.
  • Write Once, Run Anywhere: With the power of WebF, You can write your web application and run it on any device flutter supports, and you can still run your apps in Node.js and Web browsers with the same codebase.

Check if a Web API or CSS is available in WebF

Check this yaml

The Relationship between WebF and Kraken

The WebF project is a community support version of Alibaba's Kraken Project. On May 10, 2022, The Kraken Dev Team was dismissed and the project itself are discontinued.

The core developer and architector: andycall, who is from the original Kraken Team. Leave the Alibaba Group and launch this project, to keep following the original ambition of the Kraken project.

For more details(zh_CN): https://www.zhihu.com/question/534811524/answer/2595510449

Join the community (Beta)

Discord Shield

Version requirement

WebF Flutter
>= 0.12.0 < 0.14.0 3.0.5
>= 0.14.0 3.3.10 and 3.7.3

How to use

All front-end frameworks based on the WhatWG DOM standard are supported; this time, we are using Vue as an example.

1. Use vue-cli to generate your front-end project

ES6 modules are not supported yet, so Vite is not supported.

vue create app
cd app
npm run serve

And the Vue development server will be hosted at http://<yourip>:8080/.

2. Add webf as a dependency for your flutter apps.

packages.yaml

dependencies:
  webf: <lastest version>
  webf_websocket: <lastest version>

import

import 'package:webf/webf.dart';
import 'package:webf_websocket/webf_websocket.dart';

init

void main() {
  WebFWebSocket.initialize();
  runApp(MyApp());
}

3. Add the WebF widget to run your web applications.

@override
Widget build(BuildContext context) {
  final MediaQueryData queryData = MediaQuery.of(context);
  final Size viewportSize = queryData.size;

  return Scaffold(
      body: Center(
    child: Column(
      children: [
        WebF(
          devToolsService: ChromeDevToolsService(), // Enable Chrome DevTools Services
          viewportWidth: viewportSize.width - queryData.padding.horizontal, // Adjust the viewportWidth
          viewportHeight: viewportSize.height - queryData.padding.vertical, // Adjust the viewportHeight
          bundle: WebFBundle.fromUrl('http://<yourip>:8080/'), // The page entry point
        ),
      ],
    ),
  ));
}

4. Run

flutter run

How it works

WebF provides a rendering engine which follows the W3C standards like web browsers do. It can render HTML/CSS and execute JavaScript. It's built on top of the flutter rendering pipelines and implements its own layout and painting algorithms.

With WebF, Web Apps and Flutter Apps share the same rendering context. It means that you can use Flutter Widgets to define your HTML elements and embed your Web App as a Flutter Widget in your flutter apps.

๐Ÿ‘ Contributing PRs Welcome

By contributing to WebF, you agree that your contributions will be licensed under its Apache-2.0 License.

Read our contributing guide and let's build a better WebF project together.

Thank you to all the people who already contributed to OpenWebF and OpenKraken!

Copyright (c) 2022-present, The OpenWebF authors.

webf's People

Contributors

andycall avatar wssgcg1213 avatar temper357 avatar answershuto avatar yuanyan avatar devjiangzhou avatar pba-cra avatar cnryb avatar yifei8 avatar eroszy avatar xuzhongpeng avatar suyulin avatar xgheaven avatar anjihang avatar airingursb avatar youchant avatar zpferyb avatar bainian avatar whn9527 avatar tiye avatar zhuimengfb avatar lehemyang avatar hydra1983 avatar lilong7676 avatar diyism avatar liuzitong123a avatar ricardochen1996 avatar qingyangmoke avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.