@@ -34,6 +34,7 @@ class IosGlassNavigationButton extends HookWidget {
3434 this .height = 48 ,
3535 this .buttonCenterX,
3636 this .foregroundColor,
37+ this .nativeViewSuppressed,
3738 });
3839
3940 static const viewType = 'buzz/navigation_glass' ;
@@ -45,6 +46,7 @@ class IosGlassNavigationButton extends HookWidget {
4546 final double height;
4647 final double ? buttonCenterX;
4748 final Color ? foregroundColor;
49+ final ValueListenable <bool >? nativeViewSuppressed;
4850
4951 @override
5052 Widget build (BuildContext context) {
@@ -81,29 +83,76 @@ class IosGlassNavigationButton extends HookWidget {
8183 return null ;
8284 }, [nativeChannel.value, brightness, foregroundValue, enabled]);
8385
86+ Widget buildControl ({required bool suppressNativeView}) {
87+ if (suppressNativeView) {
88+ final resolvedButtonCenterX = buttonCenterX ?? width / 2 ;
89+ return Stack (
90+ key: const ValueKey ('ios-glass-navigation-flutter-fallback' ),
91+ children: [
92+ Positioned (
93+ left: resolvedButtonCenterX - 20 ,
94+ top: (height - 40 ) / 2 ,
95+ width: 40 ,
96+ height: 40 ,
97+ child: DecoratedBox (
98+ decoration: BoxDecoration (
99+ color: context.colors.surface.withValues (alpha: 0.72 ),
100+ shape: BoxShape .circle,
101+ border: Border .all (
102+ color: context.colors.inverseSurface.withValues (
103+ alpha: 0.07 ,
104+ ),
105+ ),
106+ ),
107+ child: Icon (
108+ icon == IosGlassNavigationIcon .back
109+ ? Icons .arrow_back_ios_new_rounded
110+ : Icons .close_rounded,
111+ size: 20 ,
112+ color: effectiveForeground,
113+ ),
114+ ),
115+ ),
116+ ],
117+ );
118+ }
119+ return UiKitView (
120+ viewType: viewType,
121+ hitTestBehavior: PlatformViewHitTestBehavior .opaque,
122+ creationParams: < String , Object > {
123+ 'icon' : icon.name,
124+ 'accessibilityLabel' : semanticLabel,
125+ 'brightness' : brightness,
126+ 'foregroundColor' : foregroundValue,
127+ 'enabled' : enabled,
128+ 'buttonCenterX' : buttonCenterX ?? width / 2 ,
129+ 'hitTargetWidth' : width,
130+ 'hitTargetHeight' : height,
131+ },
132+ creationParamsCodec: const StandardMessageCodec (),
133+ onPlatformViewCreated: (viewId) {
134+ nativeChannel.value = MethodChannel ('$viewType /$viewId ' );
135+ },
136+ );
137+ }
138+
84139 return Tooltip (
85140 message: semanticLabel,
86141 child: SizedBox (
87142 width: width,
88143 height: height,
89- child: UiKitView (
90- viewType: viewType,
91- hitTestBehavior: PlatformViewHitTestBehavior .opaque,
92- creationParams: < String , Object > {
93- 'icon' : icon.name,
94- 'accessibilityLabel' : semanticLabel,
95- 'brightness' : brightness,
96- 'foregroundColor' : foregroundValue,
97- 'enabled' : enabled,
98- 'buttonCenterX' : buttonCenterX ?? width / 2 ,
99- 'hitTargetWidth' : width,
100- 'hitTargetHeight' : height,
101- },
102- creationParamsCodec: const StandardMessageCodec (),
103- onPlatformViewCreated: (viewId) {
104- nativeChannel.value = MethodChannel ('$viewType /$viewId ' );
105- },
106- ),
144+ child: nativeViewSuppressed == null
145+ ? buildControl (suppressNativeView: false )
146+ : ValueListenableBuilder <bool >(
147+ valueListenable: nativeViewSuppressed! ,
148+ builder: (context, suppressNativeView, _) => IgnorePointer (
149+ ignoring: suppressNativeView,
150+ child: ExcludeSemantics (
151+ excluding: suppressNativeView,
152+ child: buildControl (suppressNativeView: suppressNativeView),
153+ ),
154+ ),
155+ ),
107156 ),
108157 );
109158 }
0 commit comments