• Stars
    star
    2,598
  • Rank 17,638 (Top 0.4 %)
  • Language
    Dart
  • License
    BSD 3-Clause "New...
  • Created almost 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Flutter package used to update widget tree dynamically. Fair提供一整套Flutter动态化解决方案

social preview

pub github doc license build Gitter

简体中文|English


Fair is a dynamic framework designed for Flutter. Through the automatic conversion of native Dart source files by the Fair Compiler tool, the project can obtain the ability to dynamically update the Widget Tree and State.

The goal of creating Fair is to support updates through business bundles and JS distribution without the release of versions (Android, iOS, Web), similar to React Native. After integrating with Flutter Fair, you can quickly publish new pages without waiting for your app's next release date. Fair provides standard widgets, which can be used as a new dynamic page or as part of an existing Flutter page, such as typography/style modification of operation bits, full page replacement, partial replacement, etc.

Fair's UI rendering is lossless and can be restored at the pixel level. Take a look at the effect of escaping some pages of Best Flutter UI Templates:

best-ui-template

The project used is from https://github.com/mitesh77/Best-Flutter-UI-Templates
location:/example/lib/best_flutter_ui

🏛Architecture

fair architecture

🚀 Running

Use Flutter Fair require few steps.

step1:download fair project source code

It is recommended to download fair to the local and dependencies on the relative path.

The download method is as follows:

git clone https://github.com/wuba/fair.git

step2:Add dependency inside pubspec.yaml

Assuming that the fair project and your own project are in the same folder:

# add Fair dependency
dependencies:
  fair: 3.2.1

# add build_runner and compiler dependency
dev_dependencies:
  build_runner: ^2.0.0
  fair_compiler: ^1.7.0
 
# switch "fair_version" according to the local Flutter SDK version
# Flutter SDK 3.7.x(3.7.0、3.7.1、3.7.2、3.7.3、3.7.4、3.7.5、3.7.6、3.7.7、3.7.8、3.7.9、3.7.10) -> flutter_3_7_0
# Flutter SDK 3.3.x(3.3.0、3.3.1、3.3.2、3.3.3、3.3.4、3.3.5、3.3.6、3.3.7、3.3.8、3.3.9、3.3.10) -> flutter_3_3_0
# Flutter SDK 3.0.x(3.0.0、3.0.1、3.0.2、3.0.3、3.0.4、3.0.5) -> flutter_3_0_0
# Flutter SDK 2.10.x(2.10.0、2.10.1、2.10.2、2.10.3) -> flutter_2_10_0
# Flutter SDK 2.8.x(2.8.0、2.8.1) -> flutter_2_8_0
# Flutter SDK 2.5.x(2.5.0、2.5.1、2.5.2、2.5.3) -> flutter_2_5_0
# Flutter SDK 2.0.6 -> flutter_2_0_6
# Flutter SDK 1.22.6 -> flutter_1_22_6
dependency_overrides:
  fair_version:
    path: ../fair/flutter_version/flutter_3_7_0

step3:Wrap your app with FairApp Widget

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  FairApp.runApplication(
    _getApp(),
    plugins: {
    },
  );
}

dynamic _getApp() => FairApp(
  modules: {
  },
  delegate: {
  },
  child: MaterialApp(
    home: FairWidget(
            name: 'DynamicWidget',
            path: 'assets/bundle/lib_src_page_dynamic_widget.fair.json',
            data: {"fairProps": json.encode({})}),
  ),
);

step4:Import a dynamic widget as FairWidget

FairWidget(
  name: 'DynamicWidget',
  path: 'assets/bundle/lib_src_page_dynamic_widget.fair.json',
  data: {"fairProps": json.encode({})}),

DevTools

fair development tools

Dart Commandline Tool faircli

create fair project

faircli install

dart pub global activate faircli

create fair dynamic project

faircli create -n dynamic_project_name

create fair carrier project

faircli create -k carrier -n carrier_project_name

IDEA Plugin FairTemplate

Page/Component Template Code

DevTools flow chart

fair tools

DevTools demo

After using faircli to configure the local hot update service, open the developer options on the mobile device, select the local mode, enter the ip of the development machine, then preview fair dynamic effect

