Provide a default status bar tap handler for FlutterAppDelegate.
By default, taps are passed to the key window's rootViewController if
it's a FlutterViewController. Apps with custom app delegates can
customize this behaviour to send the tap to the FlutterViewController(s)
they prefer by overriding touchesBegan:withEvent.
The PlatformView superclass constructor was posting a task to the UI thread
that adds the view to the shell's global list. This could result in UI thread
operations seeing PlatformView instances that are not fully constructed and do
not yet have an engine.
This was happening in https://github.com/flutter/flutter/issues/7735
On iOS, when a tap is detected in the status bar, provide a means to
pass that touch event through to one or more FlutterViewControllers to
trigger a scroll to top. In iOS apps, scroll to top should occur under
the following conditions:
1. There is one and only one UIScrollView visible with
scrollsToTop == YES.
2. The status-bar is in standard height mode, not in double-height mode.
In double-height mode, the expected behaviour is to trigger a switch
to the application associated with the double-height status bar.
3. A tap or a drag gesture occurs that is entirely constrained to the
status bar frame. (We currently only handle the tap scenario).
Unfortunately, AppDelegates only get touchesBegan events for status bar
taps, though get get touchesBegan and touchesEnded events for drags
within the status bar frame. As such, we currently synthesise the
touchesEnded event for taps.
All samples and the 'flutter create' command now use a project-specifc
app delegate.
Any projects that still rely on FlutterAppDelegate should create an
empty delegate that subclasses UIResponder<UIApplicationDelegate> and
defines:
@property (strong, nonatomic) UIWindow *window;
* Apply iOS status bar padding only to fullscreen views
Previously padding was applied to account for the status bar, whether in
standard or expanded 'in-call' geometry only if the current view was not
a subview of a containing view. This didn't cover the case of root views
embedded in other windows (e.g. dialogs).
We also ensure that the window is fullscreen to account for cases like
small dialogs centred on the screen.
* Do not apply padding if we're a subview in a containing view
* Handle double-height status bar on iOS
In certain cases, iOS displays a double-height status bar (e.g., when an
application is using device location or while in a call). In such cases,
iOS offsets the app view origin by 20px, reduces view height by 20px,
then overlays a 40px opaque status bar: 20px covering the newly opened
20px gap at the top of the screen, 20px covering the top 20px of the
view, which had previously been under the standard-sized status bar.
Flutter previously set top padding to the height of the status bar,
which resulted in 40px padding with a double-sized status bar. However,
the padding should match the portion of the status bar overlapping the
view, which is 20px.
Note that the final case is the one in which no status bar is shown and
padding should be zero.
* Only apply status bar padding on root views
The GPUSurfaceGL holds references to Skia objects that may own GL objects.
If the GL objects are destructed on the GPU thread after the EGL context has been
dropped, then the GL delete calls will not take effect.
* This allows the tests to add their own FLX files but still use consistent fonts.
* The test fonts are only embedded on the desktop test shells. The option is not available on mobile platforms.
* Right now, all fonts will resolve to the test font. If we want tests to be able to use the fonts they embed in FLX files but use the test font for platform fallbacks, we will need to add font selector fallbacks. I can do this in an another patch. So far, there are no users of this functionality.
FlutterView's host message processing methods are invoked from native code,
and the JNI wrappers will abort the process if the Java side has an uncaught
exception.