Skip to content

Instantly share code, notes, and snippets.

Last active April 22, 2020 00:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Using Flexible Widget to solve render flex overflow errors
// for Flutter Inspector layout tools: visualizing render overflow solutions
// This example is adapted from
import 'package:flutter/material.dart';
class ColumnOverflow extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('RenderFlex OverFlow 2'),
body: Container(
child: new Row(
children: [
new Padding(
padding: EdgeInsets.all(16.0),
child: Icon(Icons.message),
// Resolution: Wrap the Column below in an Flexible widget.
new Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Title", style: Theme.of(context).textTheme.headline4),
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed"
" do eiusmod tempor incididunt ut labore et dolore magna "
"aliqua. Ut enim ad minim veniam, quis nostrud "
"exercitation ullamco laboris nisi ut aliquip ex ea "
"commodo consequat."),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment