matchesResponsivePresentation function
bool
matchesResponsivePresentation(
{ - required String configuredPresentation,
- required String presentation,
- String widthBreakpoint = '',
- String heightBreakpoint = '',
})
Implementation
bool matchesResponsivePresentation({
required String configuredPresentation,
required String presentation,
String widthBreakpoint = '',
String heightBreakpoint = '',
}) {
if (configuredPresentation.trim().toLowerCase() != presentation) {
return false;
}
final normalizedWidthBreakpoint = widthBreakpoint.trim();
final normalizedHeightBreakpoint = heightBreakpoint.trim();
if (normalizedWidthBreakpoint.isEmpty && normalizedHeightBreakpoint.isEmpty) {
return false;
}
final widthMatches = normalizedWidthBreakpoint.isNotEmpty &&
html.window.matchMedia('(max-width: $normalizedWidthBreakpoint)').matches;
final heightMatches = normalizedHeightBreakpoint.isNotEmpty &&
html.window
.matchMedia('(max-height: $normalizedHeightBreakpoint)')
.matches;
return widthMatches || heightMatches;
}