Commit 6547254f authored by 余玠's avatar 余玠

针对flutter页面直接打开native,补充demo

parent f3299bfd
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
#import "PlatformRouterImp.h" #import "PlatformRouterImp.h"
#import "UIViewControllerDemo.h"
#import <flutter_boost/FlutterBoost.h> #import <flutter_boost/FlutterBoost.h>
@interface PlatformRouterImp() @interface PlatformRouterImp()
...@@ -14,12 +15,30 @@ ...@@ -14,12 +15,30 @@
@implementation PlatformRouterImp @implementation PlatformRouterImp
- (void)openNativeVC:(NSString *)name
urlParams:(NSDictionary *)params
exts:(NSDictionary *)exts{
UIViewController *vc = UIViewControllerDemo.new;
BOOL animated = [exts[@"animated"] boolValue];
if([params[@"present"] boolValue]){
[self.navigationController presentViewController:vc animated:animated completion:^{
}];
}else{
[self.navigationController pushViewController:vc animated:animated];
}
}
#pragma mark - Boost 1.5 #pragma mark - Boost 1.5
- (void)open:(NSString *)name - (void)open:(NSString *)name
urlParams:(NSDictionary *)params urlParams:(NSDictionary *)params
exts:(NSDictionary *)exts exts:(NSDictionary *)exts
completion:(void (^)(BOOL))completion completion:(void (^)(BOOL))completion
{ {
if ([name isEqualToString:@"native"]) {//模拟打开native页面
[self openNativeVC:name urlParams:params exts:exts];
return;
}
BOOL animated = [exts[@"animated"] boolValue]; BOOL animated = [exts[@"animated"] boolValue];
FLBFlutterViewContainer *vc = FLBFlutterViewContainer.new; FLBFlutterViewContainer *vc = FLBFlutterViewContainer.new;
[vc setName:name params:params]; [vc setName:name params:params];
......
...@@ -16,6 +16,17 @@ class FirstRouteWidget extends StatelessWidget { ...@@ -16,6 +16,17 @@ class FirstRouteWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: children:
<Widget>[ <Widget>[
RaisedButton(
child: Text('Open native page'),
onPressed: () {
print("open natve page!");
FlutterBoost.singleton.open("native").then((Map value) {
print(
"call me when page is finished. did recieve second route result $value");
});
},
),
RaisedButton( RaisedButton(
child: Text('Open second route'), child: Text('Open second route'),
onPressed: () { onPressed: () {
......
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