londonappbrewery / bmi-calculator-flutter

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

What to do when using Named Routes? #19

Closed hardiklakhalani closed 3 years ago

hardiklakhalani commented 3 years ago

main.dart initialRoute: '/', routes: { '/': (context) => InputPage(), '/results': (context) => ResultPage(), }

input_page.dart BottomButton( buttonTitle: 'CALCULATE', onTap: () { CalculatorBrain calc = CalculatorBrain(height: height, weight: weight); Navigator.pushNamed(context, '/results'); }, ),

How do we pass properties to ResultPage() ?

sanchitpasricha commented 3 years ago

After '/results' comma and add lines below arguments: Results_page( bmiResult: calc.calculateBMI(), result: calc.getResult(), suggestion: calc.getSuggestion(), ),