From 2271e1242236bbb2712ae80c312149ee86fe89e2 Mon Sep 17 00:00:00 2001 From: Enzo Date: Tue, 14 Nov 2023 11:31:11 +0100 Subject: [PATCH] View change by platform + category/date for file --- lib/Modele/Api/request_api.dart | 16 +- lib/View/login/Mobile/android_login_view.dart | 252 +++++++++++++++++ lib/View/login/login_view.dart | 266 +++--------------- lib/View/login/web/web_login_view.dart | 252 +++++++++++++++++ lib/View/main_tab/select_view.dart | 18 +- lib/View/page_test.dart | 14 +- lib/View/widget_android_test.dart | 10 + lib/View/widget_web_test.dart | 10 + lib/main.dart | 1 - 9 files changed, 583 insertions(+), 256 deletions(-) create mode 100644 lib/View/login/Mobile/android_login_view.dart create mode 100644 lib/View/login/web/web_login_view.dart create mode 100644 lib/View/widget_android_test.dart create mode 100644 lib/View/widget_web_test.dart diff --git a/lib/Modele/Api/request_api.dart b/lib/Modele/Api/request_api.dart index 294d2b3..6e12901 100644 --- a/lib/Modele/Api/request_api.dart +++ b/lib/Modele/Api/request_api.dart @@ -177,22 +177,22 @@ class RequestApi extends IDataStrategy { @override Future> uploadFile(String token, File file) async { String filename = file.path.split('/').last; - String typeActivity = filename.split("_").first; + String categoryActivity = filename.split("_").first.toLowerCase(); String dateActivity = filename.split("_")[1].split("T").first; final uri = Uri.parse('$urlApi/user/files'); - Map headers = { - 'Authorization': token, - 'SmartFit_Type': typeActivity, - 'SmartFit_Date': dateActivity - }; + Map headers = {'Authorization': token}; var request = http.MultipartRequest('POST', uri); final httpImage = http.MultipartFile.fromBytes( - 'file', await file.readAsBytes(), - filename: filename); + 'file', + await file.readAsBytes(), + filename: filename, + ); request.files.add(httpImage); request.headers.addAll(headers); + request.fields["SmartFit_Category"] = categoryActivity; + request.fields["SmartFit_Date"] = dateActivity; final response = await request.send(); diff --git a/lib/View/login/Mobile/android_login_view.dart b/lib/View/login/Mobile/android_login_view.dart new file mode 100644 index 0000000..c624567 --- /dev/null +++ b/lib/View/login/Mobile/android_login_view.dart @@ -0,0 +1,252 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:smartfit_app_mobile/View/main_tab/main_tab_view.dart'; +import 'package:smartfit_app_mobile/common/colo_extension.dart'; +import 'package:smartfit_app_mobile/common_widget/round_button.dart'; +import 'package:smartfit_app_mobile/common_widget/round_text_field.dart'; +import 'package:tuple/tuple.dart'; + +class AndroidLoginView extends StatelessWidget { + AndroidLoginView( + this._obscureText, + this._errorLogin, + this._msgError, + this._toggle, + this._printMsgError, + this.getUserInfo, + this.checkLoginAndPassword, + this.fillUser, + {super.key}); + + bool _obscureText; + bool _errorLogin; + final String _msgError; + + final controllerTextEmail = TextEditingController(); + final controllerTextPassword = TextEditingController(); + + // ---- Fonction --- // + final void Function() _toggle; + final Future> Function(String email, String password) + checkLoginAndPassword; + final Future Function(String token) getUserInfo; + final void Function(String msgError) _printMsgError; + final void Function( + BuildContext context, Map map, String token) fillUser; + + @override + Widget build(BuildContext context) { + var media = MediaQuery.of(context).size; + return Scaffold( + backgroundColor: TColor.white, + body: SingleChildScrollView( + child: SafeArea( + child: Container( + height: media.height * 0.9, + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "Bienvenue, Android", + style: TextStyle(color: TColor.gray, fontSize: 16), + ), + Text( + "Se connecter", + style: TextStyle( + color: TColor.black, + fontSize: 20, + fontWeight: FontWeight.w700), + ), + SizedBox( + height: media.width * 0.05, + ), + SizedBox( + height: media.width * 0.04, + ), + RoundTextField( + hitText: "Email", + icon: "assets/img/email.svg", + keyboardType: TextInputType.emailAddress, + controller: controllerTextEmail, + ), + SizedBox( + height: media.width * 0.04, + ), + RoundTextField( + controller: controllerTextPassword, + hitText: "Mot de passe", + icon: "assets/img/lock.svg", + obscureText: _obscureText, + rigtIcon: TextButton( + onPressed: _toggle, + child: Container( + alignment: Alignment.center, + width: 20, + height: 20, + child: SvgPicture.asset( + "assets/img/show_password.svg", + width: 20, + height: 20, + fit: BoxFit.contain, + ))), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Mot de passe oublié ?", + style: TextStyle( + color: TColor.gray, + fontSize: 15, + decoration: TextDecoration.underline), + ), + ], + ), + SizedBox( + height: media.width * 0.04, + ), + Visibility( + visible: _errorLogin, + child: Text("Error - $_msgError", + style: TextStyle(color: TColor.red))), + const Spacer(), + RoundButton( + title: "Se connecter", + onPressed: () async { + Tuple2 result = await checkLoginAndPassword( + controllerTextEmail.text, + controllerTextPassword.text); + + if (result.item1 == true) { + Tuple2 infoUser = await getUserInfo(result.item2); + + if (infoUser.item1 == false) { + //print("Erreur - Impossible de récupéré les données de l'utilisateur"); + _printMsgError( + "Impossible de récupéré les données de l'utilisateur - {$infoUser.item2}"); + } else { + fillUser(context, infoUser.item2, result.item2); + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const MainTabView())); + } + } else { + _printMsgError("Connexion refuser - ${result.item2}"); + } + }), + 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, + ), + 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, + ), + TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "Vous n'avez pas toujours pas de compte ? ", + style: TextStyle( + color: TColor.black, + fontSize: 14, + ), + ), + Text( + "Créer un compte", + style: TextStyle( + color: TColor.black, + fontSize: 14, + fontWeight: FontWeight.w700), + ) + ], + ), + ), + SizedBox( + height: media.width * 0.04, + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/View/login/login_view.dart b/lib/View/login/login_view.dart index 08404ef..1563917 100644 --- a/lib/View/login/login_view.dart +++ b/lib/View/login/login_view.dart @@ -1,18 +1,33 @@ import 'dart:convert'; +import 'dart:io'; import 'package:crypto/crypto.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter_svg/svg.dart'; import 'package:provider/provider.dart'; import 'package:smartfit_app_mobile/Modele/Api/i_data_strategy.dart'; import 'package:smartfit_app_mobile/Modele/Api/request_api.dart'; import 'package:smartfit_app_mobile/Modele/user.dart'; -import 'package:smartfit_app_mobile/View/main_tab/main_tab_view.dart'; -import 'package:smartfit_app_mobile/View/page_test.dart'; -import 'package:smartfit_app_mobile/common/colo_extension.dart'; -import 'package:smartfit_app_mobile/common_widget/round_button.dart'; -import 'package:smartfit_app_mobile/common_widget/round_text_field.dart'; +import 'package:smartfit_app_mobile/View/login/Mobile/android_login_view.dart'; +import 'package:smartfit_app_mobile/View/login/web/web_login_view.dart'; import 'package:flutter/material.dart'; import 'package:tuple/tuple.dart'; +String getPlatforme() { + if (kIsWeb) { + return "Web"; + } + if (Platform.isAndroid) { + return "Android"; + } + if (Platform.isWindows) { + return "Windows"; + } + if (Platform.isMacOS) { + return "MacOS"; + } + return "Null"; +} + class LoginView extends StatefulWidget { const LoginView({super.key}); @@ -25,13 +40,12 @@ class _LoginViewState extends State { String _msgError = ""; bool _errorLogin = false; IDataStrategy api = RequestApi(); + String platforme = getPlatforme(); - final controllerTextEmail = TextEditingController(); - final controllerTextPassword = TextEditingController(); - - Future> checkLoginAndPassword() async { - Tuple2 result = await api.connexion(controllerTextEmail.text, - sha256.convert(utf8.encode(controllerTextPassword.text)).toString()); + Future> checkLoginAndPassword( + String email, String password) async { + Tuple2 result = await api.connexion( + email, sha256.convert(utf8.encode(password)).toString()); return result; } @@ -48,7 +62,6 @@ class _LoginViewState extends State { context.read().username = map["username"]; context.read().token = token; context.read().listActivity = List.empty(growable: true); - print(context.read()); } // Toggles the password show status @@ -58,224 +71,19 @@ class _LoginViewState extends State { }); } + void _printMsgError(String msgError) { + _msgError = msgError; + _errorLogin = true; + } + @override Widget build(BuildContext context) { - var media = MediaQuery.of(context).size; - return Scaffold( - backgroundColor: TColor.white, - body: SingleChildScrollView( - child: SafeArea( - child: Container( - height: media.height * 0.9, - padding: const EdgeInsets.symmetric(horizontal: 20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "Bienvenue,", - style: TextStyle(color: TColor.gray, fontSize: 16), - ), - Text( - "Se connecter", - style: TextStyle( - color: TColor.black, - fontSize: 20, - fontWeight: FontWeight.w700), - ), - SizedBox( - height: media.width * 0.05, - ), - SizedBox( - height: media.width * 0.04, - ), - RoundTextField( - hitText: "Email", - icon: "assets/img/email.svg", - keyboardType: TextInputType.emailAddress, - controller: controllerTextEmail, - ), - SizedBox( - height: media.width * 0.04, - ), - RoundTextField( - controller: controllerTextPassword, - hitText: "Mot de passe", - icon: "assets/img/lock.svg", - obscureText: _obscureText, - rigtIcon: TextButton( - onPressed: _toggle, - child: Container( - alignment: Alignment.center, - width: 20, - height: 20, - child: SvgPicture.asset( - "assets/img/show_password.svg", - width: 20, - height: 20, - fit: BoxFit.contain, - ))), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Mot de passe oublié ?", - style: TextStyle( - color: TColor.gray, - fontSize: 15, - decoration: TextDecoration.underline), - ), - ], - ), - SizedBox( - height: media.width * 0.04, - ), - Visibility( - visible: _errorLogin, - child: Text("Error - $_msgError", - style: TextStyle(color: TColor.red))), - const Spacer(), - RoundButton( - title: "Se connecter", - onPressed: () async { - Tuple2 result = - await checkLoginAndPassword(); - - if (result.item1 == true) { - Tuple2 infoUser = await getUserInfo(result.item2); - - if (infoUser.item1 == false) { - //print("Erreur - Impossible de récupéré les données de l'utilisateur"); - setState(() { - _msgError = - "Impossible de récupéré les données de l'utilisateur - {$infoUser.item2}"; - _errorLogin = true; - }); - } else { - fillUser(context, infoUser.item2, result.item2); - - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const MainTabView())); - } - } else { - setState(() { - _msgError = "Connexion refuser - ${result.item2}"; - _errorLogin = true; - }); - } - }), - 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, - ), - 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, - ), - TextButton( - onPressed: () { - Navigator.pop(context); - }, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - "Vous n'avez pas toujours pas de compte ? ", - style: TextStyle( - color: TColor.black, - fontSize: 14, - ), - ), - Text( - "Créer un compte", - style: TextStyle( - color: TColor.black, - fontSize: 14, - fontWeight: FontWeight.w700), - ) - ], - ), - ), - SizedBox( - height: media.width * 0.04, - ), - ], - ), - ), - ), - ), - ); + if (platforme == "Android") { + return AndroidLoginView(_obscureText, _errorLogin, _msgError, _toggle, + _printMsgError, getUserInfo, checkLoginAndPassword, fillUser); + } else { + return WebLoginView(_obscureText, _errorLogin, _msgError, _toggle, + _printMsgError, getUserInfo, checkLoginAndPassword, fillUser); + } } } diff --git a/lib/View/login/web/web_login_view.dart b/lib/View/login/web/web_login_view.dart new file mode 100644 index 0000000..d5eedf6 --- /dev/null +++ b/lib/View/login/web/web_login_view.dart @@ -0,0 +1,252 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:smartfit_app_mobile/View/main_tab/main_tab_view.dart'; +import 'package:smartfit_app_mobile/common/colo_extension.dart'; +import 'package:smartfit_app_mobile/common_widget/round_button.dart'; +import 'package:smartfit_app_mobile/common_widget/round_text_field.dart'; +import 'package:tuple/tuple.dart'; + +class WebLoginView extends StatelessWidget { + WebLoginView( + this._obscureText, + this._errorLogin, + this._msgError, + this._toggle, + this._printMsgError, + this.getUserInfo, + this.checkLoginAndPassword, + this.fillUser, + {super.key}); + + bool _obscureText; + bool _errorLogin; + final String _msgError; + + final controllerTextEmail = TextEditingController(); + final controllerTextPassword = TextEditingController(); + + // ---- Fonction --- // + final void Function() _toggle; + final Future> Function(String email, String password) + checkLoginAndPassword; + final Future Function(String token) getUserInfo; + final void Function(String msgError) _printMsgError; + final void Function( + BuildContext context, Map map, String token) fillUser; + + @override + Widget build(BuildContext context) { + var media = MediaQuery.of(context).size; + return Scaffold( + backgroundColor: TColor.white, + body: SingleChildScrollView( + child: SafeArea( + child: Container( + height: media.height * 0.9, + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "Bienvenue, Web", + style: TextStyle(color: TColor.gray, fontSize: 16), + ), + Text( + "Se connecter", + style: TextStyle( + color: TColor.black, + fontSize: 20, + fontWeight: FontWeight.w700), + ), + SizedBox( + height: media.width * 0.05, + ), + SizedBox( + height: media.width * 0.04, + ), + RoundTextField( + hitText: "Email", + icon: "assets/img/email.svg", + keyboardType: TextInputType.emailAddress, + controller: controllerTextEmail, + ), + SizedBox( + height: media.width * 0.04, + ), + RoundTextField( + controller: controllerTextPassword, + hitText: "Mot de passe", + icon: "assets/img/lock.svg", + obscureText: _obscureText, + rigtIcon: TextButton( + onPressed: _toggle, + child: Container( + alignment: Alignment.center, + width: 20, + height: 20, + child: SvgPicture.asset( + "assets/img/show_password.svg", + width: 20, + height: 20, + fit: BoxFit.contain, + ))), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Mot de passe oublié ?", + style: TextStyle( + color: TColor.gray, + fontSize: 15, + decoration: TextDecoration.underline), + ), + ], + ), + SizedBox( + height: media.width * 0.04, + ), + Visibility( + visible: _errorLogin, + child: Text("Error - $_msgError", + style: TextStyle(color: TColor.red))), + const Spacer(), + RoundButton( + title: "Se connecter", + onPressed: () async { + Tuple2 result = await checkLoginAndPassword( + controllerTextEmail.text, + controllerTextPassword.text); + + if (result.item1 == true) { + Tuple2 infoUser = await getUserInfo(result.item2); + + if (infoUser.item1 == false) { + //print("Erreur - Impossible de récupéré les données de l'utilisateur"); + _printMsgError( + "Impossible de récupéré les données de l'utilisateur - {$infoUser.item2}"); + } else { + fillUser(context, infoUser.item2, result.item2); + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const MainTabView())); + } + } else { + _printMsgError("Connexion refuser - ${result.item2}"); + } + }), + 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, + ), + 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, + ), + TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "Vous n'avez pas toujours pas de compte ? ", + style: TextStyle( + color: TColor.black, + fontSize: 14, + ), + ), + Text( + "Créer un compte", + style: TextStyle( + color: TColor.black, + fontSize: 14, + fontWeight: FontWeight.w700), + ) + ], + ), + ), + SizedBox( + height: media.width * 0.04, + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/View/main_tab/select_view.dart b/lib/View/main_tab/select_view.dart index fcd5bbc..02c70c1 100644 --- a/lib/View/main_tab/select_view.dart +++ b/lib/View/main_tab/select_view.dart @@ -29,10 +29,10 @@ class SelectView extends StatelessWidget { ), ); }), - - const SizedBox(height: 15,), - - RoundButton( + const SizedBox( + height: 15, + ), + RoundButton( title: "Meal Planner", onPressed: () { Navigator.push( @@ -42,10 +42,10 @@ class SelectView extends StatelessWidget { ), ); }), - - const SizedBox(height: 15,), - - RoundButton( + const SizedBox( + height: 15, + ), + RoundButton( title: "Sleep Tracker", onPressed: () { Navigator.push( @@ -60,4 +60,4 @@ class SelectView extends StatelessWidget { ), ); } -} \ No newline at end of file +} diff --git a/lib/View/page_test.dart b/lib/View/page_test.dart index eee76d4..4ed6b01 100644 --- a/lib/View/page_test.dart +++ b/lib/View/page_test.dart @@ -7,13 +7,10 @@ import 'package:http/http.dart'; import 'package:path_provider/path_provider.dart'; import 'package:file_picker/file_picker.dart'; import 'dart:io'; - -import 'package:provider/provider.dart'; import 'package:smartfit_app_mobile/Modele/Api/i_data_strategy.dart'; import 'package:smartfit_app_mobile/Modele/Api/request_api.dart'; -import 'package:smartfit_app_mobile/Modele/activity.dart'; import 'package:smartfit_app_mobile/Modele/manager_file.dart'; -import 'package:smartfit_app_mobile/Modele/user.dart'; +import 'package:smartfit_app_mobile/View/login/signup_view.dart'; import 'package:tuple/tuple.dart'; // ----------- File --------------- // @@ -119,7 +116,7 @@ class _TestPage extends State { print(digest.toString()); print("Appel"); Tuple2 res = - await strategy.connexion("toto@gmail.com", digest.toString()); + await strategy.connexion("1234", digest.toString()); print(res.item1); print(res.item2); } @@ -135,7 +132,7 @@ class _TestPage extends State { Future getFiles() async { String token = - "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1dWlkIjoiOGUyYWVmMTItN2ZiNC0xMWVlLWJhZmQtMDI0MjBhNWEwMDFmIiwiZXhwIjoxNzA0ODgyNzk3fQ.b_zsOHj2C-Y28CrcozbSjEz8BUWL8kgjjx5CDhES8PI"; + "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1dWlkIjoiOGJiNDdmMDAtODJkNi0xMWVlLTkzMTMtMDI0MjBhNWEwMDFmIiwiZXhwIjoxNzA1MjI4MTUyfQ.9ADC65f2rNI_llytvhA6tX0NM9_O3-2RlwPXqV0yYcI"; print("Appel"); Tuple2 res = await strategy.getFiles(token); print(res.item1); @@ -156,7 +153,7 @@ class _TestPage extends State { Future uploadFile() async { PlatformFile t = result!.files.single; String token = - "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1dWlkIjoiOGUyYWVmMTItN2ZiNC0xMWVlLWJhZmQtMDI0MjBhNWEwMDFmIiwiZXhwIjoxNzA0ODgzNjM5fQ.0TmfJ9eYnszw4_RkNwPkMzkJxvsIFs5BI9uhQ7qYb0g"; + "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1dWlkIjoiOGJiNDdmMDAtODJkNi0xMWVlLTkzMTMtMDI0MjBhNWEwMDFmIiwiZXhwIjoxNzA1MjI4MTUyfQ.9ADC65f2rNI_llytvhA6tX0NM9_O3-2RlwPXqV0yYcI"; String? lol = t.path!; print("Appel"); Tuple2 res = await strategy.uploadFile(token, File(lol)); @@ -399,5 +396,4 @@ class _MyHomePageState extends State { ), ); } -} -*/ \ No newline at end of file +}*/ diff --git a/lib/View/widget_android_test.dart b/lib/View/widget_android_test.dart new file mode 100644 index 0000000..713473a --- /dev/null +++ b/lib/View/widget_android_test.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class AndroidWidgetTest extends StatelessWidget { + const AndroidWidgetTest({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return const Text("Android oupy"); + } +} diff --git a/lib/View/widget_web_test.dart b/lib/View/widget_web_test.dart new file mode 100644 index 0000000..c9e8fa9 --- /dev/null +++ b/lib/View/widget_web_test.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class WebWidgetTest extends StatelessWidget { + const WebWidgetTest({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return const Text("Web oupy"); + } +} diff --git a/lib/main.dart b/lib/main.dart index 8a98b33..2aad57e 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/View/login/signup_view.dart'; -import 'package:smartfit_app_mobile/View/page_test.dart'; import 'package:smartfit_app_mobile/common/colo_extension.dart'; void main() {