-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3880fa
commit 521bc79
Showing
13 changed files
with
512 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
# This is a generated file; do not edit or check into version control. | ||
export "FLUTTER_ROOT=/Users/philippmuellauer/Developer/flutter" | ||
export "FLUTTER_APPLICATION_PATH=/Users/philippmuellauer/Documents/Flutter/Flutter Complete/bmi-calculator" | ||
export "FLUTTER_TARGET=lib/main.dart" | ||
export "FLUTTER_BUILD_DIR=build" | ||
export "SYMROOT=${SOURCE_ROOT}/../build/ios" | ||
export "FLUTTER_FRAMEWORK_DIR=/Users/philippmuellauer/Developer/flutter/bin/cache/artifacts/engine/ios" | ||
export "FLUTTER_BUILD_NAME=1.0.0" | ||
export "FLUTTER_BUILD_NUMBER=1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>BuildSystemType</key> | ||
<string>Original</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import 'dart:math'; | ||
|
||
class CalculatorBrain { | ||
CalculatorBrain({this.height, this.weight}); | ||
|
||
final int height; | ||
final int weight; | ||
|
||
double _bmi; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
String calculateBMI() { | ||
_bmi = weight / pow(height / 100, 2); | ||
return _bmi.toStringAsFixed(1); | ||
} | ||
|
||
String getResult() { | ||
if (_bmi >= 25) { | ||
return 'Overweight'; | ||
} else if (_bmi > 18.5) { | ||
return 'Normal'; | ||
} else { | ||
return 'Underweight'; | ||
} | ||
} | ||
|
||
String getInterpretation() { | ||
if (_bmi >= 25) { | ||
return 'You have a higher than normal body weight. Try to exercise more.'; | ||
} else if (_bmi >= 18.5) { | ||
return 'You have a normal body weight. Good job!'; | ||
} else { | ||
return 'You have a lower than normal body weight. You can eat a bit more.'; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:bmi_calculator/constants.dart'; | ||
|
||
class BottomButton extends StatelessWidget { | ||
BottomButton({@required this.onTap, @required this.buttonTitle}); | ||
|
||
final Function onTap; | ||
final String buttonTitle; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
onTap: onTap, | ||
child: Container( | ||
child: Center( | ||
child: Text( | ||
buttonTitle, | ||
style: kLargeButtonTextStyle, | ||
), | ||
), | ||
color: kBottomContainerColour, | ||
margin: EdgeInsets.only(top: 10.0), | ||
padding: EdgeInsets.only(bottom: 20.0), | ||
width: double.infinity, | ||
height: kBottomContainerHeight, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:bmi_calculator/constants.dart'; | ||
|
||
class IconContent extends StatelessWidget { | ||
IconContent({this.icon, this.label}); | ||
|
||
final IconData icon; | ||
final String label; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
Icon( | ||
icon, | ||
size: 80.0, | ||
), | ||
SizedBox( | ||
height: 15.0, | ||
), | ||
Text( | ||
label, | ||
style: kLabelTextStyle, | ||
) | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class ReusableCard extends StatelessWidget { | ||
ReusableCard({@required this.colour, this.cardChild, this.onPress}); | ||
|
||
final Color colour; | ||
final Widget cardChild; | ||
final Function onPress; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
onTap: onPress, | ||
child: Container( | ||
child: cardChild, | ||
margin: EdgeInsets.all(15.0), | ||
decoration: BoxDecoration( | ||
color: colour, | ||
borderRadius: BorderRadius.circular(10.0), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class RoundIconButton extends StatelessWidget { | ||
RoundIconButton({@required this.icon, @required this.onPressed}); | ||
|
||
final IconData icon; | ||
final Function onPressed; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return RawMaterialButton( | ||
elevation: 0.0, | ||
child: Icon(icon), | ||
onPressed: onPressed, | ||
constraints: BoxConstraints.tightFor( | ||
width: 56.0, | ||
height: 56.0, | ||
), | ||
shape: CircleBorder(), | ||
fillColor: Color(0xFF4C4F5E), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
const kBottomContainerHeight = 80.0; | ||
const kActiveCardColour = Color(0xFF1D1E33); | ||
const kInactiveCardColour = Color(0xFF111328); | ||
const kBottomContainerColour = Color(0xFFEB1555); | ||
|
||
const kLabelTextStyle = TextStyle( | ||
fontSize: 18.0, | ||
color: Color(0xFF8D8E98), | ||
); | ||
|
||
const kNumberTextStyle = TextStyle( | ||
fontSize: 50.0, | ||
fontWeight: FontWeight.w900, | ||
); | ||
|
||
const kLargeButtonTextStyle = TextStyle( | ||
fontSize: 25.0, | ||
fontWeight: FontWeight.bold, | ||
); | ||
|
||
const kTitleTextStyle = TextStyle( | ||
fontSize: 50.0, | ||
fontWeight: FontWeight.bold, | ||
); | ||
|
||
const kResultTextStyle = TextStyle( | ||
color: Color(0xFF24D876), | ||
fontSize: 22.0, | ||
fontWeight: FontWeight.bold, | ||
); | ||
|
||
const kBMITextStyle = TextStyle( | ||
fontSize: 100.0, | ||
fontWeight: FontWeight.bold, | ||
); | ||
|
||
const kBodyTextStyle = TextStyle( | ||
fontSize: 22.0, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,17 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:bmi_calculator/screens/input_page.dart'; | ||
|
||
void main() => runApp(BMICalculator()); | ||
|
||
class BMICalculator extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: InputPage(), | ||
); | ||
} | ||
} | ||
|
||
class InputPage extends StatefulWidget { | ||
@override | ||
_InputPageState createState() => _InputPageState(); | ||
} | ||
|
||
class _InputPageState extends State<InputPage> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('BMI CALCULATOR'), | ||
), | ||
body: Center( | ||
child: Text('Body Text'), | ||
), | ||
floatingActionButton: FloatingActionButton( | ||
child: Icon(Icons.add), | ||
theme: ThemeData.dark().copyWith( | ||
primaryColor: Color(0xFF0A0E21), | ||
scaffoldBackgroundColor: Color(0xFF0A0E21), | ||
), | ||
home: InputPage(), | ||
); | ||
} | ||
} |
Oops, something went wrong.
Now it says that bmi must be initialized