Add flutter-driven navigation on iOS (flutter/engine#3865)

This commit is contained in:
Sarah Zakarias
2017-08-09 13:01:35 +02:00
committed by GitHub
parent d26681b396
commit d5a7209ef9
5 changed files with 34 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ shared_library("flutter_framework_dylib") {
"framework/Headers/FlutterMacros.h",
"framework/Headers/FlutterPlugin.h",
"framework/Headers/FlutterViewController.h",
"framework/Headers/FlutterNavigationController.h",
"framework/Source/FlutterAppDelegate.mm",
"framework/Source/FlutterChannels.mm",
"framework/Source/FlutterCodecs.mm",
@@ -41,6 +42,7 @@ shared_library("flutter_framework_dylib") {
"framework/Source/FlutterView.h",
"framework/Source/FlutterView.mm",
"framework/Source/FlutterViewController.mm",
"framework/Source/FlutterNavigationController.mm",
"framework/Source/accessibility_bridge.h",
"framework/Source/accessibility_bridge.mm",
"framework/Source/flutter_main_ios.h",
@@ -165,6 +167,7 @@ copy("framework_headers") {
"framework/Headers/FlutterMacros.h",
"framework/Headers/FlutterPlugin.h",
"framework/Headers/FlutterViewController.h",
"framework/Headers/FlutterNavigationController.h",
]
outputs = [
"$_flutter_framework_dir/Headers/{{source_file_part}}",

View File

@@ -13,5 +13,6 @@
#include "FlutterMacros.h"
#include "FlutterPlugin.h"
#include "FlutterViewController.h"
#include "FlutterNavigationController.h"
#endif // FLUTTER_FLUTTER_H_

View File

@@ -0,0 +1,9 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <UIKit/UIKit.h>
@interface FlutterNavigationController: UINavigationController
@end

View File

@@ -0,0 +1,14 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterNavigationController.h"
@implementation FlutterNavigationController
- (void) viewWillAppear:(BOOL)animated {
[self setNavigationBarHidden:YES];
[super viewWillAppear:animated];
}
@end

View File

@@ -151,7 +151,13 @@ using namespace shell;
}
- (void)popSystemNavigator {
// Apple's human user guidelines say not to terminate iOS applications.
// Apple's human user guidelines say not to terminate iOS applications. However, if the
// root view of the app is a navigation controller, it is instructed to back up a level
// in the navigation hierarchy.
UIViewController* viewController = [UIApplication sharedApplication].keyWindow.rootViewController;
if ([viewController isKindOfClass:[UINavigationController class]]) {
[((UINavigationController*)viewController) popViewControllerAnimated:NO];
}
}
- (NSDictionary*)getClipboardData:(NSString*)format {