How would one make a centered content container like this in Flutter?:


.container {
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 600px;
background-color: red;
height: 100vh;
}
<div class="container">
Hello inside container
</div>
I have tried this, but it just overflows instead of fitting to the width of the screen once the application is smaller than the maxWidth.
import "package:flutter/material.dart";
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
body: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: double.infinity,
color: Colors.red,
constraints: const BoxConstraints(maxWidth: 800),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Text(
"Hello inside container",
style: TextStyle(fontSize: 40),
),
],
),
),
],
));
}
}

