Skip to content

The dialog width is not being adjusted based on the screen type. #384

Open
@Nstd

Description

@Nstd

Bug report

The getScreenTypeForWidth method in the WoltBreakpoints determines the screen type base on the screenWidth parameter.

static WoltBreakpoints getScreenTypeForWidth(double screenWidth) {
for (var screenType in WoltBreakpoints.values) {
if (screenWidth >= screenType.minValue &&
screenWidth <= screenType.maxValue) {
return screenType;
}
}
// Default to small if no match is found.
return WoltBreakpoints.small;
}

However, the layoutModal method in WoltDialogType use WoltBreakpoints.small as the screen type for all screen scenarios.
This means that regardless of the actual screen width, it always displays dialogs as if on a small screen. Is this a bug?

@override
BoxConstraints layoutModal(Size availableSize) {
const double minModalHeight = 360.0;
final double minModalWidth = WoltBreakpoints.small.minValue;
const double verticalBreakpoint = minModalHeight + minPadding;
final double horizontalBreakpoint = minModalWidth + minPadding;
final double availableWidth = availableSize.width;
final double availableHeight = availableSize.height;
double width;
if (availableWidth > horizontalBreakpoint) {
width = minModalWidth;
} else {
width = max(0, availableWidth - minPadding);
}
if (availableHeight >= verticalBreakpoint) {
return BoxConstraints(
minWidth: width,
maxWidth: width,
minHeight: 0,
maxHeight: max(360, availableHeight * 0.8),
);
}
return BoxConstraints(
minWidth: width,
maxWidth: width,
minHeight: 0,
maxHeight: availableHeight * 0.8,
);
}

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. '...'
  3. See error or incorrect behavior

Expected behavior

A clear and concise description of what you expected to happen.


Additional context

Add any other context about the problem here.


Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions