import
'package:flutter/material.dart'
;
void
main() => runApp(MyApp());
class
MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return
MaterialApp(
title:
'GeeksforGeeks'
,
debugShowCheckedModeBanner:
false
,
theme: ThemeData(
primarySwatch: Colors.green,
),
home: HomePage(),
);
}
}
class
HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return
SafeArea(
child: Scaffold(
appBar: AppBar(
title: Text(
'GeeksforGeeks'
),
),
body: Container(
height: MediaQuery.of(context).size.height * 0.5,
width: MediaQuery.of(context).size.width,
alignment: Alignment.center,
child: LayoutBuilder(
builder: (BuildContext ctx, BoxConstraints constraints) {
if
(constraints.maxWidth >= 480) {
return
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
padding:
const
EdgeInsets.symmetric(horizontal: 8),
alignment: Alignment.center,
height: constraints.maxHeight * 0.5,
color: Colors.red,
child: Text(
'Left Part of Wide Screen'
,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
Container(
padding:
const
EdgeInsets.symmetric(horizontal: 8),
alignment: Alignment.center,
height: constraints.maxHeight * 0.5,
color: Colors.green,
child: Text(
'Right Part of Wide Screen'
,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
],
);
}
else
{
return
Container(
alignment: Alignment.center,
height: constraints.maxHeight * 0.5,
color: Colors.green,
child: Text(
'Normal Screen'
,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
);
}
},
),
),
),
);
}
}