mirror of
https://github.com/block/buzz.git
synced 2026-11-04 08:21:48 +00:00
## Summary Keep mobile toasts above navigation and modal sheets with an app-level overlay and a tiny transparent iOS composition boundary. Preserve Retry, automatic dismissal, and taps on underlying controls. ### Related issue No duplicate found in the toast issue/PR search. ### Testing Full mobile tests and analysis pass; iOS simulator and device builds succeed. Verified layering, Retry, dismissal, and underlying taps in a native simulator preview; human confirmed on iPhone with their existing profile/community. Broader repository checks are in progress. Before / after (isolated native simulator preview using production widgets): | Before | After | | --- | --- | |  |  | <!-- buzz-review-completed --> Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
27 lines
868 B
Swift
27 lines
868 B
Swift
import Flutter
|
|
import UIKit
|
|
|
|
/// An unclipped, transparent composition boundary for Flutter toast content.
|
|
/// Flutter paints the toast in the overlay slice above this native view, rather
|
|
/// than inheriting the rounded clip of a platform view inside a modal sheet.
|
|
final class ToastLayerFactory: NSObject, FlutterPlatformViewFactory {
|
|
func create(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?) -> FlutterPlatformView {
|
|
ToastLayerView(frame: frame)
|
|
}
|
|
}
|
|
|
|
private final class ToastLayerView: NSObject, FlutterPlatformView {
|
|
private let surface: UIView
|
|
|
|
init(frame: CGRect) {
|
|
surface = UIView(frame: frame)
|
|
surface.backgroundColor = .clear
|
|
surface.isOpaque = false
|
|
surface.isUserInteractionEnabled = false
|
|
surface.accessibilityElementsHidden = true
|
|
super.init()
|
|
}
|
|
|
|
func view() -> UIView { surface }
|
|
}
|