Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #14

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a22808f
fixed small inital repository problem with the floating action button
Psiale Dec 4, 2020
5a2ee98
learned how to use flutter themes with ThemeData and using a default …
Psiale Dec 4, 2020
11d8f83
I refactor my function to be a class, and added a field color to chan…
Psiale Dec 7, 2020
fa2d8c2
changed color values from hardcoded ones to const values at the top
Psiale Dec 7, 2020
f3ea33a
added the property child to my cardClass
Psiale Dec 7, 2020
d15e3c9
Merge branch 'feature/theme' into develop
Psiale Dec 7, 2020
6116179
added fontAwesome dependencie
Psiale Dec 7, 2020
a850edc
created a FonTAwesomeWidget class and created the gender containers
Psiale Dec 8, 2020
7d57006
refactored my fontAwesomeWidget to hold a column and text for the ico…
Psiale Dec 8, 2020
985db56
changed the IconButton to be an Icon
Psiale Dec 8, 2020
b30a03d
added gesture Detector to the gender containers so they change color …
Psiale Dec 8, 2020
2fc1cb0
Merge branch 'feature/customCards' into develop
Psiale Dec 8, 2020
71e6de5
changed selectedGender function to use Gender enum
Psiale Dec 15, 2020
71676f4
deleted the selectedGender function to change the behavior for a tern…
Psiale Dec 15, 2020
328b158
changed colors
Psiale Dec 15, 2020
3d9f02e
removed the gestureDetector and instead add it to the darkContainer w…
Psiale Dec 15, 2020
6b9a69f
I have to implement the custom slider widget
Psiale Dec 15, 2020
f3b905e
added an slider and make it work, now I have to finish the styling
Psiale Dec 15, 2020
9580a04
finished the style
Psiale Dec 15, 2020
845de8b
finish the styling
Psiale Dec 15, 2020
454df85
have to finish the count widget
Psiale Dec 16, 2020
17e245f
created the countWidget
Psiale Dec 19, 2020
967b791
implemented a custom flotating action button, added weight and age va…
Psiale Dec 23, 2020
64201f2
Merge branch 'feature/userInteraction' into develop
Psiale Dec 23, 2020
56eba17
added a Navigator to the container at the bottom, and created a new r…
Psiale Dec 23, 2020
a9887c1
added named routes
Psiale Dec 23, 2020
5fd6c57
styling results page
Psiale Dec 24, 2020
75de538
styled the results page, now I need to add an extra parameter for the…
Psiale Dec 30, 2020
cf35357
deleted an extra import not needed
Psiale Dec 30, 2020
2ada50c
changed the onTap functionality to Navigate to a route when the route…
Psiale Dec 30, 2020
021729f
created the bmiCalculator class which contains the logic to calculate…
Psiale Dec 30, 2020
cf8bdb0
Merge branch 'feature/multiscreen' into develop
Psiale Dec 30, 2020
84f6934
changed the bottomButton to recibe a function as an argument instead …
Psiale Dec 30, 2020
2f6624b
created a constructor for the results page with a default statement w…
Psiale Jan 1, 2021
3673606
changed the default value of the description
Psiale Jan 1, 2021
6bb9140
finished the app
Psiale Jan 4, 2021
e798eac
Merge branch 'feature/BMILogic' into develop
Psiale Jan 4, 2021
b632977
added a readme
Psiale Jan 4, 2021
a7c6b0d
added mediaQuery
Psiale Jan 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 33 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,45 @@
![App Brewery Banner](https://github.com/londonappbrewery/Images/blob/master/AppBreweryBanner.png)

This project is part of a series of projects to be completed by students of the [AppBrewery](https://www.appbrewery.co/p/flutter-development-bootcamp-with-dart) flutter course.

# BMI Calculator 💪

## Our Goal
## 🧮 The Project Brief

The objective of this tutorial is to look at how we can customise Flutter Widgets to achieve our own beautiful user interface designs. If you have a designer on board, no matter how unconventional their designs are, we can create them using Flutter.
To make a Body Mass Index Calculator inspired by the beautiful designs made by [Ruben Vaalt](https://dribbble.com/shots/4585382-Simple-BMI-Calculator). It will be a multi screen app with simple functionality but full-on custom styling.

![Finished App](https://github.com/londonappbrewery/Images/blob/master/bmi-calc-demo.gif)
## 🎯 Features

## What you will create
* You can switch between English and Spanish by touching the toggle button

We’re going to make a Body Mass Index Calculator inspired by the beautiful designs made by [Ruben Vaalt](https://dribbble.com/shots/4585382-Simple-BMI-Calculator). It will be a multi screen app with simple functionality but full-on custom styling.
- Add gender, age, weight and height
- Get your BMI result with a custom description.

![Finished App](https://github.com/londonappbrewery/Images/blob/master/bmi-calc-demo.gif)
## 🧬 Technologies & Languages Used

- Dart
- Flutter
- Github


## 🛎️ Contributions, Issues & Forking

If you have any issues setting up the project or you come across any unintended bugs or problems, please do submit an issue to the [BMI Calculator](https://github.com/Psiale/bmi-calculator-flutter/issues) page.

If you want to make your own changes, modifications or improvements to our project, go ahead and Fork it!
1. [Fork it](https://github.com/Psiale/bmi-calculator-flutter/fork)

2. Create your working branch (git checkout -b [choose-a-name])

3. Commit your changes (git commit -m 'what this commit will fix/add/improve')
4. Push to the branch (git push origin [chosen-name])
5. Create a new Pull Request

## What you will learn
## 🤟🏽😄 😛🤙🏾 Creator

- How to use Flutter themes to create coherent branding.
- How to create multi-page apps using Flutter Routes and Navigator.
- How to extract and refactor Flutter Widgets with a click of the button.
- How to pass functions as parameters and fields.
- How to use the GestureDetector Widget to detect more than just a tap.
- How to use custom colour palettes by using hex codes.
- How to customise Flutter Widgets to achieve a specific design style.
- Understand Dart Enums and the Ternary Operator.
- Learn about composition vs. inheritance and the Flutter way of creating custom UI.
- Understand the difference between const and final in Dart and when to use each.
Alexis Sanchez
- [Github](https://github.com/Psiale)
- [Linkedin](https://www.linkedin.com/in/alexis-sanchez-dev/)

>This is a companion project to The App Brewery's Complete Flutter Development Bootcamp, check out the full course at [www.appbrewery.co](https://www.appbrewery.co/)
## 🙌🏾 Show Your Support

![End Banner](https://github.com/londonappbrewery/Images/blob/master/readme-end-banner.png)
Give a ⭐️ if you like this project!
15 changes: 15 additions & 0 deletions ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=C:\Users\front\Documents\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Users\front\Desktop\Flutter_projects\bmi-calculator-flutter"
export "FLUTTER_TARGET=lib\main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build\ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
export "FLUTTER_FRAMEWORK_DIR=C:\Users\front\Documents\flutter\bin\cache\artifacts\engine\ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=false"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.packages"
21 changes: 21 additions & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';

const bottomContainerHeight = 80.0;
const inactiveCardColor = Color(0xFF1D1E33);
const activeCardColor = Color(0xFF111328);
const bottomContainerColor = Color(0xFFEB1555);

const LabelTextStyle = TextStyle(fontSize: 18.0, color: Color(0xFF8D8398));

const NumberTextStyle = TextStyle(fontSize: 50.0, fontWeight: FontWeight.w900);

const LargeButtonStyle = TextStyle(fontSize: 25.0, fontWeight: FontWeight.bold);

const TitleTextStyle = TextStyle(fontSize: 25.0, fontWeight: FontWeight.bold);

const resultTextStyle = TextStyle(
color: Color(0xFF24D876), fontSize: 22.0, fontWeight: FontWeight.bold);

const BMITextStyle = TextStyle(fontSize: 100.0, fontWeight: FontWeight.bold);

const BMIDescriptionTextStyle = TextStyle(fontSize: 22.0,);
33 changes: 33 additions & 0 deletions lib/logic/bmiCalculator.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'dart:math';

class BMICalculator {
BMICalculator({this.weight, this.height});
double weight;
double height;
double _bmi;

calculate() {
_bmi = weight / pow(height / 100, 2);
return _bmi.toStringAsFixed(1);
}

String getBMILabel() {
if (_bmi >= 25) {
return 'Overweight';
} else if (_bmi > 18.5) {
return 'Normal';
} else {
return 'UnderWeight';
}
}

String getBMIDescription() {
if (_bmi >= 25) {
return 'You have a Higher than normal body weight. Try to excercise 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';
}
}
}
7 changes: 7 additions & 0 deletions lib/logic/bmiResults.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class BMIResults {
BMIResults({this.bmi, this.label, this.description});

String bmi;
String label;
String description;
}
45 changes: 22 additions & 23 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
import 'package:bmi_calculator/pages/ResultsPage.dart';
import 'package:flutter/material.dart';
import './pages/InputPage.dart';
import './pages/ResultsPage.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),
),
initialRoute: '/',
routes: {
'/': (context) => InputPage(),
'/results': (context) => ResultsPage(),
},
debugShowCheckedModeBanner: false,
theme: ThemeData.dark().copyWith(
primaryColor: Color(0xFF0A0E21),
scaffoldBackgroundColor: Color(0xFF0A0E21),
sliderTheme: SliderThemeData(
overlayShape: RoundSliderOverlayShape(overlayRadius: 30.0),
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 15.0),
inactiveTickMarkColor: Colors.pink[600],
overlayColor: Color(0x29EB1555),
valueIndicatorColor: Colors.pinkAccent,
inactiveTrackColor: Colors.grey[600],
activeTrackColor: Colors.pinkAccent,
thumbColor: Colors.pink[600]),
indicatorColor: Colors.pinkAccent),
);
}
}
Loading