For more details, please refer to fair_tools

Fair-Online Platform

Fair-Online is an integrated cloud development platform for Flutter developers, from online development of Flutter, to real-time compilation and preview, packaging and publishing, and dynamic release of end-side updates, to realize the dynamic online Flutter.

Developers do not need to configure the Flutter development environment, develop and debug code online, compile and preview in real time, and what you see is what you get. Combined with the Flutter dynamic framework Fair and the hot update platform FairPushy created by the 58 open source team, Flutter online dynamics are realized.

Online experience URL: Fair-Online Platform

For more details, please refer to fair_online

Documentation

For more details, please refer to https://fair.58.com

Tools

Fair Cli: Fair_CLI
IEDA plugin: jetbrains_plugin_fair_template
Hot update platform: FAIR PUSHY

versions

3.2.1

updateDate:2023.04.13

  • Fixed some issues.

3.2.0

updateDate:2023.04.12

  • Adjust the order of dispose calls, not above the tree, subsequent operations stop
  • Add generic FairPlugin js and dart code, reuse the same interaction logic, add example comments
  • Json parsing compatibility
  • Add exception catching and log printing when executeFunction is called with V8 engine in Android
  • Fix SliverGridDelegateWithFixedCrossAxisCount conversion error.
  • SugarMap and SugarMapEach inputs support other Sugar expressions
  • Optimize the performance of ifEqual ifEqualBool switchCase
  • Fix Domain not recognizing index and item in sugar
  • Make AOT also follow conditions before executing code
  • Fix SugarMap and SugarMapEach set input does not support other Sugar syntax
  • Abstract Domain, add IndexDomain, MapEachDomain, support nested Domains
  • New FunctionDomain generic Domain, generate corresponding parameters for function callbacks for FunctionDomain to use.
  • Added NullableIndexedWidgetBuilder, IndexedWidgetBuilder, WidgetBuilder, TransitionBuilder common Sugar support
  • Some known issues fixed

3.1.0

updateDate:2023.03.14

  • Upgrade analyzer library to 5.5.0;
  • Dart function to JS supports parameter passing;
  • JS Object value compatibility;
  • Remove kotlin dependencies from fair/android;
  • Add custom parsing for IconData;
  • The generation of optional positional parameters is modified to obtain pa;
  • Fixed missing OptionalPositional default values;
  • Remove the generation time from the generation.fair. dart comment;
  • Added the ignore unnecessary_import operation;
  • Fixed incorrect assignment of Sugar.switchCase key and defaultValue;
  • binding was changed to SplayTreeMap to increase search efficiency, especially for lists, where duplicate tags are searched for a short time;
  • Exposing specialBinding so that users can override a value;
  • When the provider is added to the _binding, the Settings set by the user prevail for quick modification;
  • Fixed the loadCoreJs package splicing problem;
  • Reduced minSdkVersion to 16;
  • runApplication supports specifying the package in which the JS resides;
  • Fixed error in calling context in the _reload method.

3.0.0

updateDate:2022.11.17

  • Fix class constructor parsing exception.
  • Fair Compatible Web.
  • Bindmap logic optimization.

2.8.1

updateDate:2022.11.01

  • Fixed:CustomScrollView reference external function builder bug.

2.8.0

updateDate:2022.10.21

  • Add support of Flutter SDK 3.3.0+.
  • Add Sugar:Sugar.isNestedScrollViewHeaderSliversBuilder、Sugar.isButtonStyle、Sugar.isDuration、Sugar.popMenuButton、Sugar.sliverChildBuilderDelegate、Sugar.sliverGridDelegateWithFixedCrossAxisCount.
  • Fixed some bugs.

2.7.0

updateDate:2022.08.10

  • Add support of Flutter SDK 3.0.0、3.0.1、3.0.2、3.0.3、3.0.4、3.0.5.
  • Fixed some bugs.

Fair

  • Fair supports loading bundle files on the phone disk path;
  • Adapt to Flutter SDK 2.10.0, 2.10.1, 2.10.2, 2.10.3;
  • Dart2JS supports parsing static methods;
  • When running, the page error message prompts optimization;
  • Syntactic sugar supports parsing Model data.

2.6.0

