File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
packages/flutter_adaptive_scaffold/lib/src Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,7 @@ class Breakpoint {
226226 final SlotLayout ? slotLayout =
227227 context.findAncestorWidgetOfExactType <SlotLayout >();
228228 Breakpoint ? fallbackBreakpoint;
229+
229230 if (slotLayout != null ) {
230231 for (final MapEntry <Breakpoint , SlotLayoutConfig ?> config
231232 in slotLayout.config.entries) {
Original file line number Diff line number Diff line change @@ -20,17 +20,24 @@ class SlotLayout extends StatefulWidget {
2020 static SlotLayoutConfig ? pickWidget (
2121 BuildContext context, Map <Breakpoint , SlotLayoutConfig ?> config) {
2222 SlotLayoutConfig ? chosenWidget;
23- SlotLayoutConfig ? fallbackWidget;
24- config. forEach (( Breakpoint breakpoint, SlotLayoutConfig ? pickedWidget ) {
23+
24+ for ( final Breakpoint breakpoint in config.keys ) {
2525 if (breakpoint.isActive (context)) {
26- if (breakpoint.platform != null ) {
27- chosenWidget = pickedWidget;
28- } else if (chosenWidget == null && pickedWidget != null ) {
29- fallbackWidget = pickedWidget;
26+ final SlotLayoutConfig ? pickedWidget = config[breakpoint];
27+ if (pickedWidget != null ) {
28+ if (breakpoint.platform != null ) {
29+ // Prioritize platform-specific breakpoints
30+ return pickedWidget;
31+ } else {
32+ // Fallback to non-platform-specific
33+ chosenWidget = pickedWidget;
34+ }
35+ } else {
36+ chosenWidget = null ;
3037 }
3138 }
32- });
33- chosenWidget ?? = fallbackWidget;
39+ }
40+
3441 return chosenWidget;
3542 }
3643
You can’t perform that action at this time.
0 commit comments