当前位置:网站首页>Flutter dynamic | fair 2.5.0 new version features
Flutter dynamic | fair 2.5.0 new version features
2022-07-03 13:34:00 【58 Technology】
Fair2.0 project
● Project name :Fair 2.0
● Github Address :https://github.com/wuba/fair
● Project brief introduction :Fair Is for Flutter Dynamic framework of design , Can pass Fair Compiler Tool pair Dart Conversion of source files , Make the project dynamically updated Widget The ability of .Fair 2.0 To solve the problem Fair 1.0 Version of “ Logic dynamic ” Lack of ability .
Fair New version features 2.5.0
Fair 2.5.0 The version is fully adapted Flutter 2.8.x All versions .
Update time :2022.05.31
Version features
Fair
adapter Flutter SDK 2.8.0、2.8.1
Dart2JS Support parsing singleton
Add grammar sugar Sugar.switchCase、Sugar.colorsWithOpacity、Sugar.convertToString etc.
demo
Comprehensive optimization example structure , upgrade example Experience , More suitable for beginners .
In the source code , newly added example engineering , For providing Fair API The standard usage of .example Project location :
fair/example
contributor
Instructions for new functions
Dart2JS Support parsing singleton
class PageSingleton {
factory PageSingleton() =>_getInstance();
static PageSingleton get instance => _getInstance();
static PageSingleton _instance;
PageSingleton._internal();
static PageSingleton _getInstance() {
if (_instance == null) {
_instance = new PageSingleton._internal();
}
return _instance;
}
}
import 'package:fair/fair.dart';
import './PageSingleton.dart';
import './Person.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
()
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.data}) : super(key: key) {
}
dynamic data;
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
()
var fairProps;
static int _example;
/// Use single example
PageSingleton one = PageSingleton.instance;
PageSingleton two = PageSingleton.instance;
Person person = new Person();
int _counter = 0;
var _title;
var _title1 = "PageSingleton instance";
var _title2 = "one == null";
var _title3 = "person.age";
var _title4 = "person.name";
void onLoad() {
_title = fairProps['title'];
}
void initState() {
super.initState();
fairProps = widget.data;
onLoad();
}
void _incrementCounter() {
setState(() {
_counter++;
_title1 = (one == two) ? "one = two is true" : "one = two is false";
_title2 = (one == null) ? "one = null is true" : "one = null is false";
_title3 = "person.age = ${person.getAge}";
_title4 = "person.age = ${person.getName}";
_example = 1;
});
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(_title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text('$_title1'),
Text('$_title2'),
Text('$_title3'),
Text('$_title4'),
Text('$_example'),
Text('$_counter',
style: TextStyle(
fontSize: 40, color: Color(0xffeb4237), wordSpacing: 0)),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
);
}
}
Sugar.switchCase
Sugar.switchCase(_value, [
SugarSwitchCaseObj(reValue: Text("2-ValueTitle"), sugarCase: 2),
SugarSwitchCaseObj(reValue: Text("3-ValueTitle"), sugarCase: 3),
SugarSwitchCaseObj(reValue: Text("4-ValueTitle"), sugarCase: 4)
], Text("default-ValueTitle"))
Sugar.colorsWithOpacity()
Sugar.colorsWithOpacity(Colors.blue, 0.5)
Sugar.convertToString()
Sugar.convertToString(orginalValue: 0.4444)
Short term plan
adapter Flutter 2.10.x Relevant version
Expand and optimize grammar sugar
increase idea lint plug-in unit , Assist in finding and modifying problems in the development process
Fair Technology Salon , expect 6 At the end of the month, it will be broadcast live on major live broadcasting platforms
Fair laboratory
Hot update platform
Online dynamic
We will also try to use low code
In the form of , Based on online tools , Conduct online Fair Dynamic editing , Improve the overall development efficiency .
Fair brief introduction
Fair Is for Flutter Dynamic framework of design , adopt Fair Compiler Tools on native Dart Automatic conversion of source files , Make the project dynamically updated Widget Tree and State The ability of .
establish Fair Our goal is to support non distribution (Android、iOS、Web) Under the circumstances , Through business bundle and JS Issue the implementation update , In a way similar to React Native. And Flutter Fair After the integration , You can quickly publish new pages , Without waiting for the next release date of the app .Fair Provided with standard Widget, It can be used as a new dynamic page or as an existing page Flutter Part of the page , Such as operation layout / Style modification , Full page replacement , Partial replacement can be used .
Fair Layered architecture
Fair The structure is made up of 2 Part of it is made up of ,1 For the same Kraken and MXFlutter Of App Running environment ,2 by Fair Compiler hold Dart The source file is compiled to DSL and JS Tools for dynamic products . The structure is as follows :
Fair In the frame Widget structure 、 Data binding and basic logic (if、List Map…) The treatment is all in Dart Domain complete , Leave to JS There are only basic data types on the side 、 Operations and method call processing .
Fast access
1. Add dependency
It is recommended that fair Download to local , adopt path Relative path dependency . hypothesis fair The project is located under the same folder as your own project :
# add Fair dependency
dependencies:
fair: 2.3.0
# add compiler dependency
dev_dependencies:
build_runner: ^2.0.0
fair_compiler:
path: ../fair/compiler
# switch "fair_version" according to the local Flutter SDK version
dependency_overrides:
2.0.6+1 :
By switching flutter_version Version compatibility . for example , Switch this machine to flutter 2.0.6 after ,Fair Synchronous switching is required
# switch to another stable flutter version
dependency_overrides:
fair_version:
path: ../fair/flutter_version/flutter_2_0_6
2. Use Fair
See practice as App The root node , If it is not adopted globally, it can also be used as the root node of the sub page
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({})}),
),
);
Each dynamic component consists of a FairWidget Express .
FairWidget(
name: 'DynamicWidget',
path: 'assets/bundle/lib_src_page_dynamic_widget.fair.json',
data: {"fairProps": json.encode({})}),
Fair Information
Fair Information
Flutter Dynamic framework Fair The document is online & Open source countdown
Flutter Dynamic framework Fair Design and thinking of
Fair Design and implementation of logic dynamic architecture
Fair Distribution products - Layout DSL The principle of generation
2022 planning
Master version plan
null-safe Versioning support , expect 4 month 22 Day online
Flutter 2.8.0 Version adaptation , expect 5 Online in mid month
Flutter 2.10.0 Version adaptation , expect 6 On line at the beginning of the month
IDE Syntax detection and prompt plug-in
Rich grammar 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
Action edit
Code editing
Component editor
Page editing
Engineering editor
Flutter Results the preview
Fair DSL preview
Welcome to contribute
Fair Official website :https://fair.58.com
adopt Issue Submission question topic , Contribution code Please submit Pull Request, The administrator will review the code .
Wechat into the group :
Please add it first 58 The technical secretary is a good friend
remarks fair Then the little secretary invited him to join the Group
This article is from WeChat official account. - 58 technology (architects_58).
If there is any infringement , Please contact the [email protected] Delete .
Participation of this paper “OSC Source creation plan ”, You are welcome to join us , share .
边栏推荐
- mysql更新时条件为一查询
- [today in history] July 3: ergonomic standards act; The birth of pioneers in the field of consumer electronics; Ubisoft releases uplay
- DQL basic query
- IBEM 数学公式检测数据集
- Swiftui development experience: the five most powerful principles that a programmer needs to master
- Open PHP error prompt under Ubuntu 14.04
- Flink SQL knows why (XIV): the way to optimize the performance of dimension table join (Part 1) with source code
- 双链笔记 RemNote 综合评测:快速输入、PDF 阅读、间隔重复/记忆
- 【历史上的今天】7 月 3 日:人体工程学标准法案;消费电子领域先驱诞生;育碧发布 Uplay
- untiy世界边缘的物体阴影闪动,靠近远点的物体阴影正常
猜你喜欢
DQL basic query
Libuv Library - Design Overview (Chinese version)
今日睡眠质量记录77分
[email protected] chianxin: Perspective of Russian Ukrainian cyber war - Security confrontation and sanctions g"/>
Start signing up CCF C ³- [email protected] chianxin: Perspective of Russian Ukrainian cyber war - Security confrontation and sanctions g
AI 考高数得分 81,网友:AI 模型也免不了“内卷”!
User and group command exercises
Detailed explanation of multithreading
Flink SQL knows why (12): is it difficult to join streams? (top)
Resolved (error in viewing data information in machine learning) attributeerror: target_ names
Kivy tutorial how to automatically load kV files
随机推荐
Convolution emotion analysis task4
R language uses the data function to obtain the sample datasets available in the current R environment: obtain all the sample datasets in the datasets package, obtain the datasets of all packages, and
Logback log framework
AI scores 81 in high scores. Netizens: AI model can't avoid "internal examination"!
【被动收入如何挣个一百万】
Road construction issues
logback日志的整理
Introduction to the implementation principle of rxjs observable filter operator
研发团队资源成本优化实践
Open PHP error prompt under Ubuntu 14.04
The shadow of the object at the edge of the untiy world flickers, and the shadow of the object near the far point is normal
Servlet
18W word Flink SQL God Road manual, born in the sky
Anan's doubts
SwiftUI 开发经验之作为一名程序员需要掌握的五个最有力的原则
双链笔记 RemNote 综合评测:快速输入、PDF 阅读、间隔重复/记忆
双链笔记 RemNote 综合评测:快速输入、PDF 阅读、间隔重复/记忆
软件测试工作那么难找,只有外包offer,我该去么?
Mobile phones and computers can be used, whole people, spoof code connections, "won't you Baidu for a while" teach you to use Baidu
php:&nbsp; The document cannot be displayed in Chinese