Often, beginners will hit this message when they try to create some flutter App. In this article, I'm going to show how
to fix this.
This message looks on top of the yellow and black stripes on the part of the flutter screen. This means that the
content you have passed to the widget is not sufficient to fix in the place you are trying to fit it. Below is an
example of how it looks like.
,
to
Icon(Icons.access_alarm, size:300.0),
But, this is not the ultimate way to fix this issue. Instead, we will try to use an Expanded widget which will fix
this issue.
Like below,
Expanded(child: Icon(Icons.access_alarm, size:800.0))
You can observe that, without changing any size, we can still fix this issue. And this is a nice way to fix this
issue.
Here is how it's going to look.
Here is the complete code from main.dart file. You can try.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State {
double padValue = 0;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("OverFlow Fix Example"),
),
body: Container(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(child: Icon(Icons.access_alarm, size: 800.0)),
]),
)),
);
}
}
To see the error message,
Change below code from
Expanded(child: Icon(Icons.access_alarm, size:800.0)),]
to
Icon(Icons.access_alarm, size:800.0),]
Hope this is help ful to you.
Thanks,
Srikanth