londonappbrewery / bmi-calculator-flutter

Learn to Code While Building Apps - The Complete Flutter Development Bootcamp
https://www.appbrewery.co
192 stars 838 forks source link

Bottom overflowed by 99885 pixels #31

Open kiumarsj opened 2 years ago

kiumarsj commented 2 years ago

flutter version: 3.0.0 stable dart version 2.17.0 windows 10 android studio 2021.1 patch 3 physical phone: sm A505

Hi, I'm new to flutter and I have a problem in this section of angela's course. so in section 12, I did exactly what is in the course I defined a RoundedIconButton and the onPressed function. but when I want to call the onPressed and use the setState I get this overflow error from the screen and the flutter inspector. Screenshot_20220521-134715

this is the code:

RoundIconButton( icon: FontAwesomeIcons.minus, onPressed: () { setState(() { weight--; }); }, ),

if I don't use the setState, it doesn't overflow but there would be no value changing in the interface. it doesn't happen in the angela's code and I think it is because of flutter version. any idea?

JaganS-7 commented 2 years ago

Did you find solution for this problem bro? I too tried lot ,but couldn't resolve it.Can you provide me solution for this...

Zahra-Arabi commented 2 years ago

I also had this problem and by changing the type of onPressed from Function to VoidCallback my problem was solved.

 RoundIconButton({this.icon, this.onPressed});

  final IconData? icon;
  final VoidCallback?  onPressed;
Nasir035 commented 2 years ago

@kiumarsj Same problem here!