Last active
May 5, 2020 18:39
-
-
Save stegrams/15f75f777c7bca3020c8aa9a7af72b87 to your computer and use it in GitHub Desktop.
Limit the infinite effect of two vertical widgets inside each other
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(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
debugShowCheckedModeBanner: false, | |
home: MyHomePage(title: 'Flutter Demo Home Page'), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
MyHomePage({Key key, this.title}) : super(key: key); | |
final String title; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text(title), | |
), | |
body: Column( | |
children: <Widget>[ | |
// Wrap ListView inside a SizedBox like this | |
SizedBox( | |
height: 200, | |
child: ListView( | |
// Or add shrinkWrap:true for a tighter layout | |
// shrinkWrap: true, | |
children: <Widget>[ | |
Placeholder(fallbackHeight: 150, fallbackWidth: 200), | |
], | |
), | |
), | |
Row( | |
children: <Widget>[ | |
Placeholder(fallbackHeight: 150, fallbackWidth: 200), | |
Placeholder(fallbackHeight: 150, fallbackWidth: 200), | |
Placeholder(fallbackHeight: 150, fallbackWidth: 200), | |
], | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment