From fae0a9706eb9ea01cc9db3f78516ea3b85911bd6 Mon Sep 17 00:00:00 2001 From: Mohamed Esmail Date: Wed, 12 Jul 2023 08:11:33 +0300 Subject: [PATCH] Minor bug fixes --- android/app/build.gradle | 2 ++ android/app/google-services.json | 39 +++++++++++++++++++++++++++++++ android/build.gradle | 2 ++ lib/main.dart | 10 ++++---- lib/screens/IntroPage.dart | 8 +++---- lib/screens/home_view_screen.dart | 3 ++- lib/screens/signup_screen.dart | 17 ++++---------- lib/utils/camera/rep_counter.dart | 2 +- lib/utils/exercise.dart | 4 ++-- pubspec.lock | 4 ++-- 10 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 android/app/google-services.json diff --git a/android/app/build.gradle b/android/app/build.gradle index b651288..9e5515b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -25,6 +25,7 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + android { namespace "com.example.coach_ai" compileSdkVersion flutter.compileSdkVersion @@ -70,3 +71,4 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } +apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 0000000..e6f890c --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,39 @@ +{ + "project_info": { + "project_number": "678883326424", + "project_id": "gradproject-2531f", + "storage_bucket": "gradproject-2531f.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:678883326424:android:6e1b42f38e056cab6f1aad", + "android_client_info": { + "package_name": "com.example.coach_ai" + } + }, + "oauth_client": [ + { + "client_id": "678883326424-bmlg9tmdq9rvr3rb695f8o2vhlidec4n.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBZLKu4d-9CacQvO66ak06AeJQqvat67bM" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "678883326424-bmlg9tmdq9rvr3rb695f8o2vhlidec4n.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index f7eb7f6..48b623f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -7,7 +7,9 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.3.0' + classpath 'com.google.gms:google-services:4.3.15' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } } diff --git a/lib/main.dart b/lib/main.dart index 815a46d..88e1eae 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,16 +2,18 @@ import 'package:firebase_auth/firebase_auth.dart'; import 'package:coach_ai/screens/welcome_screen.dart'; import 'firebase_options.dart'; +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_core/firebase_core.dart'; import 'package:coach_ai/screens/IntroPage.dart'; import 'package:coach_ai/screens/home_screen.dart'; -import 'package:firebase_core/firebase_core.dart'; + import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); - await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); + await Firebase.initializeApp(); runApp(const MyApp()); } @@ -35,8 +37,8 @@ class MyApp extends StatelessWidget { if (snapshot.hasData) { return const HomeScreen(); } else { - return WelcomeScreen(); - // return IntroPage(); + //return WelcomeScreen(); + return IntroPage(); } }, ), diff --git a/lib/screens/IntroPage.dart b/lib/screens/IntroPage.dart index 01356e9..9442c44 100644 --- a/lib/screens/IntroPage.dart +++ b/lib/screens/IntroPage.dart @@ -61,10 +61,10 @@ class _IntroPageState extends State { backgroundColor: MaterialStateProperty.all( Colors.green), // set the background color padding: MaterialStateProperty.all( - EdgeInsets.all(20)), // set the padding + EdgeInsets.all(10)), // set the padding textStyle: MaterialStateProperty.all( - TextStyle(fontSize: 23)), // set the text style - fixedSize: MaterialStateProperty.all(Size(20, 50)), + TextStyle(fontSize: 20)), // set the text style + fixedSize: MaterialStateProperty.all(Size(25, 50)), shape: MaterialStateProperty.all( RoundedRectangleBorder( borderRadius: @@ -82,7 +82,7 @@ class _IntroPageState extends State { child: Text('Sign up', style: TextStyle(color: Colors.white)), style: ButtonStyle( padding: MaterialStateProperty.all( - EdgeInsets.all(20)), // set the padding + EdgeInsets.all(10)), // set the padding textStyle: MaterialStateProperty.all( TextStyle(fontSize: 23)), // set the text style fixedSize: MaterialStateProperty.all(Size(20, 50)), diff --git a/lib/screens/home_view_screen.dart b/lib/screens/home_view_screen.dart index c358835..daa2e0c 100644 --- a/lib/screens/home_view_screen.dart +++ b/lib/screens/home_view_screen.dart @@ -1,8 +1,9 @@ import 'package:coach_ai/screens/exercise_selection_screen.dart'; -import 'package:coach_ai/screens/nutrition_screen.dart'; + import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:curved_navigation_bar/curved_navigation_bar.dart'; +import 'nutrition_screen.dart'; import 'profile_screen.dart'; import 'bmi/calculate_bmi.dart'; import '../utils/exercise.dart'; diff --git a/lib/screens/signup_screen.dart b/lib/screens/signup_screen.dart index 21101ff..25816d2 100644 --- a/lib/screens/signup_screen.dart +++ b/lib/screens/signup_screen.dart @@ -15,10 +15,9 @@ class SignUpScreen extends StatefulWidget { class _SignUpScreenState extends State { final TextEditingController _emailController = TextEditingController(); - final TextEditingController _usernameController = TextEditingController(); + final TextEditingController _passwordController = TextEditingController(); - final TextEditingController _confirmPasswordController = - TextEditingController(); + @override Widget build(BuildContext context) { @@ -56,11 +55,7 @@ class _SignUpScreenState extends State { fontWeight: FontWeight.bold, )), ), - CustomizedTextfield( - myController: _usernameController, - hintText: "Username", - isPassword: false, - ), + CustomizedTextfield( myController: _emailController, hintText: "Email", @@ -71,11 +66,7 @@ class _SignUpScreenState extends State { hintText: "Password", isPassword: true, ), - CustomizedTextfield( - myController: _confirmPasswordController, - hintText: "Confirm Password", - isPassword: true, - ), + CustomizedButton( buttonText: "Register", buttonColor: Colors.black, diff --git a/lib/utils/camera/rep_counter.dart b/lib/utils/camera/rep_counter.dart index 7da4990..e7cdb08 100644 --- a/lib/utils/camera/rep_counter.dart +++ b/lib/utils/camera/rep_counter.dart @@ -22,7 +22,7 @@ class RepCounter { /// form of "Warmup Mode" void warmup(List warmupInferences) { // Extracting min and max altitudes from list of inferences - warmupInferences = warmupInferences.sublist(25); + warmupInferences = warmupInferences.sublist(30); minAltitude = warmupInferences.reduce(min); maxAltitude = warmupInferences.reduce(max); diff --git a/lib/utils/exercise.dart b/lib/utils/exercise.dart index 6e51b73..c75372a 100644 --- a/lib/utils/exercise.dart +++ b/lib/utils/exercise.dart @@ -37,7 +37,7 @@ final List availableExercises = [ ], image: "assets/images/push_up.png", gif: 'assets/images/push_up.gif', - trackedKeypoint: kKeypointDict['right_shoulder'] as int, + trackedKeypoint: kKeypointDict['left_shoulder'] as int, trackingDirection: 0, fullRepPosition: true, formCorrectnessModel: 'models/pushUp_version2.tflite', @@ -45,7 +45,7 @@ final List availableExercises = [ 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.", + "Your phone's camera should be able to view your entire body's left side, specially your left 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.", diff --git a/pubspec.lock b/pubspec.lock index 070553d..35431fc 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -380,10 +380,10 @@ packages: dependency: transitive description: name: google_sign_in_android - sha256: "258864d68b68f2b2846c10283b7afb95f26ff3307c410a2841a010d034b65439" + sha256: "8d60a787b29cb7d2bcf29230865f4a91f17323c6ac5b6b9027a6418e48d9ffc3" url: "https://pub.dev" source: hosted - version: "6.1.17" + version: "6.1.18" google_sign_in_ios: dependency: transitive description: