Skip to content

Commit 0de7a5b

Browse files
committed
Init
1 parent ad51fc4 commit 0de7a5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+344
-245
lines changed

.idea/libraries/Flutter_for_Android.xml

-9
This file was deleted.

.idea/modules.xml

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.metadata

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 0b8abb4724aa590dd0f429683339b1e045a1594d
8-
channel: unknown
7+
revision: f30b7f4db93ee747cd727df747941a28ead25ff5
8+
channel: stable
99

1010
project_type: plugin

.vscode/settings.json

-3
This file was deleted.

LICENSE

+1-28
Original file line numberDiff line numberDiff line change
@@ -1,28 +1 @@
1-
Copyright 2020 广州影子科技有限公司(Guangzhou Yingzi Technology Co,Ltd.). All rights reserved.
2-
3-
Redistribution and use in source and binary forms, with or without modification,
4-
are permitted provided that the following conditions are met:
5-
6-
* Redistributions of source code must retain the above copyright
7-
notice, this list of conditions and the following disclaimer.
8-
* Redistributions in binary form must reproduce the above
9-
copyright notice, this list of conditions and the following
10-
disclaimer in the documentation and/or other materials provided
11-
with the distribution.
12-
* Neither the name of 广州影子科技有限公司(Guangzhou Yingzi Technology Co,Ltd.). nor the names of its
13-
contributors may be used to endorse or promote products derived
14-
from this software without specific prior written permission.
15-
16-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23-
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26-
27-
The source is licensed under the BSD 3-Clause "New" or "Revised" License
28-
A permissive license similar to the BSD 2-Clause License, but with a 3rd clause that prohibits others from using the name of the project or its contributors to promote derived products without written consent.
1+
TODO: Add your license here.

README.md

