0% found this document useful (0 votes)
38 views7 pages

Input Data - Dart

The document is a Flutter application for a BMI Calculator with a user interface that allows users to input their weight, height, age, and gender. It includes interactive elements such as buttons to increase or decrease values and navigates to a results screen displaying the calculated BMI and feedback. The app uses Material Design for styling and layout, providing a visually appealing experience.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views7 pages

Input Data - Dart

The document is a Flutter application for a BMI Calculator with a user interface that allows users to input their weight, height, age, and gender. It includes interactive elements such as buttons to increase or decrease values and navigates to a results screen displaying the calculated BMI and feedback. The app uses Material Design for styling and layout, providing a visually appealing experience.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

import 'package:bmi_app/calculation.

dart';
import 'package:bmi_app/result.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class BMICalc extends StatefulWidget {
@override
_BMICalcState createState() => _BMICalcState();
}

class _BMICalcState extends State<BMICalc> {


int weight = 50;
int age = 20;
int height = 170;

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF24233d),
appBar: AppBar(
backgroundColor: Color(0xFF05104f),
title: Center(
child: Text('BMI Calculator',
style: TextStyle(
color: Colors.white,
fontSize: 15,
fontWeight: FontWeight.bold
),
),
),
),

body:SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
children:<Widget> [
SizedBox(
width: 25
),
Container(
child: Material(
borderRadius: BorderRadius.circular(10),
elevation: 3.0,
color: Color(0xFF24233d),
shadowColor: Color(0xFF0abeff) ,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(FontAwesomeIcons.male,
size: 25,
color: Color(0xFF0abeff)
),
Text('Male',
style: TextStyle(
fontSize: 15,
color: Color(0xFF0abeff)
),
)
],
),

),

),
height: 135,
width: 120,

),
SizedBox(
width: 25
),
Container(
child: Material(
borderRadius: BorderRadius.circular(10),
elevation: 3.0,
color: Color(0xFF24233d),
shadowColor: Color(0xFF0abeff) ,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(FontAwesomeIcons.female,
size: 25,
color: Color(0xFF0abeff)
),
Text('Female',
style: TextStyle(
fontSize: 15,
color: Color(0xFF0abeff)
),
)
],
),

),

),
height: 135,
width: 120,

),
],
),

Padding(padding: EdgeInsets.only(top: 15)),

Container(
child: Material(
borderRadius: BorderRadius.circular(10),
elevation: 3.0,
color: Color(0xFF24233d),
shadowColor: Color(0xFF0abeff) ,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text('Height',
style: TextStyle(
fontSize: 15,
color: Color(0xFF0abeff)
),
),
Padding(padding: EdgeInsets.only(top: 5)),
Text(height.toString(),
style: TextStyle(
fontSize: 30,
color: Color(0xFF0abeff)
),
),
Padding(padding: EdgeInsets.only(top: 5)),
Row(
children: [
SizedBox(width: 80),
IconButton(icon: Icon(FontAwesomeIcons.plus,
color: Colors.white,
size:15),
onPressed: (){
setState(() {
height ++;
});
}),
SizedBox(width: 10),
IconButton(icon: Icon(FontAwesomeIcons.minus,
color: Colors.white,
size:15),
onPressed: (){
setState(() {
height --;
});
}),
],
),
],
),
),

),
height: 135,
width: 265,

),

Padding(padding: EdgeInsets.only(top: 15)),


Row(
children:<Widget> [
SizedBox(
width: 25
),
Container(
child: Material(
borderRadius: BorderRadius.circular(10),
elevation: 3.0,
color: Color(0xFF24233d),
shadowColor: Color(0xFF0abeff) ,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text('Weight',
style: TextStyle(
fontSize: 15,
color: Color(0xFF0abeff)
),
),
Padding(padding: EdgeInsets.only(top: 5)),
Text(weight.toString(),
style: TextStyle(
fontSize: 30,
color: Color(0xFF0abeff)
),
),
Padding(padding: EdgeInsets.only(top: 5)),
Row(
children: [
SizedBox(width: 10),
IconButton(icon: Icon(FontAwesomeIcons.plus,
color: Colors.white,
size:15),
onPressed: (){
setState(() {
weight ++;
});
}),
SizedBox(width: 5),
IconButton(icon: Icon(FontAwesomeIcons.minus,
color: Colors.white,
size:15),
onPressed: (){
setState(() {
weight --;
});
}),
],
),
],
),

),

),
height: 135,
width: 120,

),
SizedBox(
width: 25
),
Container(
child: Material(
borderRadius: BorderRadius.circular(10),
elevation: 3.0,
color: Color(0xFF24233d),
shadowColor: Color(0xFF0abeff) ,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text("Age",
style: TextStyle(
fontSize: 15,
color: Color(0xFF0abeff)
),
),
Padding(padding: EdgeInsets.only(top: 5)),
Text(age.toString(),
style: TextStyle(
fontSize: 30,
color: Color(0xFF0abeff)
),
),
Padding(padding: EdgeInsets.only(top: 5)),
Row(
children: [
SizedBox(width: 10),
IconButton(icon: Icon(FontAwesomeIcons.plus,
color: Colors.white,
size:15),
onPressed: (){
setState(() {
age ++;
});
}),
SizedBox(width: 5),
IconButton(icon: Icon(FontAwesomeIcons.minus,
color: Colors.white,
size:15),
onPressed: (){
setState(() {
age --;
});
}),
],
),
],
),

),

),
height: 135,
width: 120,

),
],
),

Padding(padding: EdgeInsets.only(top: 15)),


GestureDetector(
onTap: (){
Calculation calc = Calculation(height: height,weight: weight);
Navigator.push(context, MaterialPageRoute(builder:(context){
return Result(
bmiresult: calc.bmiresult(),
feedback: calc.feedback(),
suggestion: calc.suggestion(),
) ;
}));
},
child: Container(
height:35,
width: 265,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: Colors.pinkAccent
),
child: Center(
child: Text("Calculate",
style: TextStyle(
color: Colors.white,
fontSize: 15,
fontWeight: FontWeight.bold
),
),
),
),
),

],
),
),
);
}
}

You might also like