Skip to content

Instantly share code, notes, and snippets.

@stegrams
Last active May 5, 2020 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stegrams/15f75f777c7bca3020c8aa9a7af72b87 to your computer and use it in GitHub Desktop.
Save stegrams/15f75f777c7bca3020c8aa9a7af72b87 to your computer and use it in GitHub Desktop.
Limit the infinite effect of two vertical widgets inside each other
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