build method

  1. @override
Widget? build(
  1. ActiveLayoutInfo layoutInfo
)
override

Builds the widget for a slot based on the current ActiveLayoutInfo.

Implementation

@override
Widget? build(ActiveLayoutInfo layoutInfo) {
  LayoutMatchConfig? bestMatch;
  for (final config in configs) {
    if (config.matches(
      activeBreakpointId: layoutInfo.activeBreakpointId,
      currentOrientation: layoutInfo.orientation,
      currentPlatform: layoutInfo.adaptivePlatform,
      currentFormFactor: layoutInfo.formFactor, // Pass formFactor
    )) {
      if (bestMatch == null || config.specificity > bestMatch.specificity) {
        bestMatch = config;
      }
    }
  }

  if (bestMatch != null) {
    return bestMatch.builder(layoutInfo);
  }
  return defaultBuilder?.call(layoutInfo);
}