updateDate:2022.07.05

Fair

  • Fair supports loading bundle files on the phone disk path;
  • Adapt to Flutter SDK 2.10.0, 2.10.1, 2.10.2, 2.10.3;
  • Dart2JS supports parsing static methods;
  • When running, the page error message prompts optimization;
  • Syntactic sugar supports parsing Model data.

2.5.0

updateDate:2022.05.31

Fair

Adapt to flutter SDK 2.8.0, 2.8.1
Dart2js supports parsing singletons
New syntax Sugar.switchCase、Sugar.colorsWithOpacity、Sugar.convertToString, etc

example

Comprehensively optimize the example structure and upgrade the example experience, which is more suitable for beginners.

In the source code, an example project is added to provide the standard usage of fair API.

example location:fair/example

v2.4.1

updateDate:2022.05.12

Fix FairLogger import problem.
Upgrade Analyzer to 2.3.0.

v2.4.0

updateDate:2022.04.26

FlatBuffers supports generating bin files in a null safe environment

v2.3.0

updateDate: 2022.04.22

Fair

supports null-safe
Adapt to Flutter SDK 2.5.0, 2.5.1, 2.5.2, 2.5.3 and other versions

demo

Upgrade the outdated demo in the sample project
Supplement the iOS runtime environment in the sample project

🕰2022 Roadmap

  • Major release plan
    • null-safe version support, expected to be launched on April 22
    • Flutter 2.8.0 version adaptation, expected to be launched in mid-May
    • Flutter 2.10.0 version adaptation, is expected to be launched in early June
    • Flutter 3.0 version adaptation
    • IDE syntax detection and hint plugin
    • Rich syntactic sugar
  • Hot update platform
    • Dart Server project construction
    • Flutter Web project construction
    • Patch/resource management
    • Project management
    • Mobile Update&Download
  • Online dynamic
    • Flutter Web project construction
    • Dart Server project construction
    • ActionEdit
    • Code editing
    • Component editing
    • Page editing
    • Engineering editor
    • Flutter effect preview
    • Fair DSL preview
  • IDE plug-in
    • Fair project generation
    • Fair template generation
    • Fair syntax detection

📱Accessed APPs


58阿姨

移动经纪人

安居拍房

神奇保

58商办通

58商家版

中华英才网

Contributors

Thanks goes to these wonderful people (emoji key):


gongpengyang

💻

qixu

💻

陈有余

💻

yangyang

💻

wan

💻

bujie

💻

Kc

💻

Wu

💻 📖

Penta

💻 📖

haijun

💻 📖

waynesonic

💻

paozhuanyinyu

💻

alzzzz

💻 📖

xiangwc

💻

WangYk

💻

SunWei

💻

单鹏涛

💻

lswc225

💻

Goofy

💻

itzhaoqian

💻

Sunlight Xie

💻

lhdycxgghb

💻

Prome

💻

zmtzawqlp

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

👏🏻Supporters

Stargazers repo roster for @wuba/fair

Forkers repo roster for @wuba/fair

🔧Build together

Submit issues through Issue, contribute code through Pull Request, and the administrator will review the code.

Friends who are interested in Fair can join the exchange group. For technical consultation and discussion, please go to

WeChat secretary WeChat group
wechat wechat_group

License

Copyright (C) 2005-present, 58.com. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the following
  disclaimer in the documentation and/or other materials provided
  with the distribution.
* Neither the name of 58.com nor the names of its
  contributors may be used to endorse or promote products derived
  from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

More Repositories

1

WBBlades

Mach-O based ObjC & Swift useless classes, useless protocols, useless resources detection, packet size analysis, point-to-point crash resolution.基于Mach-O的ObjC & Swift无用类、无用协议、无用资源检测,包大小分析,点对点崩溃解析。
Objective-C
1,530
star
2

Picasso

一款UI自动生成代码插件,提供UI自动生成代码全流程解决方案。
TypeScript
1,126
star
3

react-native-echarts

📈 React Native ECharts Library: An awesome charting library for React Native, built upon Apache ECharts and leveraging react-native-svg and react-native-skia. Offers significantly better performance compared to WebView-based solutions.
TypeScript
729
star
4

Antenna

