From 973eda2a96054ee19e076f61f75b5d8d62415b2e Mon Sep 17 00:00:00 2001 From: otbenjello Date: Wed, 15 Nov 2023 16:31:05 +0100 Subject: [PATCH 01/55] web signup --- lib/view/login/web/web_signup_view.dart | 84 +++---------------------- 1 file changed, 7 insertions(+), 77 deletions(-) diff --git a/lib/view/login/web/web_signup_view.dart b/lib/view/login/web/web_signup_view.dart index 46a7087..5cfcf74 100644 --- a/lib/view/login/web/web_signup_view.dart +++ b/lib/view/login/web/web_signup_view.dart @@ -93,10 +93,13 @@ class _WebSignUpView extends State { body: SingleChildScrollView( child: SafeArea( child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), + padding: const EdgeInsets.symmetric(horizontal: 300), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ + SizedBox( + height: media.width * 0.04, + ), Text( "Bienvenue,", style: TextStyle(color: TColor.gray, fontSize: 16), @@ -170,15 +173,13 @@ class _WebSignUpView extends State { ) ], ), - SizedBox( - height: media.width * 0.05, - ), + Visibility( visible: _errorCreateUser, child: Text("Error - $_msgError", style: TextStyle(color: TColor.red))), SizedBox( - height: media.width * 0.4, + height: media.width * 0.05, ), RoundButton( title: "Créer un compte", @@ -206,78 +207,7 @@ class _WebSignUpView extends State { SizedBox( height: media.width * 0.04, ), - Row( - // crossAxisAlignment: CrossAxisAlignment., - children: [ - Expanded( - child: Container( - height: 1, - color: TColor.gray.withOpacity(0.5), - )), - Text( - " Ou ", - style: TextStyle(color: TColor.black, fontSize: 12), - ), - Expanded( - child: Container( - height: 1, - color: TColor.gray.withOpacity(0.5), - )), - ], - ), - SizedBox( - height: media.width * 0.04, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () {}, - child: Container( - width: 50, - height: 50, - alignment: Alignment.center, - decoration: BoxDecoration( - color: TColor.white, - border: Border.all( - width: 1, - color: TColor.gray.withOpacity(0.4), - ), - borderRadius: BorderRadius.circular(15), - ), - child: Image.asset( - "assets/img/google.png", - width: 20, - height: 20, - ), - ), - ), - SizedBox( - width: media.width * 0.04, - ), - GestureDetector( - onTap: () {}, - child: Container( - width: 50, - height: 50, - alignment: Alignment.center, - decoration: BoxDecoration( - color: TColor.white, - border: Border.all( - width: 1, - color: TColor.gray.withOpacity(0.4), - ), - borderRadius: BorderRadius.circular(15), - ), - child: Image.asset( - "assets/img/suunto.png", - width: 35, - height: 35, - ), - ), - ) - ], - ), + SizedBox( height: media.width * 0.04, ), From 35f4f2176292c5c8740948410a91cb947de55a06 Mon Sep 17 00:00:00 2001 From: otbenjello Date: Wed, 15 Nov 2023 16:35:51 +0100 Subject: [PATCH 02/55] login web --- lib/view/login/web/web_login_view.dart | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/lib/view/login/web/web_login_view.dart b/lib/view/login/web/web_login_view.dart index ceecf45..cfec9e7 100644 --- a/lib/view/login/web/web_login_view.dart +++ b/lib/view/login/web/web_login_view.dart @@ -76,7 +76,7 @@ class _WebLoginView extends State { body: SingleChildScrollView( child: SafeArea( child: Container( - padding: const EdgeInsets.symmetric(horizontal: 20), + padding: const EdgeInsets.symmetric(horizontal: 300), height: media.height, child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -182,25 +182,7 @@ class _WebLoginView extends State { SizedBox( height: media.width * 0.04, ), - Row( - // crossAxisAlignment: CrossAxisAlignment., - children: [ - Expanded( - child: Container( - height: 1, - color: TColor.gray.withOpacity(0.5), - )), - Text( - " Or ", - style: TextStyle(color: TColor.black, fontSize: 12), - ), - Expanded( - child: Container( - height: 1, - color: TColor.gray.withOpacity(0.5), - )), - ], - ), + SizedBox( height: media.width * 0.04, ), From bb1f28ac6e8e8ec70b08cc322977acbca0d5228b Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 10:28:26 +0100 Subject: [PATCH 03/55] add ci/cd for smartfit_ web --- .drone.yml | 41 ++++++++++++++++++++++++++++++++++++++++- Dockerfile | 2 ++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml index ca59f89..3724950 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,6 +18,41 @@ steps: - curl -F "file=@$sfm_apk" https://anonfiles.me/api/v1/upload > upload.json - cat upload.json | cut -d '"' -f 12 + - name: build-web + image: ghcr.io/cirruslabs/flutter:3.13.9 + volumes: + - name: web_build + - path: /build + commands: + - flutter build web --web-rendere canvakit + - cp ./build/web/* /build + + - name: build-web-image + image: plugins/docker + volumes: + - name: web_build + - path: /build + settings: + dockerfile: Dockerfile + context: . + registry: hub.codefirst.iut.uca.fr + repo: hub.codefisrt.iut.uca.fr/remi.arnal/smartfit_web + username: + from_secret: cf_username + password: + from_password: cf_password + depends_on: [build-web] + + - name: deploy-web-image + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest + environement: + IMAGENAME: hub.codefirst.iut.uca.fr/remi.arnal/smartfit_web + CONTAINERNAME: smartfit_web + COMMAND: create + OVERWRITE: true + ADMINS: remiarnal,enzojolys,othmanebenjelloun + depends_on: [build-web-image] + - name: code-analysis image: ghcr.io/cirruslabs/flutter:3.13.9 environment: @@ -31,4 +66,8 @@ steps: - export PATH=$SONAR_SCANNER_HOME/bin:$PATH - export SONAR_SCANNER_OPTS="-server" - sonar-scanner -D sonar.projectKey=SmartFit_Mobile -D sonar.sources=. -D sonar.host.url=https://codefirst.iut.uca.fr/sonar -D sonar.login=$${SONAR_TOKEN} - depends_on: [ build-apk ] \ No newline at end of file + depends_on: [ build-apk, build-web ] + +volumes: + - name: web_build + temp: {} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..73d7a1a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,2 @@ +FROM httpd:2.4 +COPY /build/ /usr/local/apache2/htdocs/ From 4fe2ffde29dc1a59f65cda6d318fb6982635e85e Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 10:35:18 +0100 Subject: [PATCH 04/55] drone volume error --- .drone.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 3724950..a06402b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,7 +21,7 @@ steps: - name: build-web image: ghcr.io/cirruslabs/flutter:3.13.9 volumes: - - name: web_build + - name: build - path: /build commands: - flutter build web --web-rendere canvakit @@ -30,7 +30,7 @@ steps: - name: build-web-image image: plugins/docker volumes: - - name: web_build + - name: build - path: /build settings: dockerfile: Dockerfile @@ -69,5 +69,5 @@ steps: depends_on: [ build-apk, build-web ] volumes: - - name: web_build - temp: {} + - name: build + temp: {} From 18ecb4c0055156c266b67e216c3912908bfc2de8 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 10:44:45 +0100 Subject: [PATCH 05/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index a06402b..2b01006 100644 --- a/.drone.yml +++ b/.drone.yml @@ -70,4 +70,4 @@ steps: volumes: - name: build - temp: {} + path: /tmp/build From 6417bb712f9c1c9bb39978c2c089bb53c7d05738 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 10:45:15 +0100 Subject: [PATCH 06/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 2b01006..dee5a5c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -24,7 +24,7 @@ steps: - name: build - path: /build commands: - - flutter build web --web-rendere canvakit + - flutter build web --web-renderer canvakit - cp ./build/web/* /build - name: build-web-image From 955026db88014c5aa47807fe1e7e0c4578d3d43f Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 10:45:36 +0100 Subject: [PATCH 07/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index dee5a5c..f37fc99 100644 --- a/.drone.yml +++ b/.drone.yml @@ -24,7 +24,7 @@ steps: - name: build - path: /build commands: - - flutter build web --web-renderer canvakit + - flutter build web --web-renderer canvaskit - cp ./build/web/* /build - name: build-web-image From 476154aacd122631ce8696f15c579f7e176e9122 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 10:47:27 +0100 Subject: [PATCH 08/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index f37fc99..0f7ebd0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,7 +25,7 @@ steps: - path: /build commands: - flutter build web --web-renderer canvaskit - - cp ./build/web/* /build + - cp ./build/web/* /build/ - name: build-web-image image: plugins/docker From bc428517242a2ac0a6b65d759e8cc1b8e5b83c3f Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 10:50:09 +0100 Subject: [PATCH 09/55] Update '.drone.yml' --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 0f7ebd0..f67abd7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,7 +25,7 @@ steps: - path: /build commands: - flutter build web --web-renderer canvaskit - - cp ./build/web/* /build/ + - cp ./build/web/* /build - name: build-web-image image: plugins/docker @@ -70,4 +70,4 @@ steps: volumes: - name: build - path: /tmp/build + path: /build From c6c1d9952903d2ad6aa63e15b5a69a8fd01b151a Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 10:55:12 +0100 Subject: [PATCH 10/55] Update '.drone.yml' --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index f67abd7..b026a42 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,6 +25,7 @@ steps: - path: /build commands: - flutter build web --web-renderer canvaskit + - mkdir /build - cp ./build/web/* /build - name: build-web-image From 9d2aecac5be199c8f30f44cf62be8cec9afb9ac5 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 10:56:59 +0100 Subject: [PATCH 11/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index b026a42..c27a03d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,7 +26,7 @@ steps: commands: - flutter build web --web-renderer canvaskit - mkdir /build - - cp ./build/web/* /build + - cp -r ./build/web/* /build - name: build-web-image image: plugins/docker From 3f13e4631009397939948d44a70ba4069786a2c1 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 11:02:52 +0100 Subject: [PATCH 12/55] Update '.drone.yml' --- .drone.yml | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/.drone.yml b/.drone.yml index c27a03d..8571d93 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,14 +9,14 @@ trigger: - master steps: - - name: build-apk - image: ghcr.io/cirruslabs/flutter:3.13.9 - commands: - - flutter build apk - - sfm_apk=sfm_$(date +"%Y_%m_%d_%H_%M_%S").apk - - cp ./build/app/outputs/flutter-apk/app-release.apk $sfm_apk - - curl -F "file=@$sfm_apk" https://anonfiles.me/api/v1/upload > upload.json - - cat upload.json | cut -d '"' -f 12 + # - name: build-apk + # image: ghcr.io/cirruslabs/flutter:3.13.9 + # commands: + # - flutter build apk + # - sfm_apk=sfm_$(date +"%Y_%m_%d_%H_%M_%S").apk + # - cp ./build/app/outputs/flutter-apk/app-release.apk $sfm_apk + # - curl -F "file=@$sfm_apk" https://anonfiles.me/api/v1/upload > upload.json + # - cat upload.json | cut -d '"' -f 12 - name: build-web image: ghcr.io/cirruslabs/flutter:3.13.9 @@ -24,6 +24,7 @@ steps: - name: build - path: /build commands: + - pwd - flutter build web --web-renderer canvaskit - mkdir /build - cp -r ./build/web/* /build @@ -54,21 +55,21 @@ steps: ADMINS: remiarnal,enzojolys,othmanebenjelloun depends_on: [build-web-image] - - name: code-analysis - image: ghcr.io/cirruslabs/flutter:3.13.9 - environment: - SONAR_TOKEN: - from_secret: sonar_token - commands: - - export SONAR_SCANNER_VERSION=5.0.1.3006 - - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux - - curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip - - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ - - export PATH=$SONAR_SCANNER_HOME/bin:$PATH - - export SONAR_SCANNER_OPTS="-server" - - sonar-scanner -D sonar.projectKey=SmartFit_Mobile -D sonar.sources=. -D sonar.host.url=https://codefirst.iut.uca.fr/sonar -D sonar.login=$${SONAR_TOKEN} - depends_on: [ build-apk, build-web ] + # - name: code-analysis + # image: ghcr.io/cirruslabs/flutter:3.13.9 + # environment: + # SONAR_TOKEN: + # from_secret: sonar_token + # commands: + # - export SONAR_SCANNER_VERSION=5.0.1.3006 + # - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux + # - curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip + # - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ + # - export PATH=$SONAR_SCANNER_HOME/bin:$PATH + # - export SONAR_SCANNER_OPTS="-server" + # - sonar-scanner -D sonar.projectKey=SmartFit_Mobile -D sonar.sources=. -D sonar.host.url=https://codefirst.iut.uca.fr/sonar -D sonar.login=$${SONAR_TOKEN} + # depends_on: [ build-apk, build-web ] volumes: - name: build - path: /build + path: /tmp/build From fecd62ea3373d96648b21f974733f7bab284b5cb Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 11:07:04 +0100 Subject: [PATCH 13/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 8571d93..ac3b1b1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -72,4 +72,4 @@ steps: volumes: - name: build - path: /tmp/build + temp: {} From 95d248df6e51a2307e0cb6a9c96ef8c5c7bb6a1e Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 11:15:05 +0100 Subject: [PATCH 14/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index ac3b1b1..3a4f062 100644 --- a/.drone.yml +++ b/.drone.yml @@ -72,4 +72,4 @@ steps: volumes: - name: build - temp: {} + path: /tmp/smartfit_build From d5cb419cdce1fc27c72cec383750108113cf867f Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 11:29:48 +0100 Subject: [PATCH 15/55] Update '.drone.yml' --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 3a4f062..a677f57 100644 --- a/.drone.yml +++ b/.drone.yml @@ -31,9 +31,9 @@ steps: - name: build-web-image image: plugins/docker - volumes: - - name: build - - path: /build + # volumes: + # - name: build + # - path: /build settings: dockerfile: Dockerfile context: . From 05dd00aee54c508ae3ae539445e5c4a526a2cf30 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 11:32:46 +0100 Subject: [PATCH 16/55] Update '.drone.yml' --- .drone.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index a677f57..776b75a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -31,14 +31,14 @@ steps: - name: build-web-image image: plugins/docker - # volumes: - # - name: build - # - path: /build + volumes: + - name: build + - path: /build settings: dockerfile: Dockerfile context: . registry: hub.codefirst.iut.uca.fr - repo: hub.codefisrt.iut.uca.fr/remi.arnal/smartfit_web + repo: hub.codefirst.iut.uca.fr/remi.arnal/smartfit_web username: from_secret: cf_username password: From 3fe3f04a6478548aeec046982c5fd3ba3afd48f1 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 11:36:10 +0100 Subject: [PATCH 17/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 776b75a..98091db 100644 --- a/.drone.yml +++ b/.drone.yml @@ -42,7 +42,7 @@ steps: username: from_secret: cf_username password: - from_password: cf_password + from_secret: cf_password depends_on: [build-web] - name: deploy-web-image From 02b422b0b8c36dd6e086ca140973613e12d3414c Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 11:38:15 +0100 Subject: [PATCH 18/55] Update '.drone.yml' --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 98091db..e5783a5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -31,9 +31,9 @@ steps: - name: build-web-image image: plugins/docker - volumes: - - name: build - - path: /build + # volumes: + # - name: build + # - path: /build settings: dockerfile: Dockerfile context: . From ab05003ce667f594c184c584d3a2a3a8a4e4f066 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 11:51:00 +0100 Subject: [PATCH 19/55] Update '.drone.yml' --- .drone.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index e5783a5..dcc91b5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -22,18 +22,20 @@ steps: image: ghcr.io/cirruslabs/flutter:3.13.9 volumes: - name: build - - path: /build + - path: /tmp/smartfit_build commands: - pwd - flutter build web --web-renderer canvaskit - - mkdir /build - - cp -r ./build/web/* /build + - mkdir /tmp/smartfit_build + - cp -r ./build/web/* /tmp/smartfit_build + - ls /tmp/smartfit_build + - mountpoint /tmp/smartfit_build - name: build-web-image image: plugins/docker - # volumes: - # - name: build - # - path: /build + volumes: + - name: build + - path: /tmp/smartfit_build settings: dockerfile: Dockerfile context: . From a7d1525c907e5e93eb0a0ac68490e4dcf02db707 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 11:54:45 +0100 Subject: [PATCH 20/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index dcc91b5..4cbf4b9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -29,7 +29,7 @@ steps: - mkdir /tmp/smartfit_build - cp -r ./build/web/* /tmp/smartfit_build - ls /tmp/smartfit_build - - mountpoint /tmp/smartfit_build + # - mountpoint /tmp/smartfit_build - name: build-web-image image: plugins/docker From c197b1128b6848c88daf7454ed629cb3bb9af25f Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 12:15:56 +0100 Subject: [PATCH 21/55] Update '.drone.yml' --- .drone.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 4cbf4b9..b8e96e8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -74,4 +74,3 @@ steps: volumes: - name: build - path: /tmp/smartfit_build From 2619756854b36b84c85236bc0c942b0fec3a4730 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 12:18:17 +0100 Subject: [PATCH 22/55] Update '.drone.yml' --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index b8e96e8..00c11e3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -74,3 +74,4 @@ steps: volumes: - name: build + temp: {} From e555fcfbff77311f70b28e587bc39e035efaaf75 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 12:20:17 +0100 Subject: [PATCH 23/55] Update '.drone.yml' --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 00c11e3..489bec6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,7 +21,7 @@ steps: - name: build-web image: ghcr.io/cirruslabs/flutter:3.13.9 volumes: - - name: build + - name: docs - path: /tmp/smartfit_build commands: - pwd @@ -34,7 +34,7 @@ steps: - name: build-web-image image: plugins/docker volumes: - - name: build + - name: docs - path: /tmp/smartfit_build settings: dockerfile: Dockerfile @@ -73,5 +73,5 @@ steps: # depends_on: [ build-apk, build-web ] volumes: - - name: build + - name: docs temp: {} From 02b68345597aff816111d92ed26f46beb9a8ef21 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 12:21:19 +0100 Subject: [PATCH 24/55] Update '.drone.yml' --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 489bec6..c44aa5b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -22,7 +22,7 @@ steps: image: ghcr.io/cirruslabs/flutter:3.13.9 volumes: - name: docs - - path: /tmp/smartfit_build + path: /tmp/smartfit_build commands: - pwd - flutter build web --web-renderer canvaskit @@ -35,7 +35,7 @@ steps: image: plugins/docker volumes: - name: docs - - path: /tmp/smartfit_build + path: /tmp/smartfit_build settings: dockerfile: Dockerfile context: . From 55d4be08979de9592f24c76fabb894a10d651977 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 12:22:10 +0100 Subject: [PATCH 25/55] Update '.drone.yml' --- .drone.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index c44aa5b..8884aba 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,7 +21,7 @@ steps: - name: build-web image: ghcr.io/cirruslabs/flutter:3.13.9 volumes: - - name: docs + - name: build path: /tmp/smartfit_build commands: - pwd @@ -29,12 +29,12 @@ steps: - mkdir /tmp/smartfit_build - cp -r ./build/web/* /tmp/smartfit_build - ls /tmp/smartfit_build - # - mountpoint /tmp/smartfit_build + - mountpoint /tmp/smartfit_build - name: build-web-image image: plugins/docker volumes: - - name: docs + - name: build path: /tmp/smartfit_build settings: dockerfile: Dockerfile @@ -73,5 +73,5 @@ steps: # depends_on: [ build-apk, build-web ] volumes: - - name: docs + - name: build temp: {} From c7054b8b569c604d851945b55b30733b96fe8a76 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 12:23:28 +0100 Subject: [PATCH 26/55] Update '.drone.yml' --- .drone.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 8884aba..5427867 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,7 +26,6 @@ steps: commands: - pwd - flutter build web --web-renderer canvaskit - - mkdir /tmp/smartfit_build - cp -r ./build/web/* /tmp/smartfit_build - ls /tmp/smartfit_build - mountpoint /tmp/smartfit_build From 7ad5de6f25626096d9cde48095b194238fee7fa9 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 12:41:45 +0100 Subject: [PATCH 27/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 5427867..f37ffb4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -37,7 +37,7 @@ steps: path: /tmp/smartfit_build settings: dockerfile: Dockerfile - context: . + context: / registry: hub.codefirst.iut.uca.fr repo: hub.codefirst.iut.uca.fr/remi.arnal/smartfit_web username: From 90ee9a58e82cc34a3924c9319d65a0c42e5ffd28 Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 12:46:42 +0100 Subject: [PATCH 28/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index f37ffb4..5427867 100644 --- a/.drone.yml +++ b/.drone.yml @@ -37,7 +37,7 @@ steps: path: /tmp/smartfit_build settings: dockerfile: Dockerfile - context: / + context: . registry: hub.codefirst.iut.uca.fr repo: hub.codefirst.iut.uca.fr/remi.arnal/smartfit_web username: From a25aca77f0a72223e771ecc385a935f4bcfa77dc Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 12:54:51 +0100 Subject: [PATCH 29/55] Update '.drone.yml' --- .drone.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 5427867..dac0ffa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -24,17 +24,15 @@ steps: - name: build path: /tmp/smartfit_build commands: - - pwd - flutter build web --web-renderer canvaskit - cp -r ./build/web/* /tmp/smartfit_build - - ls /tmp/smartfit_build - - mountpoint /tmp/smartfit_build + # - mountpoint /tmp/smartfit_build - name: build-web-image - image: plugins/docker volumes: - name: build path: /tmp/smartfit_build + image: plugins/docker settings: dockerfile: Dockerfile context: . From 693085f47681e7bf6e6109fe7110e2dced64952b Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 13:34:51 +0100 Subject: [PATCH 30/55] Update '.drone.yml' --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index dac0ffa..fbd4b98 100644 --- a/.drone.yml +++ b/.drone.yml @@ -29,9 +29,6 @@ steps: # - mountpoint /tmp/smartfit_build - name: build-web-image - volumes: - - name: build - path: /tmp/smartfit_build image: plugins/docker settings: dockerfile: Dockerfile @@ -42,6 +39,9 @@ steps: from_secret: cf_username password: from_secret: cf_password + volumes: + - name: build + path: /tmp/smartfit_build depends_on: [build-web] - name: deploy-web-image From f53fcc6f2ec2788a656a856c9ba51408aab17e2d Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 14:08:52 +0100 Subject: [PATCH 31/55] Update '.drone.yml' --- .drone.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index fbd4b98..03f52ea 100644 --- a/.drone.yml +++ b/.drone.yml @@ -39,9 +39,6 @@ steps: from_secret: cf_username password: from_secret: cf_password - volumes: - - name: build - path: /tmp/smartfit_build depends_on: [build-web] - name: deploy-web-image From 62ba0046544ea38fe74032bee666aaf1ba3dc0f1 Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 14:25:36 +0100 Subject: [PATCH 32/55] remake web ci --- .drone.yml | 18 +++++++++--------- Dockerfile | 12 ++++++++++-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.drone.yml b/.drone.yml index 03f52ea..7bf00f9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,15 +18,15 @@ steps: # - curl -F "file=@$sfm_apk" https://anonfiles.me/api/v1/upload > upload.json # - cat upload.json | cut -d '"' -f 12 - - name: build-web - image: ghcr.io/cirruslabs/flutter:3.13.9 - volumes: - - name: build - path: /tmp/smartfit_build - commands: - - flutter build web --web-renderer canvaskit - - cp -r ./build/web/* /tmp/smartfit_build - # - mountpoint /tmp/smartfit_build + # - name: build-web + # image: ghcr.io/cirruslabs/flutter:3.13.9 + # volumes: + # - name: build + # path: /tmp/smartfit_build + # commands: + # - flutter build web --web-renderer canvaskit + # - cp -r ./build/web/* /tmp/smartfit_build + # # - mountpoint /tmp/smartfit_build - name: build-web-image image: plugins/docker diff --git a/Dockerfile b/Dockerfile index 73d7a1a..ca2b9ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,10 @@ -FROM httpd:2.4 -COPY /build/ /usr/local/apache2/htdocs/ +FROM ghcr.io/cirruslabs/flutter:3.16.0 +RUN apt-get install php +RUN pwd +RUN ls + +COPY ./ ./ +WORKDIR ./ + +RUN flutter build web --renderer canvaskit +ENTRYPOINT php -S localhost:8080 -t ./build/web/ From 4663fd565686cf80420cd4b83d5e45aa8f24745b Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 14:27:31 +0100 Subject: [PATCH 33/55] ok --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 7bf00f9..c6ac7ec 100644 --- a/.drone.yml +++ b/.drone.yml @@ -39,7 +39,7 @@ steps: from_secret: cf_username password: from_secret: cf_password - depends_on: [build-web] +# depends_on: [build-web] - name: deploy-web-image image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest From 3fe882a2116cde50da1a75c00e90a4b488aee9b6 Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 14:29:58 +0100 Subject: [PATCH 34/55] ... --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ca2b9ad..79da437 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM ghcr.io/cirruslabs/flutter:3.16.0 -RUN apt-get install php +RUN apt install php-common php-cli RUN pwd RUN ls From e8cff917d55d8015395c0d3f3b41a89310d6284a Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 14:36:32 +0100 Subject: [PATCH 35/55] ... --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 79da437..ad4e995 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM ghcr.io/cirruslabs/flutter:3.16.0 -RUN apt install php-common php-cli +RUN uname -a +RUN apt-get install php-common php-cli RUN pwd RUN ls From 0b2417777ca7f6b7b82e4b53daaa2f144184673e Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 14:40:07 +0100 Subject: [PATCH 36/55] ...C --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ad4e995..195056b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM ghcr.io/cirruslabs/flutter:3.16.0 RUN uname -a -RUN apt-get install php-common php-cli +RUN apt-get update && apt-get install php-common php-cli php RUN pwd RUN ls From c04ef8117a667f04ca1a63700efeb49ce3db1fc3 Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 14:42:46 +0100 Subject: [PATCH 37/55] -y --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 195056b..bc0cc78 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM ghcr.io/cirruslabs/flutter:3.16.0 RUN uname -a -RUN apt-get update && apt-get install php-common php-cli php +RUN apt-get update && apt-get -y install php-common php-cli php RUN pwd RUN ls From b1c3f37a4db5f08888188abff11ac4a7ba4fe0f8 Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 14:47:54 +0100 Subject: [PATCH 38/55] bypass location asked by term --- Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index bc0cc78..2701cca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,8 @@ FROM ghcr.io/cirruslabs/flutter:3.16.0 -RUN uname -a +ENV TZ=Europe/Paris +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update && apt-get -y install php-common php-cli php -RUN pwd -RUN ls COPY ./ ./ -WORKDIR ./ - RUN flutter build web --renderer canvaskit ENTRYPOINT php -S localhost:8080 -t ./build/web/ From 13e061275f91017076d3c5189eb6418520c37402 Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 14:49:58 +0100 Subject: [PATCH 39/55] fix bad flutter build command --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2701cca..be759bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,5 +4,5 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update && apt-get -y install php-common php-cli php COPY ./ ./ -RUN flutter build web --renderer canvaskit +RUN flutter build web --web-renderer canvaskit ENTRYPOINT php -S localhost:8080 -t ./build/web/ From 1b7e9ba157f87f046e481cf28869bf9309cc0611 Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 14:54:26 +0100 Subject: [PATCH 40/55] ? --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index be759bb..a52c951 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,11 @@ -FROM ghcr.io/cirruslabs/flutter:3.16.0 +FROM ghcr.io/cirruslabs/flutter:3.13.9 ENV TZ=Europe/Paris RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update && apt-get -y install php-common php-cli php COPY ./ ./ +RUN pwd +RUN ls +RUN tree RUN flutter build web --web-renderer canvaskit ENTRYPOINT php -S localhost:8080 -t ./build/web/ From 43683c0ed95071dd07212f01fc8e3615f4817fd0 Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 15:00:30 +0100 Subject: [PATCH 41/55] ...C --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a52c951..49d74d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,9 @@ ENV TZ=Europe/Paris RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update && apt-get -y install php-common php-cli php -COPY ./ ./ -RUN pwd RUN ls RUN tree +RUN pwd +COPY ./ ./ RUN flutter build web --web-renderer canvaskit ENTRYPOINT php -S localhost:8080 -t ./build/web/ From b5f3dd99324f92e8dffd0dfc2ee5ab54ed0a7170 Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 15:03:23 +0100 Subject: [PATCH 42/55] ...1C --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 49d74d0..a32797f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,10 @@ FROM ghcr.io/cirruslabs/flutter:3.13.9 ENV TZ=Europe/Paris RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update && apt-get -y install php-common php-cli php +RUN mkdir /tmp/smartfit_web +WORKDIR /tmp/smartfit_web RUN ls -RUN tree RUN pwd COPY ./ ./ RUN flutter build web --web-renderer canvaskit From 43dac1ca02330d3848ade4e82eeb58ca79a50dfa Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 15:07:22 +0100 Subject: [PATCH 43/55] Update '.drone.yml' --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index c6ac7ec..1dfce9f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -66,6 +66,6 @@ steps: # - sonar-scanner -D sonar.projectKey=SmartFit_Mobile -D sonar.sources=. -D sonar.host.url=https://codefirst.iut.uca.fr/sonar -D sonar.login=$${SONAR_TOKEN} # depends_on: [ build-apk, build-web ] -volumes: - - name: build - temp: {} +# volumes: +# - name: build +# temp: {} \ No newline at end of file From a5e46133ac79e489a765fa999b2413fdf741f23c Mon Sep 17 00:00:00 2001 From: rem Date: Thu, 16 Nov 2023 15:11:02 +0100 Subject: [PATCH 44/55] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 1dfce9f..df3b098 100644 --- a/.drone.yml +++ b/.drone.yml @@ -43,7 +43,7 @@ steps: - name: deploy-web-image image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest - environement: + environment: IMAGENAME: hub.codefirst.iut.uca.fr/remi.arnal/smartfit_web CONTAINERNAME: smartfit_web COMMAND: create From 2fdde64998413fad73d780903a42e3aecb0c07d4 Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 15:19:47 +0100 Subject: [PATCH 45/55] maybe --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a32797f..e89a9d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,9 @@ RUN apt-get update && apt-get -y install php-common php-cli php RUN mkdir /tmp/smartfit_web WORKDIR /tmp/smartfit_web -RUN ls -RUN pwd COPY ./ ./ RUN flutter build web --web-renderer canvaskit + +RUN php -v +EXPOSE 80 ENTRYPOINT php -S localhost:8080 -t ./build/web/ From f38b49fcd53ce79d65199a41a8283123bf66916a Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 16:41:50 +0100 Subject: [PATCH 46/55] add firebase conf --- .firebaserc | 5 +++++ .gitignore | 5 ++++- Dockerfile | 13 ------------- firebase.json | 16 ++++++++++++++++ 4 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 .firebaserc delete mode 100644 Dockerfile create mode 100644 firebase.json diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 0000000..e3ee79c --- /dev/null +++ b/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "smartfit-9b86c" + } +} diff --git a/.gitignore b/.gitignore index bea03cd..db7fc69 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,9 @@ .history .svn/ +# Firebase +.firebase/ + # IntelliJ related *.iml *.ipr @@ -125,4 +128,4 @@ linux/flutter/generated_plugins.cmake windows/flutter/generated_plugin_registrant.cc windows/flutter/generated_plugins.cmake -flutter/ \ No newline at end of file +flutter/ diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e89a9d3..0000000 --- a/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM ghcr.io/cirruslabs/flutter:3.13.9 -ENV TZ=Europe/Paris -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -RUN apt-get update && apt-get -y install php-common php-cli php -RUN mkdir /tmp/smartfit_web -WORKDIR /tmp/smartfit_web - -COPY ./ ./ -RUN flutter build web --web-renderer canvaskit - -RUN php -v -EXPOSE 80 -ENTRYPOINT php -S localhost:8080 -t ./build/web/ diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000..6603732 --- /dev/null +++ b/firebase.json @@ -0,0 +1,16 @@ +{ + "hosting": { + "public": "build/web", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + } +} From 6e390f8eb58766322a67cd3b0bb83eaf8613a6db Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 16:47:07 +0100 Subject: [PATCH 47/55] attempt to deploy web to firebase --- .drone.yml | 45 +++++++++------------------------------------ 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/.drone.yml b/.drone.yml index df3b098..4d14c8f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,39 +18,16 @@ steps: # - curl -F "file=@$sfm_apk" https://anonfiles.me/api/v1/upload > upload.json # - cat upload.json | cut -d '"' -f 12 - # - name: build-web - # image: ghcr.io/cirruslabs/flutter:3.13.9 - # volumes: - # - name: build - # path: /tmp/smartfit_build - # commands: - # - flutter build web --web-renderer canvaskit - # - cp -r ./build/web/* /tmp/smartfit_build - # # - mountpoint /tmp/smartfit_build - - - name: build-web-image - image: plugins/docker - settings: - dockerfile: Dockerfile - context: . - registry: hub.codefirst.iut.uca.fr - repo: hub.codefirst.iut.uca.fr/remi.arnal/smartfit_web - username: - from_secret: cf_username - password: - from_secret: cf_password -# depends_on: [build-web] - - - name: deploy-web-image - image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest + - name: build-web + image: ghcr.io/cirruslabs/flutter:3.13.9 environment: - IMAGENAME: hub.codefirst.iut.uca.fr/remi.arnal/smartfit_web - CONTAINERNAME: smartfit_web - COMMAND: create - OVERWRITE: true - ADMINS: remiarnal,enzojolys,othmanebenjelloun - depends_on: [build-web-image] - + FIREBASE_TOKEN: + from_secret: firebase_token + commands: + - flutter build web --web-renderer canvaskit + - curl -sL https://firebase.tools | bash + - firebase deploy --token $${FIREBASE_TOKEN} + # - name: code-analysis # image: ghcr.io/cirruslabs/flutter:3.13.9 # environment: @@ -65,7 +42,3 @@ steps: # - export SONAR_SCANNER_OPTS="-server" # - sonar-scanner -D sonar.projectKey=SmartFit_Mobile -D sonar.sources=. -D sonar.host.url=https://codefirst.iut.uca.fr/sonar -D sonar.login=$${SONAR_TOKEN} # depends_on: [ build-apk, build-web ] - -# volumes: -# - name: build -# temp: {} \ No newline at end of file From 3a6ea9d773f93c61b59323151522bc200a1f60c5 Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 16 Nov 2023 16:54:42 +0100 Subject: [PATCH 48/55] re-enable apk-build & sonarqube --- .drone.yml | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4d14c8f..e380b6d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,14 +9,14 @@ trigger: - master steps: - # - name: build-apk - # image: ghcr.io/cirruslabs/flutter:3.13.9 - # commands: - # - flutter build apk - # - sfm_apk=sfm_$(date +"%Y_%m_%d_%H_%M_%S").apk - # - cp ./build/app/outputs/flutter-apk/app-release.apk $sfm_apk - # - curl -F "file=@$sfm_apk" https://anonfiles.me/api/v1/upload > upload.json - # - cat upload.json | cut -d '"' -f 12 + - name: build-apk + image: ghcr.io/cirruslabs/flutter:3.13.9 + commands: + - flutter build apk + - sfm_apk=sfm_$(date +"%Y_%m_%d_%H_%M_%S").apk + - cp ./build/app/outputs/flutter-apk/app-release.apk $sfm_apk + - curl -F "file=@$sfm_apk" https://anonfiles.me/api/v1/upload > upload.json + - cat upload.json | cut -d '"' -f 12 - name: build-web image: ghcr.io/cirruslabs/flutter:3.13.9 @@ -28,17 +28,17 @@ steps: - curl -sL https://firebase.tools | bash - firebase deploy --token $${FIREBASE_TOKEN} - # - name: code-analysis - # image: ghcr.io/cirruslabs/flutter:3.13.9 - # environment: - # SONAR_TOKEN: - # from_secret: sonar_token - # commands: - # - export SONAR_SCANNER_VERSION=5.0.1.3006 - # - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux - # - curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip - # - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ - # - export PATH=$SONAR_SCANNER_HOME/bin:$PATH - # - export SONAR_SCANNER_OPTS="-server" - # - sonar-scanner -D sonar.projectKey=SmartFit_Mobile -D sonar.sources=. -D sonar.host.url=https://codefirst.iut.uca.fr/sonar -D sonar.login=$${SONAR_TOKEN} - # depends_on: [ build-apk, build-web ] + - name: code-analysis + image: ghcr.io/cirruslabs/flutter:3.13.9 + environment: + SONAR_TOKEN: + from_secret: sonar_token + commands: + - export SONAR_SCANNER_VERSION=5.0.1.3006 + - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux + - curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip + - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ + - export PATH=$SONAR_SCANNER_HOME/bin:$PATH + - export SONAR_SCANNER_OPTS="-server" + - sonar-scanner -D sonar.projectKey=SmartFit_Mobile -D sonar.sources=. -D sonar.host.url=https://codefirst.iut.uca.fr/sonar -D sonar.login=$${SONAR_TOKEN} + depends_on: [ build-apk, build-web ] From 421398f96e751ce4455a15ce244cef8473f0b678 Mon Sep 17 00:00:00 2001 From: Enzo Date: Mon, 20 Nov 2023 15:36:33 +0100 Subject: [PATCH 49/55] Home + Maps --- lib/common_widget/graph/altitude_by_time.dart | 9 +- lib/common_widget/stats.dart | 5 +- lib/modele/activity.dart | 134 +++++++++------ lib/modele/utile/maps/maps_utile.dart | 16 ++ lib/view/home/mobile/mobile_homeview.dart | 56 +++++-- lib/view/home/web/web_homeview.dart | 33 ++-- lib/view/map/mobile/mobile_my_map.dart | 46 ++++++ lib/view/map/my_map.dart | 155 ++---------------- lib/view/map/web/web_my_map.dart | 47 ++++++ lib/view/ne_pas_supprimer/map.txt | 131 +++++++++++++++ web/index.html | 3 + 11 files changed, 421 insertions(+), 214 deletions(-) create mode 100644 lib/modele/utile/maps/maps_utile.dart create mode 100644 lib/view/map/mobile/mobile_my_map.dart create mode 100644 lib/view/map/web/web_my_map.dart create mode 100644 lib/view/ne_pas_supprimer/map.txt diff --git a/lib/common_widget/graph/altitude_by_time.dart b/lib/common_widget/graph/altitude_by_time.dart index ff8c2b7..fcdd9ca 100644 --- a/lib/common_widget/graph/altitude_by_time.dart +++ b/lib/common_widget/graph/altitude_by_time.dart @@ -28,6 +28,9 @@ class _GraphAltitudeByTime extends State { LineChartBarData( spots: widget.data.altitudeSeconde, isCurved: false, + gradient: LinearGradient( + colors: TColor.primaryG, + ), dotData: const FlDotData(show: false)) ]; @@ -43,7 +46,7 @@ class _GraphAltitudeByTime extends State { gridData: FlGridData( drawVerticalLine: false, drawHorizontalLine: true, - horizontalInterval: 1, + horizontalInterval: (maxY - minY) / 5, getDrawingHorizontalLine: (value) { return FlLine( color: TColor.gray.withOpacity(0.15), @@ -56,10 +59,10 @@ class _GraphAltitudeByTime extends State { bottomTitles: const AxisTitles(), rightTitles: AxisTitles( sideTitles: SideTitles( - reservedSize: 50, + reservedSize: 60, showTitles: true, getTitlesWidget: (value, meta) { - return Text("${value.toInt()} m"); + return Text("${double.parse(value.toStringAsFixed(2))} m"); }, )), )))); diff --git a/lib/common_widget/stats.dart b/lib/common_widget/stats.dart index 2fcb512..1591d68 100644 --- a/lib/common_widget/stats.dart +++ b/lib/common_widget/stats.dart @@ -13,7 +13,8 @@ class Stats extends StatelessWidget { .getTotalCalorie(); String heartrate = Provider.of(context, listen: false) .listActivity[0] - .getTotalAvgHeartRate(); + .getAvgBpm() + .toString(); String time = Provider.of(context, listen: false) .listActivity[0] .getTotalTime(); @@ -152,8 +153,6 @@ class InfoStat extends StatelessWidget { } } - - class StatIcon extends StatelessWidget { const StatIcon({ Key? key, diff --git a/lib/modele/activity.dart b/lib/modele/activity.dart index bb525cb..6e7d6ca 100644 --- a/lib/modele/activity.dart +++ b/lib/modele/activity.dart @@ -1,4 +1,5 @@ import 'package:fl_chart/fl_chart.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:smartfit_app_mobile/common_widget/graph/graph.dart'; class ActivityOfUser { @@ -27,6 +28,7 @@ class ActivityOfUser { return 0; } + // ----------------- BPM ------------------ // List getHeartRateWithTime() { List result = List.empty(growable: true); int firtTimeStamp = 0; @@ -53,6 +55,35 @@ class ActivityOfUser { return result; } + int getMaxBpm() { + for (int i = 0; i < _contentActivity[_dataSession].length; i++) { + if (_contentActivity[_dataSession][i] == "max_heart_rate") { + return _contentActivity[_dataSession][i + 1]; + } + } + return 0; + } + + int getMinBpm() { + for (int i = 0; i < _contentActivity[_dataSession].length; i++) { + if (_contentActivity[_dataSession][i] == "min_heart_rate") { + return _contentActivity[_dataSession][i + 1]; + } + } + return 0; + } + + int getAvgBpm() { + for (int i = 0; i < _contentActivity[_dataSession].length; i++) { + if (_contentActivity[_dataSession][i] == "avg_heart_rate") { + return _contentActivity[_dataSession][i + 1]; + } + } + return 0; + } + // -------------------------- FIN BPM ---------------------- // + + // ---------------------- Distance ---------------------- // List getDistanceWithTime() { List result = List.empty(growable: true); int firtTimeStamp = 0; @@ -70,6 +101,18 @@ class ActivityOfUser { return result; } + String getTotalDistance() { + for (int i = 0; i < _contentActivity[_dataSession].length; i++) { + if (_contentActivity[_dataSession][i] == "total_distance") { + return _contentActivity[_dataSession][i + 1].toString(); + } + } + return "null"; + } + + // ---------------------- FIN Distance ---------------------- // + + // ---------------------- Calories ---------------------- // List getCalories() { List result = List.empty(growable: true); int firtTimeStamp = 0; @@ -88,41 +131,6 @@ class ActivityOfUser { return result; } - String getTotalSteps() { - for (int i = 0; i < _contentActivity[_dataSession].length; i++) { - if (_contentActivity[_dataSession][i] == "total_strides") { - return _contentActivity[_dataSession][i + 1].toString(); - } - } - return "null"; - } - - String getMaxBpm() { - for (int i = 0; i < _contentActivity[_dataSession].length; i++) { - if (_contentActivity[_dataSession][i] == "max_heart_rate") { - return _contentActivity[_dataSession][i + 1].toString(); - } - } - return "null"; - } - String getMinBpm() { - for (int i = 0; i < _contentActivity[_dataSession].length; i++) { - if (_contentActivity[_dataSession][i] == "min_heart_rate") { - return _contentActivity[_dataSession][i + 1].toString(); - } - } - return "null"; - } - - String getAvgBpm() { - for (int i = 0; i < _contentActivity[_dataSession].length; i++) { - if (_contentActivity[_dataSession][i] == "avg_heart_rate") { - return _contentActivity[_dataSession][i + 1].toString(); - } - } - return "null"; - } - String getTotalCalorie() { for (int i = 0; i < _contentActivity[_dataSession].length; i++) { if (_contentActivity[_dataSession][i] == "total_calories") { @@ -132,15 +140,20 @@ class ActivityOfUser { return "null"; } - String getTotalAvgHeartRate() { + // ---------------------- FIN Calories ---------------------- // + + // ---------------------- Step ------------------------------// + String getTotalSteps() { for (int i = 0; i < _contentActivity[_dataSession].length; i++) { - if (_contentActivity[_dataSession][i] == "avg_heart_rate") { + if (_contentActivity[_dataSession][i] == "total_strides") { return _contentActivity[_dataSession][i + 1].toString(); } } return "null"; } + // ----------------------- FIN Step ------------------------ // + // ------------------------- Time ----------------------------- // String getTotalTime() { for (int i = 0; i < _contentActivity[_dataSession].length; i++) { if (_contentActivity[_dataSession][i] == "total_elapsed_time") { @@ -149,15 +162,7 @@ class ActivityOfUser { } return "null"; } - - String getTotalDistance() { - for (int i = 0; i < _contentActivity[_dataSession].length; i++) { - if (_contentActivity[_dataSession][i] == "total_distance") { - return _contentActivity[_dataSession][i + 1].toString(); - } - } - return "null"; - } + // ---------------------------- FIN time -------------------- // // ---------------------------------------- Altitude -------------------- // List getAltitudeWithTime() { @@ -196,6 +201,8 @@ class ActivityOfUser { } // -------------------------- FIN altitude ---------------------- // + // -------------------------- Speed ---------------------- // + List getSpeedWithTime() { List result = List.empty(growable: true); int firtTimeStamp = 0; @@ -244,6 +251,41 @@ class ActivityOfUser { return result; } + double getMaxSpeed() { + for (int i = 4; i < _contentActivity[_dataSession].length; i++) { + if (_contentActivity[_dataSession][i] == "max_speed") { + return _contentActivity[_dataSession][i + 1]; + } + } + return 0.0; + } + + double getAvgSpeed() { + for (int i = 4; i < _contentActivity[_dataSession].length; i++) { + if (_contentActivity[_dataSession][i] == "avg_speed") { + return _contentActivity[_dataSession][i + 1]; + } + } + return 0.0; + } + + // -------------------------- FIN Speed ---------------------- // + + // -------------------------- Localisation ------------------- // + + List getPosition() { + List list = List.empty(growable: true); + + for (List ligne in _contentActivity) { + if (ligne[0] == "Data" && ligne[6] == "position_lat") { + list.add(LatLng(ligne[7], ligne[10])); + } + } + return list; + } + + // -------------------------- FIN Localisation ---------------------- // + Map toMap() { return { 'nomActivite': _nomActivite, diff --git a/lib/modele/utile/maps/maps_utile.dart b/lib/modele/utile/maps/maps_utile.dart new file mode 100644 index 0000000..e74c450 --- /dev/null +++ b/lib/modele/utile/maps/maps_utile.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:provider/provider.dart'; +import 'package:smartfit_app_mobile/modele/user.dart'; + +class MapUtil { + Set initPolines(BuildContext context, int largueur, Color couleur) { + Set _polylines = {}; + _polylines.add(Polyline( + polylineId: const PolylineId("Polyline"), + color: couleur, + points: context.watch().listActivity[0].getPosition(), + width: largueur)); + return _polylines; + } +} diff --git a/lib/view/home/mobile/mobile_homeview.dart b/lib/view/home/mobile/mobile_homeview.dart index f8a23cc..b051c31 100644 --- a/lib/view/home/mobile/mobile_homeview.dart +++ b/lib/view/home/mobile/mobile_homeview.dart @@ -24,9 +24,18 @@ class _MobileHomeView extends State { @override Widget build(BuildContext context) { var media = MediaQuery.of(context).size; - String maxBpm = context.watch().listActivity[0].getMaxBpm(); - String minBpm = context.watch().listActivity[0].getMinBpm(); - String avgBpm = context.watch().listActivity[0].getAvgBpm(); + // -- BPM -- // + int maxBpm = context.watch().listActivity[0].getMaxBpm(); + int minBpm = context.watch().listActivity[0].getMinBpm(); + int avgBpm = context.watch().listActivity[0].getAvgBpm(); + // -- Altitude -- // + double minAltitude = context.watch().listActivity[0].getMinAltitude(); + double maxAltitude = context.watch().listActivity[0].getMaxAltitude(); + double avgAltitude = (maxAltitude + minAltitude) / 2; + // -- Speed -- // + double maxSpeed = context.watch().listActivity[0].getMaxSpeed(); + double avgSpeed = context.watch().listActivity[0].getAvgSpeed(); + data = HomeViewUtil().initData(context); return Scaffold( @@ -57,9 +66,9 @@ class _MobileHomeView extends State { height: media.width * 0.05, ), LigneContainerStats( - "$minBpm BPM", - "$maxBpm BPM", - "$avgBpm BPM", + "${minBpm.toString()} BPM", + "${maxBpm.toString()} BPM", + "${avgBpm.toString()} BPM", "Minimum", "Maximum", "Moyenne", @@ -85,10 +94,36 @@ class _MobileHomeView extends State { SizedBox( height: media.width * 0.05, ), - const LigneContainerStats( - "30 BPM", - "90 BPM", - "290 BPM", + LigneContainerStats( + "${double.parse(maxSpeed.toStringAsFixed(2))} KM/H", + "${double.parse(avgSpeed.toStringAsFixed(2))} km/H", + "${avgBpm.toString()} BPM", + "Max Speed", + "Moyenne Speed", + "Moyenne BPM", + Icons.trending_down, + Icons.trending_up, + Icons.favorite_outline), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Altitude", + style: TextStyle( + color: TColor.black, + fontSize: 16, + fontWeight: FontWeight.w700), + ), + ], + ), + SizedBox( + height: media.width * 0.05, + ), + GraphAltitudeByTime(media, data), + LigneContainerStats( + "${minAltitude.toInt()} M", + "${maxAltitude.toInt()} M", + "${avgAltitude.toInt()} M", "Minimum", "Maximum", "Moyenne", @@ -98,7 +133,6 @@ class _MobileHomeView extends State { SizedBox( height: media.width * 0.05, ), - GraphAltitudeByTime(media, data) ], ), ), diff --git a/lib/view/home/web/web_homeview.dart b/lib/view/home/web/web_homeview.dart index 0976901..adeff48 100644 --- a/lib/view/home/web/web_homeview.dart +++ b/lib/view/home/web/web_homeview.dart @@ -24,9 +24,17 @@ class _WebHomeView extends State { @override Widget build(BuildContext context) { var media = MediaQuery.of(context).size; - String maxBpm = context.watch().listActivity[0].getMaxBpm(); - String minBpm = context.watch().listActivity[0].getMinBpm(); - String avgBpm = context.watch().listActivity[0].getAvgBpm(); + // -- BPM -- // + int maxBpm = context.watch().listActivity[0].getMaxBpm(); + int minBpm = context.watch().listActivity[0].getMinBpm(); + int avgBpm = context.watch().listActivity[0].getAvgBpm(); + // -- Altitude -- // + double minAltitude = context.watch().listActivity[0].getMinAltitude(); + double maxAltitude = context.watch().listActivity[0].getMaxAltitude(); + double avgAltitude = (maxAltitude + minAltitude) / 2; + // -- Speed -- // + double maxSpeed = context.watch().listActivity[0].getMaxSpeed(); + double avgSpeed = context.watch().listActivity[0].getAvgSpeed(); data = HomeViewUtil().initData(context); @@ -61,9 +69,9 @@ class _WebHomeView extends State { height: media.width * 0.05, ), LigneContainerStats( - "$minBpm BPM", - "$maxBpm BPM", - "$avgBpm BPM", + "${double.parse(maxSpeed.toStringAsFixed(2))} KM/H", + "${double.parse(avgSpeed.toStringAsFixed(2))} km/H", + "${avgBpm.toString()} BPM", "Minimum", "Maximum", "Moyenne", @@ -92,10 +100,10 @@ class _WebHomeView extends State { SizedBox( height: media.width * 0.05, ), - const LigneContainerStats( - "30 BPM", - "90 BPM", - "290 BPM", + LigneContainerStats( + "${minAltitude.toInt()} M", + "${maxAltitude.toInt()} M", + "${avgAltitude.toInt()} M", "Minimum", "Maximum", "Moyenne", @@ -105,7 +113,10 @@ class _WebHomeView extends State { SizedBox( height: media.width * 0.05, ), - GraphAltitudeByTime(media, data) + GraphAltitudeByTime(media, data), + SizedBox( + height: media.width * 0.05, + ), ], ), ), diff --git a/lib/view/map/mobile/mobile_my_map.dart b/lib/view/map/mobile/mobile_my_map.dart new file mode 100644 index 0000000..a3b35dc --- /dev/null +++ b/lib/view/map/mobile/mobile_my_map.dart @@ -0,0 +1,46 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:smartfit_app_mobile/common/colo_extension.dart'; +import 'package:smartfit_app_mobile/modele/utile/maps/maps_utile.dart'; + +class MobileMyMaps extends StatefulWidget { + const MobileMyMaps({super.key}); + + @override + State createState() => _MobileMyMaps(); +} + +class _MobileMyMaps extends State { + final Completer _googleMapController = Completer(); + CameraPosition? _cameraPosition; + Set _polylines = {}; + + @override + Widget build(BuildContext context) { + _polylines = MapUtil().initPolines(context, 10, TColor.primaryColor1); + _cameraPosition = + CameraPosition(target: _polylines.first.points.first, zoom: 18); + + return Scaffold( + body: _getMap(), + ); + } + + Widget _getMap() { + return Stack( + children: [ + GoogleMap( + initialCameraPosition: _cameraPosition!, + mapType: MapType.normal, + onMapCreated: (GoogleMapController controller) { + if (!_googleMapController.isCompleted) { + _googleMapController.complete(controller); + } + }, + polylines: _polylines, + ) + ], + ); + } +} diff --git a/lib/view/map/my_map.dart b/lib/view/map/my_map.dart index 272fe38..64b3609 100644 --- a/lib/view/map/my_map.dart +++ b/lib/view/map/my_map.dart @@ -1,154 +1,29 @@ -import 'dart:async'; - import 'package:flutter/material.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:location/location.dart'; -import 'package:smartfit_app_mobile/common/colo_extension.dart'; +import 'package:provider/provider.dart'; +import 'package:responsive_builder/responsive_builder.dart'; +import 'package:smartfit_app_mobile/modele/user.dart'; +import 'package:smartfit_app_mobile/view/map/mobile/mobile_my_map.dart'; +import 'package:smartfit_app_mobile/view/map/web/web_my_map.dart'; +import 'package:smartfit_app_mobile/view/profile/profile_view.dart'; class MyMap extends StatefulWidget { - const MyMap({ Key? key }) : super(key: key); + const MyMap({Key? key}) : super(key: key); @override State createState() => _MyMapState(); } class _MyMapState extends State { - - Completer _googleMapController = Completer(); - CameraPosition? _cameraPosition; - Location? _location; - LocationData? _currentLocation; - List _polylineCoordinates = []; - Set _polylines = {}; - Set _markers = {}; // Add a set to store markers - - @override - void initState() { - _init(); - super.initState(); - } - - _init() async { - _location = Location(); - _cameraPosition = CameraPosition( - target: LatLng(0, 0), // this is just the example lat and lng for initializing - zoom: 20 - ); - _initLocation(); - } - - //function to listen when we move position - _initLocation() { - - _location?.getLocation().then((location) { - _currentLocation = location; - }); - - _location?.onLocationChanged.listen((newLocation) { - setState(() { - _currentLocation = newLocation; - _polylineCoordinates.add(LatLng( - _currentLocation?.latitude ?? 0, - _currentLocation?.longitude ?? 0, - )); - _updatePolyline(); - - }); - - moveToPosition(LatLng(_currentLocation?.latitude ?? 0, - _currentLocation?.longitude ?? 0)); - }); - } - - _updatePolyline() { - setState(() { - _polylines.clear(); - _polylines.add(Polyline( - polylineId: PolylineId("polyline"), - color: TColor.primaryColor1, - points: _polylineCoordinates, - width: 10, - )); - }); - } - - // Updated _updateMarker to use the custom marker - _updateMarker(LatLng position) async { - final markerId = MarkerId('marker'); - final marker = Marker( - markerId: markerId, - position: position - ); - _markers.clear(); - _markers.add(marker); -} - - - moveToPosition(LatLng latLng) async { - GoogleMapController mapController = await _googleMapController.future; - mapController.animateCamera( - CameraUpdate.newCameraPosition( - CameraPosition( - target: latLng, - zoom: 15 - ) - ) - ); - } - @override Widget build(BuildContext context) { - return Scaffold( - body: _buildBody(), - ); - } - - Widget _buildBody() { - return _getMap(); - } - - Widget _getMarker() { - return Container( - width: 25, - height: 25, - padding: EdgeInsets.all(2), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(100), - boxShadow: [ - BoxShadow( - color: Colors.grey, - offset: Offset(0,3), - spreadRadius: 4, - blurRadius: 6 - ) - ] - ), - child: ClipOval(child: Image.asset("assets/img/u1.png")), - ); - } - - Widget _getMap() { - return Stack( - children: [ - GoogleMap( - initialCameraPosition: _cameraPosition!, - mapType: MapType.normal, - onMapCreated: (GoogleMapController controller) { - if (!_googleMapController.isCompleted) { - _googleMapController.complete(controller); - } - }, - polylines: _polylines, - markers: _markers, - ), - Positioned.fill( - child: Align( - alignment: Alignment.center, - child: _getMarker() + return context.watch().listActivity.isEmpty + ? ScreenTypeLayout.builder( + mobile: (_) => const ProfileView(), + desktop: (_) => const ProfileView(), ) - ) - ], - ); + : ScreenTypeLayout.builder( + mobile: (_) => const MobileMyMaps(), + desktop: (_) => const WebMyMaps(), + ); } } diff --git a/lib/view/map/web/web_my_map.dart b/lib/view/map/web/web_my_map.dart new file mode 100644 index 0000000..6c4517a --- /dev/null +++ b/lib/view/map/web/web_my_map.dart @@ -0,0 +1,47 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:smartfit_app_mobile/common/colo_extension.dart'; +import 'package:smartfit_app_mobile/modele/utile/maps/maps_utile.dart'; + +class WebMyMaps extends StatefulWidget { + const WebMyMaps({super.key}); + + @override + State createState() => _WebMyMaps(); +} + +class _WebMyMaps extends State { + final Completer _googleMapController = Completer(); + CameraPosition? _cameraPosition; + Set _polylines = {}; + + @override + Widget build(BuildContext context) { + _polylines = MapUtil().initPolines(context, 10, TColor.primaryColor1); + _cameraPosition = + CameraPosition(target: _polylines.first.points.first, zoom: 18); + + return Scaffold( + body: _getMap(), + ); + } + + Widget _getMap() { + return Stack( + children: [ + GoogleMap( + initialCameraPosition: _cameraPosition!, + mapType: MapType.normal, + onMapCreated: (GoogleMapController controller) { + if (!_googleMapController.isCompleted) { + _googleMapController.complete(controller); + } + }, + polylines: _polylines, + ) + ], + ); + } +} diff --git a/lib/view/ne_pas_supprimer/map.txt b/lib/view/ne_pas_supprimer/map.txt new file mode 100644 index 0000000..c1e6fa5 --- /dev/null +++ b/lib/view/ne_pas_supprimer/map.txt @@ -0,0 +1,131 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:location/location.dart'; +import 'package:smartfit_app_mobile/common/colo_extension.dart'; + +class MobileMyMaps extends StatefulWidget { + const MobileMyMaps({super.key}); + + @override + State createState() => _MobileMyMaps(); +} + +class _MobileMyMaps extends State { + Completer _googleMapController = Completer(); + CameraPosition? _cameraPosition; + Location? _location; + LocationData? _currentLocation; + List _polylineCoordinates = []; + Set _polylines = {}; + Set _markers = {}; // Add a set to store markers + + @override + void initState() { + _init(); + super.initState(); + } + + _init() async { + _location = Location(); + _cameraPosition = const CameraPosition( + target: LatLng( + 0, 0), // this is just the example lat and lng for initializing + zoom: 20); + _initLocation(); + } + + //function to listen when we move position + _initLocation() { + _location?.getLocation().then((location) { + _currentLocation = location; + }); + + _location?.onLocationChanged.listen((newLocation) { + setState(() { + _currentLocation = newLocation; + _polylineCoordinates.add(LatLng( + _currentLocation?.latitude ?? 0, + _currentLocation?.longitude ?? 0, + )); + _updatePolyline(); + }); + + moveToPosition(LatLng( + _currentLocation?.latitude ?? 0, _currentLocation?.longitude ?? 0)); + }); + } + + _updatePolyline() { + setState(() { + _polylines.clear(); + _polylines.add(Polyline( + polylineId: PolylineId("polyline"), + color: TColor.primaryColor1, + points: _polylineCoordinates, + width: 10, + )); + }); + } + + /* + // Updated _updateMarker to use the custom marker + _updateMarker(LatLng position) async { + final markerId = MarkerId('marker'); + final marker = Marker(markerId: markerId, position: position); + _markers.clear(); + _markers.add(marker); + }*/ + + moveToPosition(LatLng latLng) async { + GoogleMapController mapController = await _googleMapController.future; + mapController.animateCamera(CameraUpdate.newCameraPosition( + CameraPosition(target: latLng, zoom: 15))); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: _getMap(), + ); + } + + Widget _getMarker() { + return Container( + width: 25, + height: 25, + padding: EdgeInsets.all(2), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(100), + boxShadow: [ + BoxShadow( + color: Colors.grey, + offset: Offset(0, 3), + spreadRadius: 4, + blurRadius: 6) + ]), + child: ClipOval(child: Image.asset("assets/img/u1.png")), + ); + } + + Widget _getMap() { + return Stack( + children: [ + GoogleMap( + initialCameraPosition: _cameraPosition!, + mapType: MapType.normal, + onMapCreated: (GoogleMapController controller) { + if (!_googleMapController.isCompleted) { + _googleMapController.complete(controller); + } + }, + polylines: _polylines, + markers: _markers, + ), + Positioned.fill( + child: Align(alignment: Alignment.center, child: _getMarker())) + ], + ); + } +} diff --git a/web/index.html b/web/index.html index 04a3091..ac02418 100644 --- a/web/index.html +++ b/web/index.html @@ -26,6 +26,9 @@ + + + From b640a18bc50a0cf4cef2afcb529dfce11ccdccae Mon Sep 17 00:00:00 2001 From: Enzo Date: Mon, 20 Nov 2023 15:45:13 +0100 Subject: [PATCH 50/55] Home correction --- lib/common_widget/container/workout_row.dart | 1 - .../activity/mobile/mobile_Activity_view.dart | 1 - lib/view/home/web/web_homeview.dart | 20 ++++++++++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/common_widget/container/workout_row.dart b/lib/common_widget/container/workout_row.dart index f668933..7017f70 100644 --- a/lib/common_widget/container/workout_row.dart +++ b/lib/common_widget/container/workout_row.dart @@ -15,7 +15,6 @@ class WorkoutRow extends StatelessWidget { @override Widget build(BuildContext context) { - var media = MediaQuery.of(context).size; return Container( margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 2), padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15), diff --git a/lib/view/activity/mobile/mobile_Activity_view.dart b/lib/view/activity/mobile/mobile_Activity_view.dart index 273f6be..d21df8c 100644 --- a/lib/view/activity/mobile/mobile_Activity_view.dart +++ b/lib/view/activity/mobile/mobile_Activity_view.dart @@ -1,4 +1,3 @@ -import 'package:provider/provider.dart'; import 'package:smartfit_app_mobile/common_widget/steps.dart'; import 'package:smartfit_app_mobile/common_widget/graph/graph.dart'; import 'package:smartfit_app_mobile/common_widget/info.dart' hide Stats; diff --git a/lib/view/home/web/web_homeview.dart b/lib/view/home/web/web_homeview.dart index adeff48..7ce47de 100644 --- a/lib/view/home/web/web_homeview.dart +++ b/lib/view/home/web/web_homeview.dart @@ -69,8 +69,8 @@ class _WebHomeView extends State { height: media.width * 0.05, ), LigneContainerStats( - "${double.parse(maxSpeed.toStringAsFixed(2))} KM/H", - "${double.parse(avgSpeed.toStringAsFixed(2))} km/H", + "${minBpm.toString()} BPM", + "${maxBpm.toString()} BPM", "${avgBpm.toString()} BPM", "Minimum", "Maximum", @@ -101,9 +101,9 @@ class _WebHomeView extends State { height: media.width * 0.05, ), LigneContainerStats( - "${minAltitude.toInt()} M", - "${maxAltitude.toInt()} M", - "${avgAltitude.toInt()} M", + "${double.parse(maxSpeed.toStringAsFixed(2))} KM/H", + "${double.parse(avgSpeed.toStringAsFixed(2))} km/H", + "${avgBpm.toString()} BPM", "Minimum", "Maximum", "Moyenne", @@ -114,6 +114,16 @@ class _WebHomeView extends State { height: media.width * 0.05, ), GraphAltitudeByTime(media, data), + LigneContainerStats( + "${minAltitude.toInt()} M", + "${maxAltitude.toInt()} M", + "${avgAltitude.toInt()} M", + "Minimum", + "Maximum", + "Moyenne", + Icons.trending_down, + Icons.trending_up, + Icons.favorite_outline), SizedBox( height: media.width * 0.05, ), From 1c600440a576b9257afa33119bbb2825cec2c299 Mon Sep 17 00:00:00 2001 From: Enzo Date: Mon, 20 Nov 2023 16:02:58 +0100 Subject: [PATCH 51/55] change name --- lib/main.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 8187d32..049d2fc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -15,7 +15,7 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - title: 'SmartFit 3 in 1', + title: 'SmartFit', debugShowCheckedModeBanner: false, theme: ThemeData( // This is the theme of your application. From 8303071862becf74515a6894d4e6aa928126544e Mon Sep 17 00:00:00 2001 From: RemRem Date: Mon, 20 Nov 2023 16:14:32 +0100 Subject: [PATCH 52/55] update README.md --- README.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8ddf340..a4a19e9 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,8 @@ TODO: Description ## Getting Started +TODO: Installation and Build -This project is a starting point for a Flutter application. - -A few resources to get you started if this is your first Flutter project: - -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) - -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +## Docs +You can find **[here](https://codefirst.iut.uca.fr/documentation/SmartFit/SmartFit_Docs/docusaurus/)** +the docusaurus for SmartFit! From aed8be0ca09a263746d20c3b52dd60bc5498e0a7 Mon Sep 17 00:00:00 2001 From: RemRem Date: Mon, 20 Nov 2023 16:16:46 +0100 Subject: [PATCH 53/55] update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index a4a19e9..01ccd18 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ TODO: Description ## Getting Started + +### Web +We host a [SmartFit Web](https://smartfit-9b86c.web.app/) instance on Firebase. +TODO: Build + +### Mobile TODO: Installation and Build ## Docs From 43c0966378be10413a8905d10f8baf66d145ed18 Mon Sep 17 00:00:00 2001 From: rem Date: Mon, 20 Nov 2023 16:19:23 +0100 Subject: [PATCH 54/55] Update 'README.md' --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 01ccd18..5cb1409 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ TODO: Description ## Getting Started ### Web -We host a [SmartFit Web](https://smartfit-9b86c.web.app/) instance on Firebase. +We host a **[SmartFit Web](https://smartfit-9b86c.web.app/)** instance on Firebase. TODO: Build ### Mobile From f1828dfd456abe10da4fdbbcd4c1b0564790bc4c Mon Sep 17 00:00:00 2001 From: Enzo Date: Tue, 21 Nov 2023 09:07:04 +0100 Subject: [PATCH 55/55] change on import inutile --- lib/main.dart | 1 - lib/view/activity/web/web_list_activity.dart | 6 ++---- lib/view/home/no_activity_view.dart | 9 ++++----- lib/view/profile/change_username.dart | 14 ++++---------- lib/view/profile/web/web_profile_view.dart | 1 - 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index a77db76..049d2fc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:smartfit_app_mobile/modele/user.dart'; import 'package:smartfit_app_mobile/common/colo_extension.dart'; -import 'package:smartfit_app_mobile/view/home/no_activity_view.dart'; import 'package:smartfit_app_mobile/view/main_tab/main_tab_view.dart'; void main() { diff --git a/lib/view/activity/web/web_list_activity.dart b/lib/view/activity/web/web_list_activity.dart index 734d06d..aef0e23 100644 --- a/lib/view/activity/web/web_list_activity.dart +++ b/lib/view/activity/web/web_list_activity.dart @@ -1,4 +1,3 @@ -import 'dart:convert'; import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:smartfit_app_mobile/modele/manager_file.dart'; @@ -27,7 +26,6 @@ class _WebListActivityState extends State { //late File x = File(file.path); - void readFile(html.File file) async { ManagerFile x = ManagerFile(); final reader = html.FileReader(); @@ -47,7 +45,7 @@ class _WebListActivityState extends State { @override Widget build(BuildContext context) { var media = MediaQuery.of(context).size; - + return Scaffold( backgroundColor: TColor.white, body: SingleChildScrollView( @@ -107,7 +105,7 @@ class _WebListActivityState extends State { ), ) ]) - : Material( + : Material( color: Colors.transparent, child: ListView.builder( padding: EdgeInsets.zero, diff --git a/lib/view/home/no_activity_view.dart b/lib/view/home/no_activity_view.dart index 206cda6..698b7ee 100644 --- a/lib/view/home/no_activity_view.dart +++ b/lib/view/home/no_activity_view.dart @@ -2,9 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import '../../common/colo_extension.dart'; -import '../../common_widget/button/round_button.dart'; -import '../main_tab/main_tab_view.dart'; - class NoActivityView extends StatefulWidget { const NoActivityView({super.key}); @@ -20,13 +17,15 @@ class _NoActivityViewState extends State { return Scaffold( backgroundColor: TColor.white, body: SafeArea( - child: Center( // Utilisation du widget Center pour centrer verticalement + child: Center( + // Utilisation du widget Center pour centrer verticalement child: Container( width: media.width, padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 25), child: Column( crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.min, // Utilisation de MainAxisSize.min pour que la colonne prenne la hauteur minimale nécessaire + mainAxisSize: MainAxisSize + .min, // Utilisation de MainAxisSize.min pour que la colonne prenne la hauteur minimale nécessaire children: [ SizedBox( height: media.height * 0.1, diff --git a/lib/view/profile/change_username.dart b/lib/view/profile/change_username.dart index 67fa79e..ad71734 100644 --- a/lib/view/profile/change_username.dart +++ b/lib/view/profile/change_username.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter_svg/svg.dart'; import 'package:smartfit_app_mobile/common_widget/button/round_button.dart'; import 'package:smartfit_app_mobile/common_widget/text_field/round_text_field.dart'; @@ -16,7 +15,6 @@ class _ChangeUsernameViewState extends State { final TextEditingController controllerTextEmail = TextEditingController(); final TextEditingController controllerTextPassword = TextEditingController(); - @override Widget build(BuildContext context) { var media = MediaQuery.of(context).size; @@ -44,16 +42,14 @@ class _ChangeUsernameViewState extends State { height: 15, fit: BoxFit.contain, ), - ), - ), - title: Text( + title: Text( "Changer son pseudo", style: TextStyle( color: TColor.black, fontSize: 16, fontWeight: FontWeight.w700), ), - ), + ), backgroundColor: TColor.white, body: Column( children: [ @@ -78,9 +74,7 @@ class _ChangeUsernameViewState extends State { controller: controllerTextEmail, ), SizedBox(height: media.width * 0.04), - RoundButton( - title: "Confirmer", - onPressed: () {}), + RoundButton(title: "Confirmer", onPressed: () {}), ], ), ), @@ -91,4 +85,4 @@ class _ChangeUsernameViewState extends State { ), ); } -} \ No newline at end of file +} diff --git a/lib/view/profile/web/web_profile_view.dart b/lib/view/profile/web/web_profile_view.dart index 14c8b1b..7da5b1d 100644 --- a/lib/view/profile/web/web_profile_view.dart +++ b/lib/view/profile/web/web_profile_view.dart @@ -4,7 +4,6 @@ import 'package:smartfit_app_mobile/common/colo_extension.dart'; import 'package:smartfit_app_mobile/common_widget/button/round_button.dart'; import 'package:smartfit_app_mobile/common_widget/setting_row.dart'; import 'package:smartfit_app_mobile/common_widget/title_subtitle_cell.dart'; -import 'package:smartfit_app_mobile/view/home/notification_view.dart'; import 'package:smartfit_app_mobile/view/profile/change_password.dart'; import 'package:smartfit_app_mobile/view/profile/change_username.dart';