Closed hardiklakhalani closed 3 years ago
main.dart initialRoute: '/', routes: { '/': (context) => InputPage(), '/results': (context) => ResultPage(), }
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'); }, ),
BottomButton( buttonTitle: 'CALCULATE', onTap: () { CalculatorBrain calc = CalculatorBrain(height: height, weight: weight); Navigator.pushNamed(context, '/results'); }, ),
How do we pass properties to ResultPage() ?
After '/results' comma and add lines below arguments: Results_page( bmiResult: calc.calculateBMI(), result: calc.getResult(), suggestion: calc.getSuggestion(), ),
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() ?