Antenna是58同城安全团队打造的一款辅助安全从业人员验证网络中多种漏洞是否存在以及可利用性的工具。其基于带外应用安全测试(OAST)通过任务的形式,将不同漏洞场景检测能力通过插件的形式进行集合,通过与目标进行out-bind的数据通信方式进行辅助检测。
JavaScript
719
star
5

Oceanus

58同城数据库中间件
Java
550
star
6

dl_inference

通用深度学习推理工具,可在生产环境中快速上线由TensorFlow、PyTorch、Caffe框架训练出的深度学习模型。
Java
405
star
7

Taro-Mortgage-Calculator

首个 Taro 3 多端统一实例 - 支持 React Native,Weapp,H5。
TypeScript
371
star
8

qa_match

A simple effective ToolKit for short text matching
Python
328
star
9

FairPushy

FairPushy 基于Dart三端一体化动态更新平台,为Flutter Fair设计的动态化框架提供动态分发能力
Dart
268
star
10

taro-playground

The Taro Playground App is a cross-platform application developed using Taro, to help developers develop and debug Taro applications.
TypeScript
253
star
11

metro-code-split

Further split the React Native code based on Metro build to improve performance, providing `Dll` and `Dynamic Imports` features
JavaScript
203
star
12

WPaxos

A production-grade java implementation of paxos consensus algorithm
Java
195
star
13

WLock

A high-reliable, high-throughput distributed lock service based on the consensus algorithm component WPaxos.
Java
184
star
14

magpie

Magpie is a visualized platform which designed to create, develop and compile your standalone flutter module.
Dart
123
star
15

wwto

WWTO,小程序跨端迁移解决方案,低成本将微信小程序转为其他平台(百度、支付宝、头条)小程序。
JavaScript
106
star
16

Zucker

An easier way to automatically calculate the size of AAR in apk based on APP module
Python
88
star
17

LPA-Detector

Optimize and improve the Label propagation algorithm
Java
88
star
18

mp-monitor

mp-monitor脱胎于58内部前端质量监控系统“北斗”。致力于为小程序异常采集和性能统计分析提供采集方案和统一的数据指标,适配多端小程序(微信,头条,支付宝,百度,QQ,360,JD)。 如果开发者想要在自己的项目中快速搭建小程序的异常采集和性能监控数据分析。mp-monitor将能帮助用户快速采集到相关的数据用于分析和监控。
TypeScript
68
star
19

magpie_sdk

A Native-Futter hybrid development solution. Native developers do not need to install FlutterSDK. This Flutter plugin provides general capabilities such as routing management and dynamic protocol registration.
Objective-C
50
star
20

magpie_log

A visualized dynamic programming for log collection based on flutter.
Dart
48
star
21

magpie_fly

Magpie-fly is a component library produced by 58 Group, which encapsulates a variety of common components to meet the needs of developers
Dart
38
star
22

taro-visualization

TypeScript
33
star
23

json-model-validator

A flexible, lightweight JSON Data validator and formatter
TypeScript
30
star
24

wsilk

wsilk是一个辅助开发人员的代码生成框架(wsilk is a framework that assists developers to generate code)
Java
26
star
25

Taro-Code-In-React-Native

Taro React Native 参考样例。支持在 React Native 初始化的项目中引入 Taro 3 代码。
JavaScript
22
star
26

EasyAOP

EasyAOP是基于ASM实现切面通用能力的工具。EasyAOP提供的通用切面能力,可以使用配置文件方式来配置使用。(EasyAOP is a tool based on ASM to realize the general capability of AOP. General faceting capabilities provided by EasyAOP,You can use the yaml file format to configure the use of EasyAOP.)
Kotlin
22
star
27

first-meaning-paint

首次有效绘制表示当前页面最想展示给用户的元素渲染的时间点,即主元素渲染点。
JavaScript
11
star
28

FairTemplate

FairTemplate 是为Fair 开发者设计的常用基础组件库及代码模板,结合Fair 团队自研的IDE 插件,快速地搭建Fair 动态化页面,提升Fair 的开发效率。
Dart
5
star
29

ideaPlugin-MavenManager

Manage dependencies of maven project to resolve jar conflicts
Java
3
star