'How WE can make this type of code responsive in Landscape Mode for flutter as this gives error at Column
Need Help for responsive design in Flutter
Gives renderflex error for colunm but the main cause is Sliver Need Help in learning responsive design This code is taken from Flutter with Gia developer youTube
Scaffold(
body: CustomScrollView(
slivers: [
SliverList(
delegate: SliverChildListDelegate([
SizedBox(
width: Get.width,
height: Get.height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Spacer(flex: 6),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: _HeaderText(),
),
Spacer(flex: 4),
_IllustrationImage(),
Spacer(flex: 4),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: _PhoneNumberField(),
),
Spacer(flex: 2),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: _LoginButton(),
),
Spacer(flex: 5),
_RegistrationButton(),
Spacer(flex: 2),
],
),
),
],
),
),
],
),
);
Solution 1:[1]
Using OrientationBuilder you can update the UI based on Orientation.
body: OrientationBuilder(
builder: (context, orientation) {
return CustomScrollView(
scrollDirection: orientation == Orientation.portrait
? Axis.vertical
: Axis.horizontal,
);
},
),
For more info go here: https://docs.flutter.dev/cookbook/design/orientation
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TheUltimateOptimist |
