Для дартпада:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Builder(
builder: (context) => Scaffold(
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ConstrainedBox(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.width,
minHeight: MediaQuery.of(context).size.width / 2,
),
child: Container(color: Colors.red.shade400),
),
Container(color: Colors.yellow.shade400, height: 100),
Expanded(
child: Center(
child: Container(color: Colors.green.shade400, height: 100),
),
),
Container(color: Colors.blue.shade400, height: 100),
],
),
),
),
);
}
}