Flutter-Course-Resources/BMI-Calculator-Flutter/lib/screens/results_page.dart
2022-06-19 15:07:52 +05:00

72 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:bmi_calculator/constants.dart';
import 'package:bmi_calculator/components/reusable_card.dart';
import 'package:bmi_calculator/components/bottom_button.dart';
class ResultsPage extends StatelessWidget {
ResultsPage(
{@required this.interpretation,
@required this.bmiResult,
@required this.resultText});
final String bmiResult;
final String resultText;
final String interpretation;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('BMI CALCULATOR'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: Container(
padding: EdgeInsets.all(15.0),
alignment: Alignment.bottomLeft,
child: Text(
'Your Result',
style: kTitleTextStyle,
),
),
),
Expanded(
flex: 5,
child: ReusableCard(
colour: kActiveCardColour,
cardChild: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
resultText.toUpperCase(),
style: kResultTextStyle,
),
Text(
bmiResult,
style: kBMITextStyle,
),
Text(
interpretation,
textAlign: TextAlign.center,
style: kBodyTextStyle,
),
],
),
),
),
BottomButton(
buttonTitle: 'RE-CALCULATE',
onTap: () {
Navigator.pop(context);
},
)
],
),
);
}
}