Created
February 6, 2023 19:09
-
-
Save FlutterWiz/318584093cc2095c2927986f7449cdd0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ResponsiveLayout extends StatelessWidget { | |
const ResponsiveLayout({ | |
super.key, | |
required this.mobileLayout, | |
required this.desktopLayout, | |
}); | |
final Widget mobileLayout; | |
final Widget desktopLayout; | |
@override | |
Widget build(BuildContext context) { | |
return LayoutBuilder( | |
builder: (BuildContext context, BoxConstraints constraints) { | |
if (constraints.maxWidth < 768) { | |
return mobileLayout; | |
} else { | |
return desktopLayout; | |
} | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment