Masterarbeit Richard Stern. Flutter App, sich mit einem Bluetooth-Gerät verbindet und Berührungen auf einem Sensor visualisiert.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FlutterViewController.h 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. // Copyright 2013 The Flutter Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef FLUTTER_FLUTTERVIEWCONTROLLER_H_
  5. #define FLUTTER_FLUTTERVIEWCONTROLLER_H_
  6. #import <UIKit/UIKit.h>
  7. #include <sys/cdefs.h>
  8. #include "FlutterBinaryMessenger.h"
  9. #include "FlutterDartProject.h"
  10. #include "FlutterEngine.h"
  11. #include "FlutterMacros.h"
  12. #include "FlutterPlugin.h"
  13. #include "FlutterTexture.h"
  14. @class FlutterEngine;
  15. /**
  16. * The name used for semantic update nofications via `NSNotificationCenter`.
  17. *
  18. * The object passed as the sender is the `FlutterViewController` associated
  19. * with the update.
  20. */
  21. FLUTTER_EXPORT
  22. extern NSNotificationName const FlutterSemanticsUpdateNotification;
  23. /**
  24. * A `UIViewController` implementation for Flutter views.
  25. *
  26. * Dart execution, channel communication, texture registration, and plugin registration
  27. * are all handled by `FlutterEngine`. Calls on this class to those members all proxy
  28. * through to the `FlutterEngine` attached FlutterViewController.
  29. *
  30. * A FlutterViewController can be initialized either with an already-running `FlutterEngine`,
  31. * or it can be initialized with a `FlutterDartProject` that will be used to spin up
  32. * a new `FlutterEngine`. Developers looking to present and hide FlutterViewControllers
  33. * in native iOS applications will usually want to maintain the `FlutterEngine` instance
  34. * so as not to lose Dart-related state and asynchronous tasks when navigating back and
  35. * forth between a FlutterViewController and other `UIViewController`s.
  36. */
  37. FLUTTER_EXPORT
  38. @interface FlutterViewController
  39. : UIViewController <FlutterBinaryMessenger, FlutterTextureRegistry, FlutterPluginRegistry>
  40. /**
  41. * Initializes this FlutterViewController with the specified `FlutterEngine`.
  42. *
  43. * The initialized viewcontroller will attach itself to the engine as part of this process.
  44. *
  45. * @param engine The `FlutterEngine` instance to attach to.
  46. * @param nibNameOrNil The NIB name to initialize this UIViewController with.
  47. * @param nibBundleOrNil The NIB bundle.
  48. */
  49. - (instancetype)initWithEngine:(FlutterEngine*)engine
  50. nibName:(NSString*)nibNameOrNil
  51. bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER;
  52. /**
  53. * Initializes a new FlutterViewController and `FlutterEngine` with the specified
  54. * `FlutterDartProject`.
  55. *
  56. * @param projectOrNil The `FlutterDartProject` to initialize the `FlutterEngine` with.
  57. * @param nibNameOrNil The NIB name to initialize this UIViewController with.
  58. * @param nibBundleOrNil The NIB bundle.
  59. */
  60. - (instancetype)initWithProject:(FlutterDartProject*)projectOrNil
  61. nibName:(NSString*)nibNameOrNil
  62. bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER;
  63. - (void)handleStatusBarTouches:(UIEvent*)event;
  64. /**
  65. * Registers a callback that will be invoked when the Flutter view has been rendered.
  66. * The callback will be fired only once.
  67. *
  68. * Replaces an existing callback. Use a `nil` callback to unregister the existing one.
  69. */
  70. - (void)setFlutterViewDidRenderCallback:(void (^)(void))callback;
  71. /**
  72. * Returns the file name for the given asset.
  73. * The returned file name can be used to access the asset in the application's
  74. * main bundle.
  75. *
  76. * @param asset The name of the asset. The name can be hierarchical.
  77. * @return The file name to be used for lookup in the main bundle.
  78. */
  79. - (NSString*)lookupKeyForAsset:(NSString*)asset;
  80. /**
  81. * Returns the file name for the given asset which originates from the specified
  82. * package.
  83. * The returned file name can be used to access the asset in the application's
  84. * main bundle.
  85. *
  86. * @param asset The name of the asset. The name can be hierarchical.
  87. * @param package The name of the package from which the asset originates.
  88. * @return The file name to be used for lookup in the main bundle.
  89. */
  90. - (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package;
  91. /**
  92. * Sets the first route that the Flutter app shows. The default is "/".
  93. * This method will guarnatee that the initial route is delivered, even if the
  94. * Flutter window hasn't been created yet when called. It cannot be used to update
  95. * the current route being shown in a visible FlutterViewController (see pushRoute
  96. * and popRoute).
  97. *
  98. * @param route The name of the first route to show.
  99. */
  100. - (void)setInitialRoute:(NSString*)route;
  101. /**
  102. * Instructs the Flutter Navigator (if any) to go back.
  103. */
  104. - (void)popRoute;
  105. /**
  106. * Instructs the Flutter Navigator (if any) to push a route on to the navigation
  107. * stack. The setInitialRoute method should be preferred if this is called before the
  108. * FlutterViewController has come into view.
  109. *
  110. * @param route The name of the route to push to the navigation stack.
  111. */
  112. - (void)pushRoute:(NSString*)route;
  113. /**
  114. * The `FlutterPluginRegistry` used by this FlutterViewController.
  115. */
  116. - (id<FlutterPluginRegistry>)pluginRegistry;
  117. /**
  118. * Specifies the view to use as a splash screen. Flutter's rendering is asynchronous, so the first
  119. * frame rendered by the Flutter application might not immediately appear when theFlutter view is
  120. * initially placed in the view hierarchy. The splash screen view will be used as
  121. * a replacement until the first frame is rendered.
  122. *
  123. * The view used should be appropriate for multiple sizes; an autoresizing mask to
  124. * have a flexible width and height will be applied automatically.
  125. */
  126. @property(strong, nonatomic) UIView* splashScreenView;
  127. /**
  128. * Attempts to set the `splashScreenView` property from the `UILaunchStoryboardName` from the
  129. * main bundle's `Info.plist` file. This method will not change the value of `splashScreenView`
  130. * if it cannot find a default one from a storyboard or nib.
  131. *
  132. * @return `YES` if successful, `NO` otherwise.
  133. */
  134. - (BOOL)loadDefaultSplashScreenView;
  135. /**
  136. * Controls whether the created view will be opaque or not.
  137. *
  138. * Default is `YES`. Note that setting this to `NO` may negatively impact performance
  139. * when using hardware acceleration, and toggling this will trigger a re-layout of the
  140. * view.
  141. */
  142. @property(nonatomic, getter=isViewOpaque) BOOL viewOpaque;
  143. /**
  144. * The `FlutterEngine` instance for this view controller.
  145. */
  146. @property(weak, nonatomic, readonly) FlutterEngine* engine;
  147. @end
  148. #endif // FLUTTER_FLUTTERVIEWCONTROLLER_H_