I want to use if/else statement
So that i can have MainAxisAlignment.spaceEvenly for column only if the orientation is landscape. So, it doesn't change my layout in portrait orientation.
Here's the code
class _MobileLayout extends StatelessWidget {
const _MobileLayout({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
var orientation = MediaQuery.of(context).orientation;
return Container(
width: orientation == Orientation.portrait ? 250 : 100,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
blurRadius: 16,
color: Colors.black12,
)
],
),
child: Column(
children: AppDrawer.getDrawerOptions(),
),
);
}
}
Aucun commentaire:
Enregistrer un commentaire