diff --git a/android/app/build.gradle b/android/app/build.gradle index cb74372..ea6581c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -11,12 +11,12 @@ android { ndkVersion = flutter.ndkVersion compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8 + jvmTarget = JavaVersion.VERSION_17 } defaultConfig { diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index da9c61c..339c236 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,10 +6,11 @@ + + android:icon="@mipmap/ic_launcher"> runApp(const Login()); + +class Login extends StatefulWidget { + const Login({super.key}); + + @override + State createState() => _LoginState(); +} + +class _LoginState extends State { + @override + void initState() { + initialize(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + initialRoute: '/', + routes: { + '/second': (context) => const screen2.Screen2(), + '/movements': (context) => const movements.Movements(), + '/transfert': (context) => const transfert.TransfertScreen(), + '/livraison': (context) => const livraison.LivraisonScreen(), + '/final': (context) => const final_page.Final(), + }, + title: "Soft", + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.lightGreen), + useMaterial3: true, + primarySwatch: Colors.lightGreen), + home: LoginPage() + ); + } +} +class LoginPage extends StatefulWidget{ + const LoginPage({super.key}); + + @override + State createState() => _LoginPageState(); +} + +class _LoginPageState extends State { + Color? background = Colors.grey[900]; + String username = ""; + + String pssw = ""; + + bool passwordVisible = false; + + Color? fieldColor = Colors.grey[300]; + bool changeTheme = false; + + bool isLoading = false; + bool isaUser = false; + String errormssg = ""; + + final _uname = TextEditingController(); + + final _pssw = TextEditingController(); + + Transfert objTransfert = Transfert(); + Livraison objLivraison = Livraison(); + + void authenticate() async{ + setState(() { + isLoading = false; + errormssg = ""; + }); + isLoading = true; + bool isValidUser = await isUser(_uname.text, _pssw.text); + //bool isValidUser = true; + setState(() { + isLoading = false; + }); + + if (mounted && isValidUser) { + objTransfert.user = _uname.text; + objLivraison.user = _uname.text; + _uname.text = ""; + _pssw.text = ""; + Navigator.pushNamed(context, '/second', + arguments: screen2.ScreenTransition(backgroundColor: background, FieldColor: fieldColor, + changeThemes: changeTheme, objtransfert: objTransfert, objlivraison: objLivraison + ) + ); + } + else { + setState(() { + errormssg = "Utilisateur non existant !"; + }); + } + } + + @override + Widget build(BuildContext context){ + return + SizedBox( + width: double.infinity, + height: double.infinity, + child: Scaffold( + appBar: AppBar(title: Align( + alignment: Alignment.topRight, + child: IconButton(onPressed: (){ + setState(() { + background = changeTheme ? Colors.grey[900] : Colors.white; + fieldColor = changeTheme ? Colors.grey[300] : Colors.black; + changeTheme = !changeTheme; + });}, icon: Icon(background == Colors.white ? Icons.dark_mode_outlined + : Icons.light_mode,), style: IconButton.styleFrom( + backgroundColor: Colors.lightGreen)),), + backgroundColor: background, + ), + resizeToAvoidBottomInset: true, + backgroundColor: background, + body: Container( + padding: const EdgeInsets.all(20.0), + margin: const EdgeInsets.all(20.0), + child: SingleChildScrollView( + child: Column(children: [ + SizedBox( + height: 40.0, + ), + ClipRRect( + borderRadius: BorderRadius.circular(20), + child: Image.asset("assets/icon/drawer2.png", + fit: BoxFit.cover, width: 200, height: 200), + ), + SizedBox( + height: 25.0, + ), + Text(errormssg, style: TextStyle(color: Colors.red),), + SizedBox(height: 25,), + TextField( + style: TextStyle(color: fieldColor), + controller: _uname, + decoration: InputDecoration( + hintText: "Nom d'utilisateur...", + suffixIcon: Icon(Icons.person_2_rounded)), + cursorColor: Colors.amber, + cursorHeight: 15.0, + cursorWidth: 1.0, + ), + const SizedBox(height: 30.0), + TextField( + obscureText: !passwordVisible, + style: TextStyle(color: fieldColor), + controller: _pssw, + decoration: InputDecoration( + hintText: "Mot de passe...", + suffixIcon: IconButton( + icon: Icon(passwordVisible + ? Icons.visibility + : Icons.visibility_off), + onPressed: () { + setState(() { + passwordVisible = !passwordVisible; + }); + }, + )), + cursorColor: Colors.amber, + cursorHeight: 15.0, + cursorWidth: 1.0, + ), + const SizedBox( + height: 60.0, + ), + isLoading ? CircularProgressIndicator() + : ElevatedButton(onPressed: authenticate, + style: ElevatedButton.styleFrom(backgroundColor: Colors.lightGreen), + child: Text("Se connecter", style: TextStyle(color: Colors.black),),), + + ])))), + ); + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index d0d98aa..d807305 100644 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1 +1,120 @@ -{"images":[{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@3x.png","scale":"3x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@1x.png","scale":"1x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@1x.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@1x.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@1x.png","scale":"1x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@2x.png","scale":"2x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@1x.png","scale":"1x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@1x.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"Icon-App-83.5x83.5@2x.png","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"Icon-App-1024x1024@1x.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}} \ No newline at end of file +{ + "images": [ + { + "filename": "Icon-App-20x20@2x.png", + "idiom": "universal", + "scale": "2x", + "size": "20x20", + "platform": "ios" + }, + { + "filename": "Icon-App-20x20@3x.png", + "idiom": "universal", + "scale": "3x", + "size": "20x20", + "platform": "ios" + }, + { + "filename": "Icon-App-29x29@2x.png", + "idiom": "universal", + "scale": "2x", + "size": "29x29", + "platform": "ios" + }, + { + "filename": "Icon-App-29x29@3x.png", + "idiom": "universal", + "scale": "3x", + "size": "29x29", + "platform": "ios" + }, + { + "filename": "Icon-App-38x38@2x.png", + "idiom": "universal", + "scale": "2x", + "size": "38x38", + "platform": "ios" + }, + { + "filename": "Icon-App-38x38@3x.png", + "idiom": "universal", + "scale": "3x", + "size": "38x38", + "platform": "ios" + }, + { + "filename": "Icon-App-40x40@2x.png", + "idiom": "universal", + "scale": "2x", + "size": "40x40", + "platform": "ios" + }, + { + "filename": "Icon-App-40x40@3x.png", + "idiom": "universal", + "scale": "3x", + "size": "40x40", + "platform": "ios" + }, + { + "filename": "Icon-App-60x60@2x.png", + "idiom": "universal", + "scale": "2x", + "size": "60x60", + "platform": "ios" + }, + { + "filename": "Icon-App-60x60@3x.png", + "idiom": "universal", + "scale": "3x", + "size": "60x60", + "platform": "ios" + }, + { + "filename": "Icon-App-64x64@2x.png", + "idiom": "universal", + "scale": "2x", + "size": "64x64", + "platform": "ios" + }, + { + "filename": "Icon-App-64x64@3x.png", + "idiom": "universal", + "scale": "3x", + "size": "64x64", + "platform": "ios" + }, + { + "filename": "Icon-App-68x68@2x.png", + "idiom": "universal", + "scale": "2x", + "size": "68x68", + "platform": "ios" + }, + { + "filename": "Icon-App-76x76@2x.png", + "idiom": "universal", + "scale": "2x", + "size": "76x76", + "platform": "ios" + }, + { + "filename": "Icon-App-83.5x83.5@2x.png", + "idiom": "universal", + "scale": "2x", + "size": "83.5x83.5", + "platform": "ios" + }, + { + "filename": "Icon-App-1024x1024@1x.png", + "idiom": "universal", + "scale": "1x", + "size": "1024x1024", + "platform": "ios" + } + ], + "info": { + "author": "icons_launcher", + "version": 1 + } +} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index 74421c0..0622103 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index 292eed9..75c6859 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index ada6e18..f6df730 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index f60c2fb..c5e25fb 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index d376806..934b3de 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-38x38@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-38x38@2x.png new file mode 100644 index 0000000..cdaa85c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-38x38@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-38x38@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-38x38@3x.png new file mode 100644 index 0000000..251ae71 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-38x38@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index 0a04f40..be28c15 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index ea63310..741536f 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index ea63310..741536f 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png index 2e02c2b..79277de 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-64x64@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-64x64@2x.png new file mode 100644 index 0000000..f35f306 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-64x64@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-64x64@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-64x64@3x.png new file mode 100644 index 0000000..fa922e9 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-64x64@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-68x68@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-68x68@2x.png new file mode 100644 index 0000000..25732b7 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-68x68@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png index 53d3757..8fc51a2 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png index cfaa530..a31674b 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/lib/custom_widgets.dart b/lib/custom_widgets.dart index ae7dde9..e1b26b5 100644 --- a/lib/custom_widgets.dart +++ b/lib/custom_widgets.dart @@ -170,7 +170,6 @@ class _stockCentralSuivantState extends State { setState(() { newStock(index); index += 1; - print(transfert.objTransfert.stock_central_suivants); }); }, style: ElevatedButton.styleFrom(backgroundColor: Colors.lightGreen), child: Icon(Icons.add, color: Colors.black)), @@ -179,8 +178,8 @@ class _stockCentralSuivantState extends State { } } -Map oneBoucle = {}; -int count=1; +List> oneBoucle = []; +int count=0; class Boucle extends StatefulWidget { final String district; @@ -192,16 +191,15 @@ class Boucle extends StatefulWidget { class _BoucleState extends State { List _boucle = []; - Map quantite = {}; void create_boucle(int count){ - quantite[count] = ""; + oneBoucle.add({}); _boucle.add(Stock(hintText: "Livraison Retour", column: LIVRAISON_RETOUR, background: background, onSelect: (value) { setState(() { - oneBoucle["livraison_retour"] = value; + oneBoucle[count]["livraison_retour"] = value; }); } ) @@ -212,17 +210,17 @@ class _BoucleState extends State { background: background, onSelect: (value) { setState(() { - oneBoucle["colline"] = value; + oneBoucle[count]["colline"] = value; }); } ) ); - _boucle.add(Stock(hintText: "Input", + _boucle.add(Stock(hintText: "Produit", column: INPUT, background: background, onSelect: (value) { setState(() { - oneBoucle["input"] = value; + oneBoucle[count]["input"] = value; }); } ) @@ -233,7 +231,7 @@ class _BoucleState extends State { hintText: "Quantité...", ), onChanged: (value){ - oneBoucle["quantite"] = value; + oneBoucle[count]["quantite"] = value; }, )); @@ -256,7 +254,7 @@ class _BoucleState extends State { SizedBox(height: 10,), ElevatedButton(onPressed: (){ setState(() { - livraison.objLivraison.boucle[count.toString()] = oneBoucle; + livraison.objLivraison.boucle[count.toString()] = oneBoucle[count]; count +=1; create_boucle(count); }); diff --git a/lib/final_page.dart b/lib/final_page.dart index 401e399..5546fd1 100644 --- a/lib/final_page.dart +++ b/lib/final_page.dart @@ -7,6 +7,8 @@ import 'package:soft/excel_fields.dart'; import 'package:soft/rest.dart'; import 'package:soft/custom_widgets.dart'; import 'package:image_picker/image_picker.dart'; +import 'package:flutter_image_compress/flutter_image_compress.dart'; +import 'package:path/path.dart' as p; late Color? background; late Color? fieldColor; @@ -37,15 +39,29 @@ class Final extends StatefulWidget { class _FinalState extends State { Uint8List? _image; + int quality = 50; + CompressFormat format=CompressFormat.jpeg; TextEditingController motif = TextEditingController(); Future fromGallery() async{ final imagePicker = ImagePicker(); final pickedFile = await imagePicker.pickImage(source: ImageSource.gallery); if (pickedFile != null){ - setState(() { - _image = File(pickedFile.path).readAsBytesSync(); - }); + final String targetPath = p.join(Directory.systemTemp.path, 'temp.${format.name}'); + final XFile? compressedImage = await FlutterImageCompress.compressAndGetFile( + pickedFile.path, + targetPath, + quality: quality, + format: format + ); + if (compressedImage != null) { + setState(() { + _image = File(compressedImage.path).readAsBytesSync(); + }); + } + else{ + _image = File(pickedFile.path).readAsBytesSync(); + } } return pickedFile; } @@ -54,9 +70,21 @@ class _FinalState extends State { final imagePicker = ImagePicker(); final pickedFile = await imagePicker.pickImage(source: ImageSource.camera); if (pickedFile != null){ - setState(() { + final String targetPath = p.join(Directory.systemTemp.path, 'temp.${format.name}'); + final XFile? compressedImage = await FlutterImageCompress.compressAndGetFile( + pickedFile.path, + targetPath, + quality: quality, + format: format + ); + if (compressedImage != null) { + setState(() { + _image = File(compressedImage.path).readAsBytesSync(); + }); + } + else{ _image = File(pickedFile.path).readAsBytesSync(); - }); + } } return pickedFile; } @@ -113,16 +141,7 @@ class _FinalState extends State { mssg = ""; }); isLoading = true; - /*List? imageUrl = objtransf != null ? await getUrl(objtransf.photo_mvt) : await getUrl(objlivraison!.photo_mvt); - if (imageUrl == []){ - setState(() { - isLoading = false; - }); - return; - } - */ - //objtransf != null ? objtransf.photo_mvt = imageUrl[0]["url"] : objlivraison?.photo_mvt = imageUrl[0]["url"]; - Response? isValidRequest = objtransf != null ? await objtransf?.postMe() : await objlivraison?.postMe(); + Response? isValidRequest = objtransf != null ? await objtransf.postMe() : await objlivraison?.postMe(); setState(() { isLoading = false; }); @@ -134,7 +153,6 @@ class _FinalState extends State { } else { setState(() { - print(isValidRequest!.body); mssg = "Echec!"; }); } @@ -217,9 +235,9 @@ class _FinalState extends State { : ElevatedButton(onPressed: (){ objLivraison?.motif = motif.text; objtransf?.motif = motif.text; - /*String imageB64 = base64Encode(_image!.toList()); + String imageB64 = base64Encode(_image!.toList()); objtransf?.photo_mvt = imageB64; - objLivraison?.photo_mvt = imageB64;*/ + objLivraison?.photo_mvt = imageB64; save(objtransf: objtransf, objlivraison: objLivraison); }, style: ElevatedButton.styleFrom(backgroundColor: Colors.lightGreen), child: Text("Enregistrer", diff --git a/lib/livraison.dart b/lib/livraison.dart index c7301d1..88d44e7 100644 --- a/lib/livraison.dart +++ b/lib/livraison.dart @@ -46,8 +46,7 @@ class _LivraisonScreenState extends State { ElevatedButton(onPressed: (){}, style: ElevatedButton.styleFrom(backgroundColor: Colors.lightGreen), child: IconButton(onPressed: (){ - objLivraison.boucle[count.toString()] = oneBoucle; - print(objLivraison.boucle); + objLivraison.boucle[count.toString()] = oneBoucle[count]; Navigator.pushNamed(context, "/final", arguments: final_page.ScreenTransition(backgroundColor: background, fieldcolor: fieldcolor, objectLivraison: objLivraison @@ -67,4 +66,4 @@ class _LivraisonScreenState extends State { ), ); } -} \ No newline at end of file +} diff --git a/lib/main.dart b/lib/main.dart index dad215c..42b3e92 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -44,6 +44,8 @@ class _LoginState extends State { } } class LoginPage extends StatefulWidget{ + const LoginPage({super.key}); + @override State createState() => _LoginPageState(); } @@ -82,7 +84,7 @@ class _LoginPageState extends State { isLoading = false; }); - if (isValidUser) { + if (mounted && isValidUser) { objTransfert.user = _uname.text; objLivraison.user = _uname.text; _uname.text = ""; @@ -103,7 +105,7 @@ class _LoginPageState extends State { @override Widget build(BuildContext context){ return - Container( + SizedBox( width: double.infinity, height: double.infinity, child: Scaffold( @@ -137,7 +139,7 @@ class _LoginPageState extends State { SizedBox( height: 25.0, ), - Text("$errormssg", style: TextStyle(color: Colors.red),), + Text(errormssg, style: TextStyle(color: Colors.red),), SizedBox(height: 25,), TextField( style: TextStyle(color: fieldColor), diff --git a/lib/rest.dart b/lib/rest.dart index b99d545..4e09e6f 100644 --- a/lib/rest.dart +++ b/lib/rest.dart @@ -22,6 +22,7 @@ class Transfert{ Future postMe() async{ Uri url = Uri.parse("$HOST/api/transferts"); + Map imageUrl = await getUrl(photo_mvt); http.Response response = await http.post( url, headers: { @@ -35,14 +36,12 @@ class Transfert{ 'stock_central_depart': stock_central_depart, 'stock_central_suivants': jsonEncode(stock_central_suivants), 'stock_central_retour': stock_central_retour, - 'photo_mvt': photo_mvt, + 'photo_mvt': imageUrl != {} ? imageUrl["url"] : "", 'type_transport': type_transport, 'user': user, 'motif': motif }) ); - print(response.statusCode); - print(response.body); return response; } } @@ -63,7 +62,7 @@ class Livraison{ Livraison(); Future postMe() async{ - print(jsonEncode(jsonEncode(boucle))); + Map imageUrl = await getUrl(photo_mvt); Uri url = Uri.parse("$HOST/api/livraisons"); http.Response response = await http.post( url, @@ -77,16 +76,14 @@ class Livraison{ 'logistic_official': logistic_official, 'numero_mouvement': numero_mouvement, 'stock_central_depart': stock_central_depart, - 'boucle': jsonEncode(jsonEncode(boucle)), + 'boucle': jsonEncode(boucle), 'stock_central_retour': stock_central_retour, - 'photo_mvt': photo_mvt, + 'photo_mvt': imageUrl != {} ? imageUrl["url"] : "", 'type_transport': type_transport, 'user': user, 'motif': motif }) ); - print(response.statusCode); - print(response.body); return response; } @@ -120,19 +117,20 @@ Future getLivraison(String date, String user) async { return decoded; } -Future getUrl(String image) async { - var url = Uri.parse("$HOST/api/image?image=$image&filename=mouvement.jpg"); - http.Response response = await http.get(url); - var decoded = []; - if (response.statusCode == 200) { - String data = response.body; - decoded = jsonDecode(data); - } else { - decoded = []; +Future getUrl(String image) async { + Uri url = Uri.parse("$HOST/api/image"); + http.Response response = await http.post( + url, + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + }, + body: jsonEncode({ + 'image': image, + 'filename': 'mouvement.jpeg' + }) + ); + return jsonDecode(response.body); } - print("$decoded -- url"); - return decoded; -} Future isUser(String _n_9032, String _n_9064) async { var CODE = "JK9X80L4RT"; @@ -140,8 +138,7 @@ Future isUser(String _n_9032, String _n_9064) async { "$HOST/api/list?code=$CODE&_n_9032=$_n_9032&_n_9064=$_n_9064"); http.Response response = await http.get(url); if (response.statusCode == 200) { - print("Ok"); return true; } return false; -} \ No newline at end of file +} diff --git a/lib/transfert.dart b/lib/transfert.dart index ee641e8..604e53a 100644 --- a/lib/transfert.dart +++ b/lib/transfert.dart @@ -44,7 +44,6 @@ class _TransfertScreenState extends State { children: [ stockCentralSuivant(), ElevatedButton(onPressed: (){ - print(objTransfert.stock_central_suivants); Navigator.pushNamed(context, '/final', arguments: final_page.ScreenTransition(backgroundColor: Background, fieldcolor: fieldColor, objectTransfert: objTransfert) diff --git a/pubspec.lock b/pubspec.lock index 0d4b578..5169e36 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -49,22 +49,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" - checked_yaml: - dependency: transitive - description: - name: checked_yaml - sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff - url: "https://pub.dev" - source: hosted - version: "2.0.3" - cli_util: - dependency: transitive - description: - name: cli_util - sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 - url: "https://pub.dev" - source: hosted - version: "0.4.1" clock: dependency: transitive description: @@ -166,14 +150,54 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_launcher_icons: - dependency: "direct dev" + flutter_image_compress: + dependency: "direct main" + description: + name: flutter_image_compress + sha256: "45a3071868092a61b11044c70422b04d39d4d9f2ef536f3c5b11fb65a1e7dd90" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + flutter_image_compress_common: + dependency: transitive + description: + name: flutter_image_compress_common + sha256: "7f79bc6c8a363063620b4e372fa86bc691e1cb28e58048cd38e030692fbd99ee" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + flutter_image_compress_macos: + dependency: transitive + description: + name: flutter_image_compress_macos + sha256: "26df6385512e92b3789dc76b613b54b55c457a7f1532e59078b04bf189782d47" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + flutter_image_compress_ohos: + dependency: transitive + description: + name: flutter_image_compress_ohos + sha256: e76b92bbc830ee08f5b05962fc78a532011fcd2041f620b5400a593e96da3f51 + url: "https://pub.dev" + source: hosted + version: "0.0.3" + flutter_image_compress_platform_interface: + dependency: transitive description: - name: flutter_launcher_icons - sha256: "619817c4b65b322b5104b6bb6dfe6cda62d9729bd7ad4303ecc8b4e690a67a77" + name: flutter_image_compress_platform_interface + sha256: "579cb3947fd4309103afe6442a01ca01e1e6f93dc53bb4cbd090e8ce34a41889" url: "https://pub.dev" source: hosted - version: "0.14.1" + version: "1.0.5" + flutter_image_compress_web: + dependency: transitive + description: + name: flutter_image_compress_web + sha256: f02fe352b17f82b72f481de45add240db062a2585850bea1667e82cc4cd6c311 + url: "https://pub.dev" + source: hosted + version: "0.1.4+1" flutter_lints: dependency: "direct dev" description: @@ -216,6 +240,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + icons_launcher: + dependency: "direct dev" + description: + name: icons_launcher + sha256: a7c83fbc837dc6f81944ef35c3756f533bb2aba32fcca5cbcdb2dbcd877d5ae9 + url: "https://pub.dev" + source: hosted + version: "3.0.0" image: dependency: transitive description: @@ -288,14 +320,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.1+1" - json_annotation: + js: dependency: transitive description: - name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf url: "https://pub.dev" source: hosted - version: "4.9.0" + version: "0.7.1" leak_tracker: dependency: transitive description: @@ -445,6 +477,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + universal_io: + dependency: transitive + description: + name: universal_io + sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad" + url: "https://pub.dev" + source: hosted + version: "2.2.2" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2f386b8..c55a96a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,6 +34,7 @@ dependencies: http: any auto_route: any image_picker: any + flutter_image_compress: any # The following adds the Cupertino Icons font to your application. @@ -43,7 +44,8 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_launcher_icons: any + #flutter_launcher_icons: any + icons_launcher: any # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is @@ -93,12 +95,19 @@ flutter: # # For details regarding fonts from package dependencies, # see https://flutter.dev/to/font-from-package -flutter_launcher_icons: - android: true - ios: true - min_sdk_android: 29 +#flutter_launcher_icons: +# android: "assets/icon/drawer2.png" +# ios: true +# min_sdk_android: 29 +# image_path: "assets/icon/drawer2.png" +# remove_alpha_channel_ios: true +# remove_alpha_ios: true +# adaptive_icon_background: "#ffffff" + +icons_launcher: image_path: "assets/icon/drawer2.png" - remove_alpha_channel_ios: true - remove_alpha_ios: true - adaptive_icon_background: "#ffffff" - adaptive_icon_foreground: "assets/icon/drawer2.png" \ No newline at end of file + platforms: + android: + enable: true + ios: + enable: true