Git Product home page Git Product logo

hadoop835 / fair Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wuba/fair

0.0 2.0 0.0 156.27 MB

A Flutter package used to update widget tree dynamically. Flutter Fair是为Flutter设计的,UI&模板动态化框架

Home Page: https://fair.58.com

License: BSD 3-Clause "New" or "Revised" License

Shell 0.15% Dart 82.68% Java 9.48% Kotlin 0.01% Ruby 0.06% Swift 0.01% Objective-C 0.82% HTML 0.03% JavaScript 6.64% CMake 0.03% C 0.02% C++ 0.07%

fair's Introduction

social preview

pub github doc license build Gitter

简体中文|English


Fair是为Flutter设计的动态化框架,通过Fair Compiler工具对原生Dart源文件的自动转化,使项目获得动态更新Widget Tree和State的能力。 Fair is a dynamic framework designed for Flutter, which enables projects to dynamically update Widget Tree and State through the automatic conversion of native Dart source files through the Fair Compiler tool.

在线文档:https://fair.58.com/

Fair的UI渲染是无损的,可以做到像素级别的还原,看一张转义Best Flutter UI Templates部分页面后的效果:

best-ui-template

使用的工程来自 https://github.com/mitesh77/Best-Flutter-UI-Templates

🏛Architecture

fair architecture

🚀 Running

为了方便接入&体验Fair框架,请确认你的Flutter运行环境,可以根据实际情况切换版本。目前支持版本(如遇问题,Issue反馈):

Flutter版本 Dart版本 CI
Flutter 2.0.6 Dart 2.12.3 v2.0.6
Flutter 1.22.6 Dart 2.10.5 v1.22.5
Flutter 1.22.4 Dart 2.10.4 v1.22.5
Flutter 1.20.4 Dart 2.9.2 v1.20.4
Flutter 1.17.3 Dart 2.8.4 v1.17.3
Flutter 1.12.13+hotfix.9 Dart 2.7.2 v1.12.13
# Switch to another stable flutter version
#dependency_overrides:
#  fair_version:
#    path: ../../fair_version/flutter_2_0_6

https://flutter.dev/docs/development/tools/sdk/releases?tab=macos

注意:由于部分版本flutter构建脚本存在巨大变化,会导致同一个模板工程无法同时运行在不同版本。

Fair的example位于fair/example目录,同时也附带了一些社区demo并转为fair动态化形式,工程位于samples目录下,克隆后直接build对应仓库即可即可。

samples
├── adobe_xd // adobe_xd插件demo, xd插件可以从设计稿直接导出flutter代码
├── best_flutter_ui_templates // 一个UI很漂亮的Flutter模板项目
└── my_app  // 经典的Flutter Hello World
    ├── README.md
    ├── android
    ├── assets
    ├── build
    ├── ios
    ├── lib
    ├── my_app.iml
    ├── pubspec.lock
    ├── pubspec.yaml
    ├── test
    └── web

更多接入操作请参考 https://fair.58.com/

  • fair https://pub.dev/packages/fair
  • compiler https://pub.dev/packages/fair_compiler
  • annotation https://pub.dev/packages/fair_annotation
  • version https://pub.dev/packages/fair_version

📎相关介绍

🕰2020&2021 Roadmap

  • 开源准备 2020
  • Bug修复
    • Github issue处理✅
  • 维护迭代 2021
    • Framework适配优化✅
    • 局部刷新支持 ✅
    • 状态库支持Provider ✅
    • 独立cli工具
    • 转化优质Demo ✅
    • 动画支持的形式
    • Flutter Favorite Package支持 ✅
    • 其他Top UI Package支持
    • 逻辑组件优化 ✅
    • CI流程✅
    • 社区插件贡献方式
    • 支持逻辑运算 ✅
    • 默认支持网络、权限选择和图片选择插件 ✅
    • 支持第三方插件在逻辑运算中的扩展 ✅
    • 支持布局build方法的子方法拆封 ✅
    • 支持布局和逻辑的混编 ✅
    • 转换工具开源 ✅

⚠️Unsupported Features

由于dart语法解析工作量奇大,会有部分语法和特殊使用方式的限制。 下面是一些,不支持特性&已知问题:

  • 链式点语法,如:Colors.black.withOpacity(0.59),Colors.xxx本身是支持的,但是再次转换透明的则不支持
  • 类的继承不支持 查阅更多不支持内容,请移步至Gitter

🔧Contributing

通过Issue提交问题,贡献代码走Pull Request,管理员将对代码进行审核。

对Fair感兴趣的小伙伴,可以加入交流群。技术咨询、讨论,请移步至Gitter

微信 美事(内部)
wechat meishi

微信入群:请先添加58技术小秘书为好友,备注fair,小秘书邀请进群。

🧯FAQ

自查步骤(新手必读)

  1. 核对flutter版本与readme说明,确认该版本已被Fair支持
  2. 核查version分支版本于flutter一致,且等同于第一步版本号
  3. 如果尚未看过文档,请先运行自带的sample,能跑起来再接入app
  4. 遇到编译错误,请查看终端日志,过滤fair关键词
  5. 到github提issue,或gitter。留档/解决,并提供flutter环境信息flutter doctor --verbose

  • 如何调试fairc 和 dart2js?

在compiler build工具,内部使用的是fairc和dart2js的AOT版本。打包AOT请使用dart compile aot-snapshot **.dart

  • 为什么没有bin产物?

bin为可选的flatbuffer产物,fair 2期开源了 fairc和dart2js编译转换工具。

  • 执行flutter pub run build_runner build后没有产物?

请根据适配要求,核查flutter,dart版本

  • 执行flutter pub run build_runner build后,提示编译错误信息?

根据错误日志,有几种情况:1.原代码中存在逻辑表达式,语法解析不通过,尝试剥离逻辑为module;2..dart_tool文件权限问题,请删除后重试

LICENSE

Fair项目基于BSD协议开源。我们使用的更多依赖库详见pubspec.yaml

感谢UXD的Kaibin老师提供设计支持

fair's People

Contributors

avenwu avatar bujiee avatar linleyang avatar windkc avatar

Watchers

 avatar  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.