Skip to content

Instantly share code, notes, and snippets.

@HannesGitH
Created July 28, 2025 16:08
Show Gist options
  • Save HannesGitH/7337917358c2160ce279bb00c06732cc to your computer and use it in GitHub Desktop.
Save HannesGitH/7337917358c2160ce279bb00c06732cc to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(),
home: Scaffold(
body: ListView(
children: [
WorkingExample(),
const SizedBox(height: 100),
DisfunctExample(),
],
),
),
);
}
}
class WorkingExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return IntrinsicHeight(
child: Row(
children: List.generate(
4,
(i) => ConstrainedBox(
constraints: BoxConstraints(maxWidth: 300),
child: Container(
child: Text('very very long text' * 20 * i),
color: Colors.teal,
),
),
),
),
);
}
}
class DisfunctExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return IntrinsicHeight(
child: Row(
children: List.generate(
4,
(i) => LimitedBox(
maxWidth: 300,
child: Container(
child: Text('very very long text' * 20 * i),
color: Colors.amber,
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment