Commit 8d9ea6ee authored by yangwu.jia's avatar yangwu.jia

Merge branch 'master' into develop

parents c06bd5d5 3341dd7a
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
<a href="https://mp.weixin.qq.com/s?__biz=MzU4MDUxOTI5NA==&mid=2247484367&idx=1&sn=fcbc485f068dae5de9f68d52607ea08f&chksm=fd54d7deca235ec86249a9e3714ec18be8b2d6dc580cae19e4e5113533a6c5b44dfa5813c4c3&scene=0&subscene=131&clicktime=1551942425&ascene=7&devicetype=android-28&version=2700033b&nettype=ctnet&abtest_cookie=BAABAAoACwASABMABAAklx4AVpkeAMSZHgDWmR4AAAA%3D&lang=zh_CN&pass_ticket=1qvHqOsbLBHv3wwAcw577EHhNjg6EKXqTfnOiFbbbaw%3D&wx_header=1">中文介绍</a> <a href="https://mp.weixin.qq.com/s?__biz=MzU4MDUxOTI5NA==&mid=2247484367&idx=1&sn=fcbc485f068dae5de9f68d52607ea08f&chksm=fd54d7deca235ec86249a9e3714ec18be8b2d6dc580cae19e4e5113533a6c5b44dfa5813c4c3&scene=0&subscene=131&clicktime=1551942425&ascene=7&devicetype=android-28&version=2700033b&nettype=ctnet&abtest_cookie=BAABAAoACwASABMABAAklx4AVpkeAMSZHgDWmR4AAAA%3D&lang=zh_CN&pass_ticket=1qvHqOsbLBHv3wwAcw577EHhNjg6EKXqTfnOiFbbbaw%3D&wx_header=1">中文介绍</a>
</p> </p>
Note: Please checkout the release note for the latest 0.1.50 to see changes [0.1.50 release note](https://github.com/alibaba/flutter_boost/releases) #Release Note
Please checkout the release note for the latest 0.1.50 to see changes [0.1.50 release note](https://github.com/alibaba/flutter_boost/releases)
# FlutterBoost # FlutterBoost
A next-generation Flutter-Native hybrid solution. FlutterBoost is a Flutter plugin which enables hybrid integration of Flutter for your existing native apps with minimum efforts.The philosophy of FlutterBoost is to use Flutter as easy as using a WebView. Managing Native pages and Flutter pages at the same time is non-trivial in an existing App. FlutterBoost takes care of page resolution for you. The only thing you need to care about is the name of the page(usually could be an URL).  A next-generation Flutter-Native hybrid solution. FlutterBoost is a Flutter plugin which enables hybrid integration of Flutter for your existing native apps with minimum efforts.The philosophy of FlutterBoost is to use Flutter as easy as using a WebView. Managing Native pages and Flutter pages at the same time is non-trivial in an existing App. FlutterBoost takes care of page resolution for you. The only thing you need to care about is the name of the page(usually could be an URL). 
...@@ -22,15 +24,16 @@ You need to add Flutter to your project before moving on. ...@@ -22,15 +24,16 @@ You need to add Flutter to your project before moving on.
Open you pubspec.yaml and add the following line to dependencies: Open you pubspec.yaml and add the following line to dependencies:
```java ```java
flutter_boost: ^0.0.415 flutter_boost: ^0.1.50
``` ```
or you could rely directly on a Github project tag, for example(recommended) or you could rely directly on a Github project tag, for example(recommended)
```java ```java
flutter_boost: flutter_boost:
git: git:
url: 'https://github.com/alibaba/flutter_boost.git' url: 'https://github.com/alibaba/flutter_boost.git'
ref: '0.0.415' ref: '0.1.50'
``` ```
...@@ -147,36 +150,40 @@ public class MyApplication extends FlutterApplication { ...@@ -147,36 +150,40 @@ public class MyApplication extends FlutterApplication {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
FlutterBoostPlugin.init(new IPlatform() { FlutterBoostPlugin.init(new IPlatform() {
@Override @Override
public Application getApplication() { public Application getApplication() {
return MyApplication.this; return MyApplication.this;
} }
/**
* get the main activity, this activity should always at the bottom of task stack.
*/
@Override @Override
public Activity getMainActivity() { public boolean isDebug() {
return MainActivity.sRef.get(); return true;
} }
@Override @Override
public boolean isDebug() { public void openContainer(Context context, String url, Map<String, Object> urlParams, int requestCode, Map<String, Object> exts) {
return false; PageRouter.openPageByUrl(context,url,urlParams,requestCode);
} }
/**
* start a new activity from flutter page, you may need a activity router.
*/
@Override @Override
public boolean startActivity(Context context, String url, int requestCode) { public IFlutterEngineProvider engineProvider() {
return PageRouter.openPageByUrl(context,url,requestCode); return new BoostEngineProvider(){
@Override
public BoostFlutterEngine createEngine(Context context) {
return new BoostFlutterEngine(context, new DartExecutor.DartEntrypoint(
context.getResources().getAssets(),
FlutterMain.findAppBundlePath(context),
"main"),"/");
}
};
} }
@Override @Override
public Map getSettings() { public int whenEngineStart() {
return null; return ANY_ACTIVITY_CREATED;
} }
}); });
} }
``` ```
...@@ -254,13 +261,18 @@ public class FlutterFragment extends BoostFlutterFragment { ...@@ -254,13 +261,18 @@ public class FlutterFragment extends BoostFlutterFragment {
Dart Dart
```objc ```objc
FlutterBoost.singleton.openPage("pagename", {}, true);
FlutterBoost.singleton
.open("pagename")
``` ```
## Use Flutter Boost to close a page in dart code. ## Use Flutter Boost to close a page in dart code.
```objc ```objc
FlutterBoost.singleton.closePageForContext(context);
FlutterBoost.singleton.close(uniqueId);
``` ```
# Running the Demo # Running the Demo
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
</p> </p>
Note: 请查看最新版本0.1.50的release note 确认变更,[0.1.50 release note](https://github.com/alibaba/flutter_boost/releases) # Release Note
请查看最新版本0.1.50的release note 确认变更,[0.1.50 release note](https://github.com/alibaba/flutter_boost/releases)
# FlutterBoost # FlutterBoost
...@@ -20,15 +22,18 @@ Note: 请查看最新版本0.1.50的release note 确认变更,[0.1.50 release ...@@ -20,15 +22,18 @@ Note: 请查看最新版本0.1.50的release note 确认变更,[0.1.50 release
打开pubspec.yaml并将以下行添加到依赖项: 打开pubspec.yaml并将以下行添加到依赖项:
```json ```json
flutter_boost: ^0.0.415 flutter_boost: ^0.1.50
``` ```
或者可以直接依赖github的项目的版本,Tag,pub发布会有延迟,推荐直接依赖Github项目 或者可以直接依赖github的项目的版本,Tag,pub发布会有延迟,推荐直接依赖Github项目
```java ```java
flutter_boost: flutter_boost:
git: git:
url: 'https://github.com/alibaba/flutter_boost.git' url: 'https://github.com/alibaba/flutter_boost.git'
ref: '0.0.415' ref: '0.1.50'
``` ```
## Dart代码的集成 ## Dart代码的集成
将init代码添加到App App 将init代码添加到App App
...@@ -146,30 +151,32 @@ public class MyApplication extends FlutterApplication { ...@@ -146,30 +151,32 @@ public class MyApplication extends FlutterApplication {
return MyApplication.this; return MyApplication.this;
} }
/**
* get the main activity, this activity should always at the bottom of task stack.
*/
@Override @Override
public Activity getMainActivity() { public boolean isDebug() {
return MainActivity.sRef.get(); return true;
} }
@Override @Override
public boolean isDebug() { public void openContainer(Context context, String url, Map<String, Object> urlParams, int requestCode, Map<String, Object> exts) {
return false; PageRouter.openPageByUrl(context,url,urlParams,requestCode);
} }
/**
* start a new activity from flutter page, you may need a activity router.
*/
@Override @Override
public boolean startActivity(Context context, String url, int requestCode) { public IFlutterEngineProvider engineProvider() {
return PageRouter.openPageByUrl(context,url,requestCode); return new BoostEngineProvider(){
@Override
public BoostFlutterEngine createEngine(Context context) {
return new BoostFlutterEngine(context, new DartExecutor.DartEntrypoint(
context.getResources().getAssets(),
FlutterMain.findAppBundlePath(context),
"main"),"/");
}
};
} }
@Override @Override
public Map getSettings() { public int whenEngineStart() {
return null; return ANY_ACTIVITY_CREATED;
} }
}); });
} }
...@@ -243,14 +250,17 @@ public class FlutterFragment extends BoostFlutterFragment { ...@@ -243,14 +250,17 @@ public class FlutterFragment extends BoostFlutterFragment {
Dart Dart
```java ```java
FlutterBoost.singleton.openPage("pagename", {}, true);
FlutterBoost.singleton
.open("sample://flutterFragmentPage")
``` ```
## 使用Flutter Boost在dart代码关闭页面。 ## 使用Flutter Boost在dart代码关闭页面。
```java ```java
FlutterBoost.singleton.closePageForContext(context); FlutterBoost.singleton.close(uniqueId);
``` ```
# Examples # Examples
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment