Skip to content

Commit

Permalink
Did some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MohEsmail143 committed Jul 5, 2023
1 parent 1fc66be commit a9e400e
Show file tree
Hide file tree
Showing 47 changed files with 175 additions and 109 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<application
android:label="Coach.ai"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/launcher_icon">
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon/icon-v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
55 changes: 52 additions & 3 deletions lib/screens/camera_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:sensors_plus/sensors_plus.dart';
import 'package:flutter_tts/flutter_tts.dart';

import '../utils/camera/coach_tts.dart';
import '../utils/exercise.dart';
Expand Down Expand Up @@ -91,6 +90,53 @@ class _CameraScreenState extends State<CameraScreen>

/// ******************************
void showInstructions() {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
backgroundColor: Colors.grey[900],
title: const Text(
'Instructions',
style: TextStyle(
color: Colors.white,
),
),
content: SizedBox(
width: double.maxFinite,
child: ListView.builder(
shrinkWrap: true,
itemCount: widget.exercise.cameraInstructions.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(
"- ${widget.exercise.cameraInstructions[index]}",
style: const TextStyle(
color: Colors.white,
),
),
);
},
),
),
actions: [
TextButton(
child: const Text(
'OK',
style: TextStyle(
color: Colors.white,
),
),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
}

@override
void initState() {
repCounter = RepCounter(maxRepCount: widget.session.reps);
Expand All @@ -105,7 +151,7 @@ class _CameraScreenState extends State<CameraScreen>
_accelerationMagnitude =
event.x * event.x + event.y * event.y + event.z * event.z;
});
isNotMoving = _accelerationMagnitude < 0.1;
isNotMoving = _accelerationMagnitude == 0.0;
/*********************************/

super.initState();
Expand All @@ -130,7 +176,9 @@ class _CameraScreenState extends State<CameraScreen>
classifier = PoseDetector();
classifier.loadModel();

tts.speak("Welcome to Coach.ai! Start your warmup now.");
tts.speak(
"Welcome to Coach.ai! Please read the following instructions carefully.");
showInstructions();

startCameraStream();
}
Expand Down Expand Up @@ -470,6 +518,7 @@ class _CameraScreenState extends State<CameraScreen>

@override
void dispose() {
tts.tts.stop();
cameraController.dispose();
_accelerometerSubscription.cancel();
isolate.stop();
Expand Down
32 changes: 32 additions & 0 deletions lib/utils/exercise.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Exercise {
final int trackingDirection;
final String formCorrectnessModel;
final List<String> targetedMuscles;
final List<String> cameraInstructions;

Exercise({
required this.name,
Expand All @@ -17,6 +18,7 @@ class Exercise {
required this.trackingDirection,
required this.formCorrectnessModel,
required this.targetedMuscles,
required this.cameraInstructions,
});
}

Expand All @@ -34,6 +36,16 @@ final Exercise pushUps = Exercise(
trackingDirection: 0,
formCorrectnessModel: 'models/pushUp_version2.tflite',
targetedMuscles: ['Chest', 'Triceps', 'Shoulders'],
cameraInstructions: [
"For this exercise, you need to place your phone in a landscape orientation.",
"While exercising, your phone needs to be in a stable position (i.e. not move).",
"Your phone's camera should be able to view your entire body's right side, specially your right shoulder, since we use it to track your reps",
"Start a warmup for 15 seconds. This is necessary for our AI to calculate some statistics off your body.",
"Once you're done with your warmup, you should be able to start your workout",
"Once you have started a set, you should perform the required number of reps",
"When you're done, go back to your phone and start you rest period",
"If you want to, you can always just finish your set early and take your rest. Remember, exercise is supposed to be fun!",
],
);

final Exercise pullUps = Exercise(
Expand All @@ -51,6 +63,16 @@ final Exercise pullUps = Exercise(
trackingDirection: 1,
formCorrectnessModel: 'models/pullUp.tflite',
targetedMuscles: ['Back', 'Biceps', 'Shoulders'],
cameraInstructions: [
"For this exercise, you need to place your phone in a portrait orientation.",
"While exercising, your phone needs to be in a stable position (i.e. not move).",
"Your phone's camera should be able to view your entire body's anterior, specially your nose, since we use it to track your reps",
"Start a warmup for 15 seconds. This is necessary for our AI to calculate some statistics off your body.",
"Once you're done with your warmup, you should be able to start your workout",
"Once you have started a set, you should perform the required number of reps",
"When you're done, go back to your phone and start you rest period",
"If you want to, you can always just finish your set early and take your rest. Remember, exercise is supposed to be fun!",
],
);

final Exercise squats = Exercise(
Expand All @@ -68,6 +90,16 @@ final Exercise squats = Exercise(
trackingDirection: 1,
formCorrectnessModel: 'models/squat.tflite',
targetedMuscles: ['Quads', 'Hip Flexors', 'Hamstrings', 'Glutes'],
cameraInstructions: [
"For this exercise, you need to place your phone in a portrait orientation.",
"While exercising, your phone needs to be in a stable position (i.e. not move).",
"Your phone's camera should be able to view your entire body's anterior, specially your nose, since we use it to track your reps",
"Start a warmup for 15 seconds. This is necessary for our AI to calculate some statistics off your body.",
"Once you're done with your warmup, you should be able to start your workout",
"Once you have started a set, you should perform the required number of reps",
"When you're done, go back to your phone and start you rest period",
"If you want to, you can always just finish your set early and take your rest. Remember, exercise is supposed to be fun!",
],
);

/// MoveNet Keypoints constants
Expand Down
132 changes: 66 additions & 66 deletions macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
{
"images" : [
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "app_icon_16.png",
"scale" : "1x"
"info": {
"version": 1,
"author": "xcode"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "app_icon_32.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "app_icon_32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "app_icon_64.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "app_icon_128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "app_icon_256.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "app_icon_256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "app_icon_512.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "app_icon_512.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "app_icon_1024.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
"images": [
{
"size": "16x16",
"idiom": "mac",
"filename": "app_icon_16.png",
"scale": "1x"
},
{
"size": "16x16",
"idiom": "mac",
"filename": "app_icon_32.png",
"scale": "2x"
},
{
"size": "32x32",
"idiom": "mac",
"filename": "app_icon_32.png",
"scale": "1x"
},
{
"size": "32x32",
"idiom": "mac",
"filename": "app_icon_64.png",
"scale": "2x"
},
{
"size": "128x128",
"idiom": "mac",
"filename": "app_icon_128.png",
"scale": "1x"
},
{
"size": "128x128",
"idiom": "mac",
"filename": "app_icon_256.png",
"scale": "2x"
},
{
"size": "256x256",
"idiom": "mac",
"filename": "app_icon_256.png",
"scale": "1x"
},
{
"size": "256x256",
"idiom": "mac",
"filename": "app_icon_512.png",
"scale": "2x"
},
{
"size": "512x512",
"idiom": "mac",
"filename": "app_icon_512.png",
"scale": "1x"
},
{
"size": "512x512",
"idiom": "mac",
"filename": "app_icon_1024.png",
"scale": "2x"
}
]
}
Binary file modified macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
Binary file modified macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
Binary file modified macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
Binary file modified macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
Binary file modified macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
Binary file modified macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
57 changes: 21 additions & 36 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
name: coach_ai
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
publish_to: "none"

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1

# environment:
Expand All @@ -24,21 +10,13 @@ version: 1.0.0+1
environment:
sdk: ">=2.19.5 <3.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
cloud_firestore: ^4.6.0
firebase_auth: ^4.5.0
firebase_core_platform_interface: ^4.7.0
firebase_core: ^2.11.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
google_fonts: ^4.0.4
carousel_slider: ^4.0.0
Expand All @@ -64,27 +42,34 @@ dev_dependencies:
flutter_test:
sdk: flutter

# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.1
flutter_launcher_icons: ^0.11.0
flutter_native_splash: ^2.2.16
flutter_launcher_icons: "^0.11.0"

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/icon-v2.png"
min_sdk_android: 21
size: 128
web:
generate: true
image_path: "assets/icon/icon-v2.png"
background_color: "#363636"
theme_color: "#363636"
windows:
generate: true
image_path: "assets/icon/icon-v2.png"
icon_size: 48
macos:
generate: true
image_path: "assets/icon/icon-v2.png"

# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true

# To add assets to your application, add an assets section, like this:
assets:
- assets/icon/
- assets/models/
- assets/images/nutrition2.jpg
- assets/images/image2.png
Expand Down
Binary file modified web/favicon.png
Binary file modified web/icons/Icon-192.png
Binary file modified web/icons/Icon-512.png
Binary file modified web/icons/Icon-maskable-192.png
Binary file modified web/icons/Icon-maskable-512.png
Loading

0 comments on commit a9e400e

Please sign in to comment.