responsive_builder
responsive_builder copied to clipboard
Pass SizingInformation to the ScreenTypeLayout builders
Hi,
I see in the build
method of ScreenTypeLayout, that we have access to the SizingInformation
but are not passing it to each builder:
@override
Widget build(BuildContext context) {
return ResponsiveBuilder(
breakpoints: breakpoints,
builder: (context, sizingInformation) {
// If we're at desktop size
if (sizingInformation.deviceScreenType == DeviceScreenType.desktop) {
// If we have supplied the desktop layout then display that
if (desktop != null) return desktop!(context);
// If no desktop layout is supplied we want to check if we have the size below it and display that
if (tablet != null) return tablet!(context);
}
if (sizingInformation.deviceScreenType == DeviceScreenType.tablet) {
if (tablet != null) return tablet!(context);
}
if (sizingInformation.deviceScreenType == DeviceScreenType.watch &&
watch != null) {
return watch!(context);
}
// If none of the layouts above are supplied or we're on the mobile layout then we show the mobile layout
return mobile(context);
},
Please pass it to the passed in builders, as right now we need to add our own ResponsiveBuilder
to get the SizingInformation while the build method of ScreenTypeLayout
is already doing that.
P.S. You may as well do the same for RefinedLayoutBuilder
.