+49-35
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,40 @@
11
# flutter_dynamic
2-
flutter_dynamic 是一个能动态创建Flutter应用的引擎。
2+
flutter_dynamic 是一个能动态创建Flutter应用的引擎。
3+
* [Github地址](https://github.com/Yingzi-Technology/flutter_dynamic)
4+
35
The flutter_dynamic is an engine that create flutter application dynamically .
46

57
## 目录 Table of contents
6-
* [概况](#General-info 概况)
7-
* [安装](#Install 安装)
8-
* [使用](#Get started 使用)
9-
* [联系方式](#Contact 联系)
10-
11-
## General-info 概况
12-
13-
> 有时候在产品开发的过程中需要远程动态地创建表单或更新某个表单应用,但Flutter框架不像javascript动态语言可以远程下发并动态执行脚本,也不像Android或iOS平台的java或objective c语言支持动态热更新或动态语言特性等,甚至在Flutter中限制了Dart语言的反射特性,所以基于Flutter来做动态页面就显得很有局限性。开发flutter_dynamic引擎一是为了满足产品需要远程动态创建表单应用的需求,二是借此机会探索Flutter更广泛的动态特性实现方案;目前这个引擎还处在不断完善阶段,难免会有缺陷。
14-
15-
> 本引擎主要包括以下几个方面:
16-
--提供高度类似Flutter系统的Widget类型,以满足构造UI所需的Widget库;并提供自定义Widget扩展引擎,满足开发者自定义基于本引擎解释的Widget类型;
17-
--提供variable变量解释引擎,提供类似Dart基本类型语法,满足类似变量定义、类属性定义等;
18-
--提供action方法解释引擎,提供类似Dart方法语法,满足类似方法调用;
19-
--提供code代码解释引擎,提供类似Dart关系运算、逻辑运算、控制流程等语法,满足写基本的代码逻辑;
20-
--提供event事件解释引擎,提供类似Flutter的事件处理;
21-
22-
## Install 安装
23-
#### 1. Depend on it
8+
* [General-info概况](#General-info)
9+
* [Install 安装](#Install)
10+
* [Get-started 使用](#Get-started)
11+
* [Grammar 语法](#Grammar)
12+
* [Contact 联系](#Contact)
13+
14+
## General-info
15+
16+
> 有时候在产品开发的过程中需要远程动态地创建表单或更新某个表单应用,但Flutter框架不像javascript动态语言可以远程下发并动态执行脚本,也不像Android或iOS平台的java或objective c语言支持动态热更新或动态语言特性等,甚至在Flutter中限制了Dart语言的反射特性,所以基于Flutter来做动态页面就显得很有局限性。开发flutter_dynamic引擎一是为了满足产品需要远程动态创建表单应用的需求,二是借此机会探索Flutter更广泛的动态特性实现方案;目前这个引擎还处在不断完善阶段,难免会有缺陷。
17+
In the process of product development, pages need to be dynamically created remotely. But the Flutter framework is not like the javascript dynamic language that can remotely issue and dynamically execute scripts, nor is it like the Android or iOS platform's java or objective c language that supports dynamic hot updates or dynamic language features, and even limits the reflection of the Dart language in Flutter Features, so dynamic pages based on Flutter are very limited. The flutter_dynamic engine was developed to meet the needs of products that need to dynamically create form applications remotely, and the second is to take this opportunity to explore the implementation of Flutter's broader dynamic characteristics; currently this engine is still in the stage of continuous improvement, and it is inevitable that there will be defects.
18+
19+
> 本引擎主要包括以下几个方面:
20+
--提供高度类似Flutter系统的Widget类型,以满足构造UI所需的Widget库;并提供自定义Widget扩展引擎,满足开发者自定义基于本引擎解释的Widget类型;
21+
--提供variable变量解释引擎,提供类似Dart基本类型语法,满足类似变量定义、类属性定义等;
22+
--提供action方法解释引擎,提供类似Dart方法语法,满足类似方法调用;
23+
--提供code代码解释引擎,提供类似Dart关系运算、逻辑运算、控制流程等语法,满足写基本的代码逻辑;
24+
--提供event事件解释引擎,提供类似Flutter的事件处理;
25+
This engine mainly includes the following aspects:
26+
--Provide a Widget type that is highly similar to the Flutter system to meet the Widget library required to construct a UI; and provide a custom Widget extension engine to meet the needs of developers to customize the Widget type based on this engine's interpretation;
27+
--Provide variable variable interpretation engine, provide basic type syntax similar to Dart, satisfy similar variable definition, class attribute definition, etc.;
28+
--Provide action method interpretation engine, provide similar Dart method syntax, satisfy similar method calls;
29+
--Provide code code interpretation engine, provide similar Dart relational operations, logical operations, control flow and other grammars to satisfy basic code logic;
30+
--Provide event event interpretation engine, provide event processing similar to Flutter;
31+
32+
## Install
33+
#### step 1. Depend on it
2434
Add this to your package's pubspec.yaml file:
2535
```
2636
dependencies:
27-
yingzi_flutter_dynamicpage:
37+
yz_flutter_dynamic:
2838
git:
2939
url: https://github.com/fisherjoe/flutter_dynamic.git
3040
ref: master
@@ -33,30 +43,31 @@ Or
3343
Download or clone the code to the local:
3444
```
3545
dependencies:
36-
yingzi_flutter_dynamicpage:
46+
yz_flutter_dynamic:
3747
path: your/code/path
3848
```
3949
Or
4050
Do as example of code.
4151

42-
#### 2. Use it
52+
#### step 2. Use it
4353

4454
Use as common flutter plugin in flutter project.
4555

46-
#### 3. Import it
56+
#### step 3. Import it
4757
Now in your Flutter code, you can use:
4858
```dart
49-
import 'package:yingzi_flutter_dynamicpage/yz_dynamicpage.dart';
59+
import 'package:yz_flutter_dynamic/main.dart';
5060
```
5161

52-
## Get started 使用
53-
> flutter_dynamic是完全开源的,在代码中的example里也已经具有完整的示例,以下针对核心的流程一一说明:
62+
## Get-started
63+
> flutter_dynamic是完全开源的,在代码中的example里也已经具有完整的示例,以下针对核心的流程说明:
64+
flutter_dynamic is completely open source, and there are complete examples in the example in the code. The following is a description of the core process:
5465

5566
#### Hello world
5667

5768
```dart
5869
import 'package:flutter/material.dart';
59-
import 'package:yingzi_flutter_dynamicpage/yz_dynamicpage.dart';
70+
import 'package:yz_flutter_dynamic/main.dart';
6071
6172
class Helloworld extends StatefulWidget {
6273
@override
@@ -66,7 +77,7 @@ class Helloworld extends StatefulWidget {
6677
class _HelloworldState extends State<Helloworld> {
6778
@override
6879
Widget build(BuildContext context) {
69-
return YZDynamicPage.build(
80+
return YZDynamic.build(
7081
context,
7182
hwDsl,
7283
);
@@ -76,11 +87,7 @@ class _HelloworldState extends State<Helloworld> {
7687
Map hwDsl =
7788
{
7889
"page": {
79-
"key": "",
80-
"type": "",
81-
"name": "",
82-
"presentMode": "navpage",
83-
"routeTag": "",
90+
"key": "",
8491
"rootWidget": {
8592
"xKey": "",
8693
"widgetName": "Scaffold",
@@ -120,8 +127,15 @@ Map hwDsl =
120127
};
121128
```
122129

130+
## Grammar
131+
在源代码的example里有写动态页面的伪代码语法,如图所示:
132+
In the example of the source code, there is pseudo code syntax for writing dynamic pages, as shown in the figure:
133+
134+
![Simulator Screen Shot - iPhone 12 - 2020-12-17 at 09.22.41.png](https://upload-images.jianshu.io/upload_images/3868052-917c8c2720d84fe9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/360)
135+
136+
123137
## More Document ... ...
124138
> Feel apologetic that we update the document slowly for the work time reason.
125139
126-
## Contact 联系
127-
Created by [@153768151@qq.com](https://github.com/fisherjoe) - feel free to contact me
140+
## Contact
141+
Created by [@153768151@qq.com](https://github.com/fisherjoe) - feel free to contact me

android/build.gradle

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
group 'com.example.yingzi_flutter_dynamicpage'
2-
version '1.0-SNAPSHOT'
1+
group 'com.example.yz_flutter_dynamic'
2+
version '1.0'
33

44
buildscript {
5-
ext.kotlin_version = '1.3.50'
65
repositories {
76
google()
87
jcenter()
98
}
109

1110
dependencies {
1211
classpath 'com.android.tools.build:gradle:3.5.0'
13-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1412
}
1513
}
1614

@@ -22,23 +20,14 @@ rootProject.allprojects {
2220
}
2321

2422
apply plugin: 'com.android.library'
25-
apply plugin: 'kotlin-android'
2623

2724
android {
28-
compileSdkVersion 28
25+
compileSdkVersion 29
2926

30-
sourceSets {
31-
main.java.srcDirs += 'src/main/kotlin'
32-
}
3327
defaultConfig {
3428
minSdkVersion 16
35-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3629
}
3730
lintOptions {
3831
disable 'InvalidPackage'
3932
}
4033
}
41-
42-
dependencies {
43-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
44-
}

android/gradle.properties

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
2-
android.enableR8=true
32
android.useAndroidX=true
43
android.enableJetifier=true

android/settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = 'yingzi_flutter_dynamicpage'
1+
rootProject.name = 'yz_flutter_dynamic'

android/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.yingzi_flutter_dynamicpage">
2+
package="com.example.yz_flutter_dynamic">
33
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.example.yz_flutter_dynamic;
2+
3+
import androidx.annotation.NonNull;
4+
5+
import io.flutter.embedding.engine.plugins.FlutterPlugin;
6+
import io.flutter.plugin.common.MethodCall;
7+
import io.flutter.plugin.common.MethodChannel;
8+
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
9+
import io.flutter.plugin.common.MethodChannel.Result;
10+
import io.flutter.plugin.common.PluginRegistry.Registrar;
11+
12+
/** YzFlutterDynamicPlugin */
13+
public class YzFlutterDynamicPlugin implements FlutterPlugin, MethodCallHandler {
14+
/// The MethodChannel that will the communication between Flutter and native Android
15+
///
16+
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
17+
/// when the Flutter Engine is detached from the Activity
18+
private MethodChannel channel;
19+
20+
@Override
21+
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
22+
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "yz_flutter_dynamic");
23+
channel.setMethodCallHandler(this);
24+
}
25+
26+
@Override
27+
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
28+
if (call.method.equals("getPlatformVersion")) {
29+
result.success("Android " + android.os.Build.VERSION.RELEASE);
30+
} else {
31+
result.notImplemented();
32+
}
33+
}
34+
35+
@Override
36+
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
37+
channel.setMethodCallHandler(null);
38+
}
39+
}

android/src/main/kotlin/com/example/yingzi_flutter_dynamicpage/YingziFlutterDynamicpagePlugin.kt

-45
This file was deleted.

example/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# yingzi_flutter_dynamicpage_example
22

3-
Demonstrates how to use the yingzi_flutter_dynamicpage plugin.
3+
Demonstrates how to use the yz_flutter_dynamic plugin.
44

55
## Getting Started
66

0 commit comments

Comments
 (0)