คือ ผมอยากให้เมื่อทำแนวนอนมันreturn landscape
Widget landscape() {
return Align(
alignment: Alignment(0, -0.150),
child: GestureDetector(
onTap: () {
onIconPressed();
},
child: Padding(
padding: const EdgeInsets.only(right: 3.0),
child: Container(
width: 35,
height: 110,
color: Colors.orangeAccent,
child: Align(
alignment: Alignment.centerRight,
child: Padding(
padding: const EdgeInsets.only(right: 3.0),
child: CircleAvatar(
backgroundColor: Colors.white,
radius: 15,
child: Center(
child: Image.asset(
'images/basketball.png',
height: 25,
),
),
),
),
),
),
),
),
);
}
ทำแนวตั้งreturn portrait
Widget portrait() {
return Align(
alignment: Alignment(0, -0.575),
child: GestureDetector(
onTap: () {
onIconPressed();
},
child: Padding(
padding: const EdgeInsets.only(right: 3.0),
child: Container(
width: 35,
height: 110,
color: Colors.orangeAccent,
child: Align(
alignment: Alignment.centerRight,
child: Padding(
padding: const EdgeInsets.only(right: 3.0),
child: CircleAvatar(
backgroundColor: Colors.white,
radius: 15,
child: Center(
child: Image.asset(
'images/basketball.png',
height: 25,
),
),
),
),
),
),
),
),
);
}
แต่ตอนนี้จะแนวตั้งแนวนอน reture แต่ landscape ครับ
OrientationBuilder(
builder: (context, orientation){
if (orientation == Orientation.portrait){
return portrait();
}
else{
return landscape();
}
},
),