Created
July 28, 2025 16:08
-
-
Save HannesGitH/7337917358c2160ce279bb00c06732cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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