From 4d936d2ee37305b6c2c1675ade5dcd690f9b7e56 Mon Sep 17 00:00:00 2001 From: Mathew Date: Fri, 17 Jul 2026 21:28:33 +0200 Subject: [PATCH] Version initiale de Gestion Prix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit App Flutter de gestion de stock/prix pour tablette Android (100% local) : scan code-barres (OpenFoodFacts), prix au kilo/litre, packs, inventaire, prix d'achat + marge, filtres de tri, étiquettes PDF, design noir & blanc. Co-Authored-By: Claude Opus 4.8 --- .gitignore | 45 + .metadata | 30 + README.md | 53 ++ analysis_options.yaml | 28 + android/.gitignore | 14 + android/app/build.gradle.kts | 49 + android/app/src/debug/AndroidManifest.xml | 7 + android/app/src/main/AndroidManifest.xml | 48 + .../gestion_prix_produit/MainActivity.kt | 5 + .../drawable-hdpi/ic_launcher_foreground.png | Bin 0 -> 1933 bytes .../drawable-mdpi/ic_launcher_foreground.png | Bin 0 -> 1095 bytes .../res/drawable-v21/launch_background.xml | 12 + .../drawable-xhdpi/ic_launcher_foreground.png | Bin 0 -> 2227 bytes .../ic_launcher_foreground.png | Bin 0 -> 3221 bytes .../ic_launcher_foreground.png | Bin 0 -> 4491 bytes .../main/res/drawable/launch_background.xml | 12 + .../res/mipmap-anydpi-v26/ic_launcher.xml | 9 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 1039 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 570 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 1132 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 1870 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 2082 bytes .../app/src/main/res/values-night/styles.xml | 18 + android/app/src/main/res/values/colors.xml | 4 + android/app/src/main/res/values/styles.xml | 18 + android/app/src/profile/AndroidManifest.xml | 7 + android/build.gradle.kts | 24 + android/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.properties | 5 + android/settings.gradle.kts | 26 + assets/icon/icon.png | Bin 0 -> 31097 bytes assets/icon/icon_foreground.png | Bin 0 -> 11159 bytes lib/config.dart | 5 + lib/main.dart | 37 + lib/models/produit.dart | 185 ++++ lib/screens/etiquettes_screen.dart | 276 ++++++ lib/screens/home_shell.dart | 52 ++ lib/screens/produit_edit_screen.dart | 703 ++++++++++++++ lib/screens/produits_screen.dart | 294 ++++++ lib/screens/scan_screen.dart | 254 +++++ lib/services/etiquette_pdf.dart | 106 +++ lib/services/local_db.dart | 69 ++ lib/services/openfoodfacts_service.dart | 84 ++ lib/services/photo_service.dart | 33 + lib/services/produit_repository.dart | 91 ++ lib/services/reglages.dart | 27 + lib/theme.dart | 116 +++ lib/utils/format.dart | 5 + lib/utils/tri.dart | 41 + lib/widgets/produit_image.dart | 62 ++ pubspec.lock | 866 ++++++++++++++++++ pubspec.yaml | 108 +++ test/widget_test.dart | 18 + 53 files changed, 3852 insertions(+) create mode 100644 .gitignore create mode 100644 .metadata create mode 100644 README.md create mode 100644 analysis_options.yaml create mode 100644 android/.gitignore create mode 100644 android/app/build.gradle.kts create mode 100644 android/app/src/debug/AndroidManifest.xml create mode 100644 android/app/src/main/AndroidManifest.xml create mode 100644 android/app/src/main/kotlin/com/magasin/gestion_prix_produit/MainActivity.kt create mode 100644 android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png create mode 100644 android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png create mode 100644 android/app/src/main/res/drawable-v21/launch_background.xml create mode 100644 android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png create mode 100644 android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png create mode 100644 android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png create mode 100644 android/app/src/main/res/drawable/launch_background.xml create mode 100644 android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 android/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 android/app/src/main/res/values-night/styles.xml create mode 100644 android/app/src/main/res/values/colors.xml create mode 100644 android/app/src/main/res/values/styles.xml create mode 100644 android/app/src/profile/AndroidManifest.xml create mode 100644 android/build.gradle.kts create mode 100644 android/gradle.properties create mode 100644 android/gradle/wrapper/gradle-wrapper.properties create mode 100644 android/settings.gradle.kts create mode 100644 assets/icon/icon.png create mode 100644 assets/icon/icon_foreground.png create mode 100644 lib/config.dart create mode 100644 lib/main.dart create mode 100644 lib/models/produit.dart create mode 100644 lib/screens/etiquettes_screen.dart create mode 100644 lib/screens/home_shell.dart create mode 100644 lib/screens/produit_edit_screen.dart create mode 100644 lib/screens/produits_screen.dart create mode 100644 lib/screens/scan_screen.dart create mode 100644 lib/services/etiquette_pdf.dart create mode 100644 lib/services/local_db.dart create mode 100644 lib/services/openfoodfacts_service.dart create mode 100644 lib/services/photo_service.dart create mode 100644 lib/services/produit_repository.dart create mode 100644 lib/services/reglages.dart create mode 100644 lib/theme.dart create mode 100644 lib/utils/format.dart create mode 100644 lib/utils/tri.dart create mode 100644 lib/widgets/produit_image.dart create mode 100644 pubspec.lock create mode 100644 pubspec.yaml create mode 100644 test/widget_test.dart diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3820a95 --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..aa8e03d --- /dev/null +++ b/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "ad70ec4617166f1c38e5d2bfd388af71fda14f06" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 + base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 + - platform: android + create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 + base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/README.md b/README.md new file mode 100644 index 0000000..e0f2d1a --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# Gestion Prix Produit + +App Android (Flutter) de gestion de stock et de prix pour un magasin, conçue pour +une tablette Android 12 en mode portrait. **Stockage 100% local** (SQLite) : aucune +connexion serveur nécessaire, fonctionne hors-ligne. Une connexion internet sert +seulement à récupérer le nom + l'image d'un produit lors du scan. + +## Fonctions + +- **Produits** : liste de tous les produits (nom, prix HT / TTC), recherche, édition. +- **Scanner** : scan d'un code-barres puis recherche automatique du nom + image via + [OpenFoodFacts](https://world.openfoodfacts.org), saisie des prix, ajout à la liste. +- **Étiquettes** : sélection des produits (un par un ou « tout sélectionner ») puis + génération d'une planche A4 d'étiquettes (nom, prix, code-barres) imprimable sur une + imprimante Wi-Fi classique (ex : Canon TS4550) via le système d'impression Android. + +## Techno + +- Flutter (Material 3, thème noir & blanc + accent bleu) +- `mobile_scanner` (scan code-barres, open source / ML Kit) +- `sqflite` (base de données locale SQLite, persistée sur la tablette) +- `pdf` + `printing` (étiquettes) + +## Lancer l'app + +```bash +flutter run +``` + +Les produits sont enregistrés localement et conservés d'une session à l'autre. + +## Structure + +```text +lib/ +├── main.dart # init + thème + navigation +├── config.dart # TVA par défaut +├── theme.dart # thème noir & blanc + accent +├── models/produit.dart +├── services/ +│ ├── local_db.dart # base SQLite locale +│ ├── produit_repository.dart # source de vérité (CRUD) +│ ├── openfoodfacts_service.dart # lookup code-barres +│ └── etiquette_pdf.dart # génération PDF des étiquettes +├── screens/ +│ ├── home_shell.dart # 3 onglets + barre de navigation +│ ├── produits_screen.dart +│ ├── scan_screen.dart +│ ├── produit_edit_screen.dart +│ └── etiquettes_screen.dart +├── widgets/produit_image.dart +└── utils/format.dart +``` diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 0000000..12eea7c --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,49 @@ +plugins { + id("com.android.application") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.magasin.gestion_prix_produit" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.magasin.gestion_prix_produit" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + // R8/minification désactivé : il supprimait des classes de ML Kit + // (scanner de code-barres) → caméra HS en release. Off = comportement debug. + isMinifyEnabled = false + isShrinkResources = false + } + } +} + +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + +flutter { + source = "../.." +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..21f2bcf --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/magasin/gestion_prix_produit/MainActivity.kt b/android/app/src/main/kotlin/com/magasin/gestion_prix_produit/MainActivity.kt new file mode 100644 index 0000000..5efbdba --- /dev/null +++ b/android/app/src/main/kotlin/com/magasin/gestion_prix_produit/MainActivity.kt @@ -0,0 +1,5 @@ +package com.magasin.gestion_prix_produit + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..fa664f3040e00e5a07321f1f8d1ad30644843223 GIT binary patch literal 1933 zcmd6oTT~L*9>%Rxqc+HpnWEucCp$TqDU77TBq(|$4XvnUVQN{TnWUCx#IaE#BNT6m zlBOkLtc;)Z-jSD$4VJdAuq^b)~uPAS!-U;dDwe@-(LIw{n!5OhkfgC z0M=le*)|;=9RojKOptah`)%lbp`BY5#=CTMbdUI94jxJ3%#BcSeTfjkf=b1Q?1rEM ztU!RRxslN)QsEE&=?h@|3WXVq$3`9}d4M)+t+$VY9?#t}9?|Kla@ z+k4UJ(_b0EH*MXXC7U6m_;bJjrtIJ7xG|G8o<-4Oih#0^GT)eD4utv8b=nIkn=q{) z{jF#_JpjvUALd32NPqMH+F-4r53EGUCoc|T5(u*L#S4RhdApGHlDjadb9>W$DP*Cs zi~7!@1QC7b>q2ARSYne>)Jf?YOsGFHvQM>5U`ccHDztby<2Z8SjEK{0w;ll(OsypE z&7eMaAg-s?*S?MF*~tt9khdfh*;=2Q?eSDrB1B)vT>x!w>iC48hNgzG3WDVUV&lc- z-ue6rGcoisCyb6)VBOR!V@#ayJ?C$iHs0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!US)zTa~`_?_3 z=&zSfFEY_B-TV8=`}FVolKs`*|JZB3UBusD>B?8X4$B|Ql8T!dw<_ZDF1?tIRfn%8 z>-PE`oAIT*`JF~rf|fvBNNoL%&+9iXdwJT-ZvUp8uTTH@n0xkHiqYHie0Q7WbFwx) z>oL_8&pkTLzhCt55=Zvg`J2+Tr+FUc{nl`@Xw$MK^>2laZ&Qi7tQ6%jzjCdF8n4lf zn#rcWYG+HB?>i;$f5$@C`<0#G(ko|PznI)6{wDujG%jgMdZ(ElifH}K$z+W2Oh z%z%SjJJYAyUDSB_Px;A(LtO3L<-)X^x;zaGh5Y1 zOB`8(qXI(BOX@;S>^^ws@2ZrS&zjEHmS6Havj4`fMY&7=f4->DbTrKT>hUb8sJ&ME z_vIwV9-Sq-)>+)z?!zmoyhaYOl`*^jDaIr>cNol&W?H!7`EQ<!R?oDr`^J40Tl(E|}zAs=Cwu-1OJ8rns6$ z#$-LeetMCY*I}ip{TX%n^^OY7f9D&LmQa`_*Sz1pCZ;ResN(drc(zSObGD@FYvMBDzrDbcE0@AM|bj?Ii~I2AM-LRZ%tLz`P&;s^-Wk8 z_uJ}uF>zb3yb+mPVj%hd*^{&L{{DV*a!TZZ@}GQ45q{TXeAV~ey*p1J^Lw>^T@$BU hFohWgMf)Gl=jv`>&VOHa2v|Tcc)I$ztaD0e0svUD16Ke5 literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..a8440515f32daf1d2ecff346cd1c3a488dedb044 GIT binary patch literal 2227 zcmdT``8V5%7Dp+iN>9d88cTzCDr)J|s>I$wE$wJ|G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7^=MtyeUGrr^U%j=#B8CzlGSzVfLXfX1MzrkxKUDcLUZpJ%xir0+ zf~#uPwn=M@a1D0dJNZ1vJ>IsC{;Xdyb7?%}D;>9QsWFTSr^~FWUnOH@&|0Rv4`7#k zaYwMtsRMhKH|V+gy`{_19XzwfX$vr_iWaO%D9 z&#Uj%I%sU+hyIT~LDlDPXm|kw;^*z<$wTmj9nli)7vhcR5gRjdYGpP#Ufz=eJwI;l zzpk`IYR4)EH00EpmSih3QjAjkUAFYzAY>al-E8-hhkmQ~2NfHO2b10;DC&?4Srx{M<)2Dhz8wTEqZ%w5>N z-IeKlYN}|rFuTR}Kt{3DM`X0RI|IvA0s^|9Ew+oYsWjns{DB!BKk$t8&QDqvVn`gtQ0JJzM)! zH={6Dd82EhB#~PNm`^nY*4c%VV)mV2r#s9kh?3V$D69a{h(XznF%Ml= yRRe82N@@}|LQ$c3b%aii@871Y|D~8m@hY*4m=SL{xkveos05x4^`rWrbN&DWh}?(( literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..3d110151fadf1393ea46b2c51071e180dd56c074 GIT binary patch literal 3221 zcmeHKXHXN^7G|H>1y&J!E22_F99c>rN@$h@1GrSd4NaP?RH=~~LI_!-qOuCoTMVm` zAfb(60U;33h=iJzP6A=+%_LGn2qfgi+5hjy`}bz{$C){EzccsFeCNz}zw`LIi=EQ< zC%>1IlT&iAw}s2eePjDI6uy(41gzS9l#@H;=U@wSPsVen&{5A9Fdgel5ZZ?(KYM)o z2SuTZageXt?cc-4hij@7SdN{ZiY#8%6<<@&@R7!sPm{RiwdB{j(eC%|`ba-H{7P~3 z5Zw#*msdR^TK?WzO}!nZCa%vbTqJF;N4qx~Yk? zOZdVbK*zJ5R(Ux~F9n?|Dz?9BKazu~e1p^e7XSuOz$vHzj%fb_$SCQ)iW%A~Gy_UI zk}o>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icrxXDkmc(Z6DQRNdEf2Y zS@E`(ioky)Z9yxnLeF)~^(%#)`G5Wg8E-Q>XO9b?qxw56*M8!H-$9sv^e=Zkkt7%C z$vR>+HB<;q33Bu{|4j2j+trA;z2w0wZ;A-hL&%N&#(_XqLp!J@;-sW2YDv0HqV2mi z2{n1H2#pn2CpFI}tctd(qWuaY$iFRh9?EttoqG@m?jTts|qaSa^e@=E}ieDo8_|Id`y_QO5$0INO_?8I@P_rhvd^I-(#e__W zM1WF`B`iZ&vkRfcM?RRui*k{}kFRKM$OFk&kU@EW zw>9jSB*nnu@ad+7k+YHey8QD42f2HVp9j$2g%-*#pR-Hi>L2^{2Nz%O(?$y)`;um()lT@06rhL6dCg-+Iy7LqCzHUkBU~5WOYu zg-6{Y?7hhY=#M#iq<2hRr03zIK5Wi7rLJ!6OKoPslvVWf-uMuNyLWL@D@&}XW3!ue v%BWEyE@iXfEP@dDOzj_c`d@wd4%WEO{oBE``|oAzhMdDy7u#CvUvU2cxB`|Y literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..b18a504dc119fec4b08b6bf1dd62085ccb369e49 GIT binary patch literal 4491 zcmeHLX*3(!+BUS58tPULZK{e>YUUc+B6LKlp=dS6^f>Ai5o1*%i5{(9Em0aXQ8a=U zH6&(9tJNBF%tM6JI)s`f5;ETO`+j}Dzjc4z^W$0T-TQs^diQ?!yPtQho$BuDATN7D zR!mGx{<`B;4>2+EcRz4QN;LDu)kIHBOv&T=)k|Ivi`Hp}U--u%$lJnchpfQ}$I}{s z7e{)7WY7u+oU%?d5km1cKbvNvkBw=f)n=;4e@Xf&>ig*{j))uC$EBV;`YAT?h|HZ! ztL3K^CCe@zyqwF-)CKP`78Hx5GR5ykihI z+PGPp=jC7}lZWyZL&CAtmp(ZL&^(*?UUww60izI_mpDMbXXMY%RG9#>vhg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Bf+#|f8La6$zN0Ah%3mdK5Znw6Y6tpzX+s50D z6i1+1^bNzS+=2q*1X!#MjfC{(3@7{Z(XBhgA#?7#nOLtFNZaCEE%T!pkSpkaB&#W^ zp;~`k1glW3os?3oTrx5VCdMtTlzS7@{;A0htw|stZd_rYR(c!W5|=>_Z&HJrS)_)8vf3h1LJwxF3AAwLr6R{L5t1Rt zf2OK>M#4V7k9g<~Xxfh{_D62g&71~Iotv(8_40*>pEzaGNnHoh8oYc1h5cCn_PGG& z$=4%;)4;g6I7MZkH1iA?gOiU(Zm{kjrU<=;W8AamNndN7sn4+zoPU_~d2mzOQF-(P zhn(Pr=UChfMA%K6*M&)`{!0{RMi3bi?=)TK;q?3&7T30zARS(t{DvXH9VH5qd|<7FX9?+>X4uRhVa z4Jqc0&DVw(bS-}qx$P62e6g+Ukz3a&;>jZ6o=Fk<3#O0b{SY5pdSmRomUApzF{ zKi>KhM=wG!LEg0dV36~0qgR6sh2gSFVt;i}^wSH#0L8T)7yEic0^t1a&uaT<~}P)(S%I(I@>kuY*p zNe7{c3x^HIJjtQcbaA)b>RNful-gDv{aS`3_X_zC9@0&tQX~9!K5@F~fu>ziGxaa; z87Fu;?E@;hkShbV9BkG8hIhz*9%f(2&$3ypdc%~`0Xg|Th}c{7ELL-?q3-i$9GdwN zG@u$~mgzSv`Qg!)r0X3TU~@gxWux@ugJlOP_i_# XYlHxOIw$&M5xaiP^=j>9@bCWyy + + + + + + + diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..c79c58a --- /dev/null +++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..21c56786cfd7c61c31ba592c438e36783c05dc84 GIT binary pat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-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..3ed9d822d6aa675c134c12689dcafcb496ccc37d GIT binary patch literal 570 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezr3(Ffn?%IEGZrc{|g$`?7;f`+Uz! z*EpQGx-$f$B5bNZY=}NMnSJFvn~KlEKN$CDiGF<|{&7Q>x-G{%7F(SYN;+QQu{s<_ zr|;T&`&p{ntZPeOJL$gJ-*d=DV3Lp8&%g8cw6l17iyp4`N!Z_-z=SP$CxOl1N&{jp@_f(~J3E*sXHOKkmA zgp7pA5zVX(E^!3Tp{D1Kz9X{@NtaH=(zwWgsJt7+~t_}A6wqur5z~j`# zWtn$O6QtGQ$l&bcuZnwP4$BPPe`TaM~ zeY<6L`(}@+gSxfQMI)xg`FA#4JD~4c{Pp@_J^TB%6FQ~|dhE;nRQZU@`V|aSW-L^Y%`Dj&P~W@sH>4 zZcSY}J2{vA#D|Fjz7t%8*upTLr2q9(A|UqMQ!aYOn8<(fnD z9D4kH&U}bh66#TtDs8&Fabw@M*Yj`M-@Ds?r&sLcwp)K++U@t=zkW&P`>L1k%ie#R zetT24#>_iQ6f&IN$YzuaHTW=1@MJLJbWmeFp~5heMPV{S3SmJe=>r_Df|2`~+Y%QU zl?tz#mHz(HBo-qFi;p})%;|})lmBgsKC5h7!*cb?_cyW8TMn>xe6edkvhTCO;kjQ+ z)1DZre4FQ-_JcP>ZU5qT_mfz)4!k)i-y+#}w(?x`bKB`ZKWUsQZ`1s}U8Ipyz%Qr% z!@2p@AF_G0n|{o@>``B+VKBeNfn`Sit;i1f#0NeJ%aq?T>zKT?SgI*fzmH?7Oo`oB zEvH!jEAzQ8l`JW3aJ%gH>{ejN`@awD_4?~udG+JI`g>+K8Odf!FSxj6@s#dYd*xrB z_Is$mW2(-Yz9Y)FSre@;896N8EZhIx@BNG0!Smzx+~+=H`mu8R)mp1ddJe|v*7N4w zm47gQ;^}~O%{Qho8}K9_%q^YQw}nf<)2{o-=VsrzZ)Ysju$o`D_T}|;zV0s{9$w)W z7yoSDI+S=I?2t2 z9}e5J-FtQHb^51@%;!=vZ{9mty?@jyeA(io7f*7g`24#o9$ea(*OM;ure43DyM6bE zck0GF?2RL%X-CAEf4r&pU#3(iVf zeRZKPgLVDw{l7l$pFV3_&YC-Gr}bad$z`gTKC>#^(9QgP_DhSYS9oviw2!hn28^2n z#(&=yCS3ph;>GRTA66Y-8sN3i=%eYT`+GJoTE9CcinU<1<^M%l+TSb=ea!ur>V5j` z0=Y9k%f6Z4XuT+U>+;map$$^$X@~Z2W!7chB1~d_gXPTcj3P1)D`mN*UI9xH22WQ% Jmvv4FO#tUm1AhPj literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..ee74a1ecd652d7bf49fb7058dcb088990dddd952 GIT binary patch literal 1870 zcmaJ?dpOhkAJ^p4inb-?67?Oi$em#pvaM;1;glL7w|-%c)|ztZOj^cVmYpG*kuy|| zoP%7VC->ZDM@VxkKSxg}J)6=m!qwFTQB$HaS`&T(?uyzgSN&KWFZDTrnTg zx!st>41QDs?Ck15UOT94sqE>ZFB{ma@9}J_Ic66dk-~Vrouuc1*I;SugbED6s@y_| zaq8I;N^|q%0=r;*vR*P+-z}2b0H!GcUF)?G7h;-0iW$XUu z;hw)P|Gajw|8R*)RmE@ z`nAOrRsaq6H?V^De!C40{H44(F__cCHf{$vS|lc6@BeiF@nJ>>@T{NA2$lva_!;gy zasv~D3@+POm`%1eg>{#V)ZO{?(hCxON*PPiXzz)z;t(3dD+hfPjRKL8M%DpsU4jw1 zfHrV)=#9kaZIpl7s4YsoA;p#bs80<`rlf-A@;&%Y#~*B|%BK62T6zm$b5Gq^;P)*q zb3M7`-ldQ4IXXX_jbaGlUVJD^J=*2Gp!|@uP;K?Z{;IdUfAr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4W)=a%KL#7+D(BqGBHo}wgQnC zPf!BHJNGa8)!6AGKmo0ypyjNHT*4a(VbJ!Bc)8BHMHBy@NxA%@AuEjO?<69ZO z3HIaHxlGF!;(wgaa8e9e^OUSO;*?CAIo-gDyTmu-WAVQ_H(CBPa@FwpT9l6oJNUW2 zgD0%Kv(qJ`T9?S-zux(=*FXrqi2rp8-7@nqMd|{j+Cz!e%*cV(zTqXq#U(#(d5RTq z`hF^0aIINW)t|M#rm=J&Td8OLc;`=a%Ko^chsTN>A&4Hj?C1jkczODIv>?CB`VZw{ BuBZS2 literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f9dde77 --- /dev/null +++ b/android/app/src/main/res/values/colors.xml @@ -0,0 +1,4 @@ + + + #14141A + \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 0000000..dbee657 --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,24 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..e96108c --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,6 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +# This newDsl flag was added by the Flutter template +android.newDsl=false +# This builtInKotlin flag was added by the Flutter template +android.builtInKotlin=false diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..2d428bf --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..c21f0c5 --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "9.0.1" apply false + id("org.jetbrains.kotlin.android") version "2.3.20" apply false +} + +include(":app") diff --git a/assets/icon/icon.png b/assets/icon/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..f86063619f36b0aa5aa3d46d4c7976c790b6fbc3 GIT binary patch literal 31097 zcmeHw2~<%}rtAN`^?&cJ_ud!R5?IN(=j{F4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zOg|>A;kAPVyi}v-*btHvS$I5TU2VK<=&1C`e^J=!fra Ie@i*^KRn9+9{>OV literal 0 HcmV?d00001 diff --git a/assets/icon/icon_foreground.png b/assets/icon/icon_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..e8c35a693455797d51586994da427053af6c50ac GIT binary patch literal 11159 zcmeHNX;f3!+CGSiRurwJf(SwI3ayl&C=`JNKSAoX8mVZcNWh{(MGXoV!jM2wsE7pX zfPezxfCCy4WfDl7h{_~N2qGb1Bte1+NeG#9zI}rC_V0K9eRnNbiCmj1;D>6vA_M%)j{PYl4ua+^ME*^n!i!cA zWDjlhUl*Ksag;mz9${}P>+r7L&fbEf*GIRWpPmOP8y4~ZxN&O7x;qcM{_$|e4`CG! z%Z1BIOC4rARDacVt$W8ocK26@u5HbC{q}bChr7=kzyIgvtjySsx}|gWG%DlUudTCL zC@W5uoPm@3mGT1ez9soKV(Ck7xmK|2#{m%1)ZY{WQwU5U@c#pWwAfAg-4-ugYx&12 z%aZn^(fNDH2?2CxdV99)U|WHj)5gfpZz+V^6Dcfd8@yaYw*i6oWL5t5;c^H@eV;%u ztltrAlN7MM#tVp7yrNBHk9=5empA~_-0bhq;b4}95?niEBPS1ubThZ#uIP&zw+5X$V{D5QI@UU7>y!yM*PR}YlnUJ|j(G-M!SzW!vnkOoGkma*VQ zCwjNye16mh>>?ntTHF?+3?YbTq4Zeka=*GNd@yysJ_Sfh<;}AD!d118ty~avr+~;8H?X6 zJ{6`-hOB?3qS;JNPIJ;sUu1XNLKBNiL2VJV-0#BTo` zA4};nBDQR=jzuFQF{WM3fmI8P5#*f(PWz2G8J#{tpfft%`M1+ge>>gvZ>MJ`ov!(w zj}2|QONeiG8aa-mM5c~kIjMOu>ZMrVbZJdoA(g93ZlhKYU&OWRNP!;;J`SCuB!gwj zNei-qoqQ!c(G}c^kqirJbm~BQmNH=;M)$11KK6|qV{70{V&wD`W58jQRf^M*9pdD1 z$>$|2Cu|fig%nqvb|bj~Sv0q+nPi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v);$(p$PkHI|L~Lrb+@P@@N*R*IV$X6Z}Rqc4GHyzM$a194t03+pbSFh+o4!MTKOSuK{^x> zVbjBHFzrV!!3pL=)`=ynJ3F;IE+Q0B}Azk{e|Y+Q?a>xg6?j^BzE6 zE|yw?^T`XZ;&em=He6OE)BFLUg}lm3+X2oeONEIujR%{)zt{@Xxm!)U5N2#={R2uG z?I&P<&IL{Kr&%Lp-miV>4Sj-0zyLaz$~SsR2h%oMF_S4wnIs4U5;BampKZM< zIpNZzCV2fC@`cHhc;{KNizdlLMYinRzug9?k05-dUrb|)tnLe&Xpk@yG34q=Cza>U zME*-V2aU$bjND`Oo&-IU5OnC2-J0B}fqCOn4VA#<>WYobWa~fa&WztutOvx*0YKv3 zXc|Cfe&Hd3(CC=dgRrizJ8Yn#_r`Flx69qs#ZkrARZw$Be}9MtRj24t3mCRYCItChbW93GX2DC5ZZjVJ7qYN&0qgOE*fy zLWsrRwo3fGQe`slMMmyY5U?W{UW|=Lpj5rY>ggEc3SICt{0?Q7tK3RS5oCppkya(g zjn~y+oLAg>|Ab{Efw2JQI>A-80;ffmO0a#$&rL6k4DI7O)5sOKgxU*8H}}J$E-ZV+ ztI)DQ8nU?VSS`#ID6b+@v_BzDksaW-KqRvd62Be69nzJ6)m_GJxh*PV0qqr)I3uBch6(ecD1J{hjObQgM4!btXstU#DD6M|}S<#%?;2M9rp zmHGMGI@iCFn%BpJEa)q+WQ%ARWw)970^kJJ^1I4*owa0}6;h9q$L|48>j2kI(6^}W zza)%HLcv5sY&x9mPFu3)wv`;(Kyv}}eNZ9?@Aoy8DZf?Hz?WSS(Jq9;tlf=e^|ko3 zHU1W8miw$mu!_rDS~#xlPPA-8DtHZ>*FK^#wDATi@Mr0xmO~7!lbIF&sokD^;zWWW zl~Zwi6`41qDm=f@_ main() async { + WidgetsFlutterBinding.ensureInitialized(); + + // App verrouillée en portrait (tablette). + await SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + DeviceOrientation.portraitDown, + ]); + + // Chargement initial des produits depuis la base locale. + await ProduitRepository.instance.charger(); + + runApp(const MonApp()); +} + +class MonApp extends StatelessWidget { + const MonApp({super.key}); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Gestion Prix', + debugShowCheckedModeBanner: false, + theme: AppTheme.clair(), + darkTheme: AppTheme.sombre(), + themeMode: ThemeMode.light, + home: const HomeShell(), + ); + } +} diff --git a/lib/models/produit.dart b/lib/models/produit.dart new file mode 100644 index 0000000..c78ac92 --- /dev/null +++ b/lib/models/produit.dart @@ -0,0 +1,185 @@ +/// Unités de vente supportées (poids et volume). +class Unites { + static const g = 'g'; + static const kg = 'kg'; + static const ml = 'ml'; + static const cl = 'cl'; + static const l = 'L'; + + /// Ancienne valeur (produits d'avant) : vendu à l'unité. Plus proposée. + static const piece = 'piece'; + + static const tout = [g, kg, ml, cl, l]; + + /// Vrai si le code est une unité de mesure valide (donc pas 'piece'/null). + static bool estValide(String? code) => tout.contains(code); + + static String libelle(String? code) => switch (code) { + g => 'g', + kg => 'kg', + ml => 'ml', + cl => 'cl', + l => 'L', + _ => '', + }; +} + +/// Un produit du stock. +class Produit { + final String id; + final String? codeBarres; + final String nom; + final String? imageUrl; + + /// Prix de vente (au client). + final double prix; + + /// Prix d'achat (coût). 0 = non renseigné. + final double prixAchat; + + /// Contenance d'UN contenant (ex : 330 pour 330 ml, 400 pour 400 g). + final double? quantite; + + /// Unité de la quantité : voir [Unites]. + final String? unite; + + /// Nombre de contenants pour un pack (ex : 6 pour un pack de 6 bières). + /// Null ou 1 = produit à l'unité (pas un pack). + final int? nbContenants; + + /// Horodatage de création (ms) — sert au tri par ordre d'ajout. + final int creeLe; + + /// Quantité en stock (inventaire). + final int stock; + + const Produit({ + required this.id, + this.codeBarres, + required this.nom, + this.imageUrl, + required this.prix, + this.prixAchat = 0, + this.quantite, + this.unite, + this.nbContenants, + this.creeLe = 0, + this.stock = 0, + }); + + bool get estPack => (nbContenants ?? 1) > 1; + + /// Gain en euros (vente − achat). Pertinent seulement si un prix d'achat est saisi. + double get gain => prix - prixAchat; + + /// Coefficient multiplicateur (prix de vente ÷ prix d'achat), ex : 1,5. + /// Null si le prix d'achat n'est pas renseigné. Sert au tri. + double? get coefficient => prixAchat > 0 ? prix / prixAchat : null; + + /// Marge affichée : le coefficient (1,5) suivi d'un « % », ex : « 1,5 % », « 2 % ». + /// Vide si le prix d'achat n'est pas renseigné. + String get margeLibelle { + final c = coefficient; + if (c == null) return ''; + var s = c.toStringAsFixed(2).replaceAll('.', ','); + if (s.contains(',')) { + s = s.replaceAll(RegExp(r'0+$'), '').replaceAll(RegExp(r',$'), ''); + } + return '$s %'; + } + + Produit copyWith({ + String? id, + String? codeBarres, + String? nom, + String? imageUrl, + double? prix, + double? prixAchat, + double? quantite, + String? unite, + int? nbContenants, + int? creeLe, + int? stock, + }) { + return Produit( + id: id ?? this.id, + codeBarres: codeBarres ?? this.codeBarres, + nom: nom ?? this.nom, + imageUrl: imageUrl ?? this.imageUrl, + prix: prix ?? this.prix, + prixAchat: prixAchat ?? this.prixAchat, + quantite: quantite ?? this.quantite, + unite: unite ?? this.unite, + nbContenants: nbContenants ?? this.nbContenants, + creeLe: creeLe ?? this.creeLe, + stock: stock ?? this.stock, + ); + } + + /// Prix à l'unité de mesure (€/kg ou €/L) — obligation légale pour les + /// produits vendus au poids/volume. Null pour les produits à la pièce. + ({double valeur, String suffixe})? get prixMesure { + final q = quantite; + if (q == null || q <= 0) return null; + // Pour un pack, on calcule sur le volume/poids TOTAL (contenance × nombre). + final total = q * (nbContenants ?? 1); + return switch (unite) { + Unites.g => (valeur: prix / (total / 1000), suffixe: '/kg'), + Unites.kg => (valeur: prix / total, suffixe: '/kg'), + Unites.ml => (valeur: prix / (total / 1000), suffixe: '/L'), + Unites.cl => (valeur: prix / (total / 100), suffixe: '/L'), + Unites.l => (valeur: prix / total, suffixe: '/L'), + _ => null, + }; + } + + /// Libellé compact de la quantité, ex : « 330ml », « 1kg », « 75cl », + /// ou « 6x33cl » pour un pack. Vide si absent. + String get quantiteLibelle { + final q = quantite; + if (q == null || q <= 0 || !Unites.estValide(unite)) return ''; + final n = q == q.roundToDouble() + ? q.toInt().toString() + : q.toString().replaceAll('.', ','); + final base = '$n${Unites.libelle(unite)}'; + return estPack ? '${nbContenants}X$base' : base; + } + + /// Titre affiché (liste + étiquette) : la quantité est intégrée devant le nom, + /// ex : « 1kg Farine », « 75cl Coca-Cola ». Sinon juste le nom. + String get titre { + final ql = quantiteLibelle; + return ql.isEmpty ? nom : '$ql $nom'; + } + + factory Produit.fromMap(Map map) { + return Produit( + id: map['id'].toString(), + codeBarres: map['code_barres'] as String?, + nom: (map['nom'] as String?) ?? '', + imageUrl: map['image_url'] as String?, + prix: (map['prix'] as num?)?.toDouble() ?? 0, + prixAchat: (map['prix_achat'] as num?)?.toDouble() ?? 0, + quantite: (map['quantite'] as num?)?.toDouble(), + unite: map['unite'] as String?, + nbContenants: (map['nb_contenants'] as num?)?.toInt(), + creeLe: (map['cree_le'] as num?)?.toInt() ?? 0, + stock: (map['stock'] as num?)?.toInt() ?? 0, + ); + } + + /// Map pour insertion/mise à jour dans la base (sans l'id, généré par SQLite). + Map toInsertMap() { + return { + 'code_barres': codeBarres, + 'nom': nom, + 'image_url': imageUrl, + 'prix': prix, + 'prix_achat': prixAchat, + 'quantite': quantite, + 'unite': unite, + 'nb_contenants': nbContenants, + 'stock': stock, + }; + } +} diff --git a/lib/screens/etiquettes_screen.dart b/lib/screens/etiquettes_screen.dart new file mode 100644 index 0000000..6810d39 --- /dev/null +++ b/lib/screens/etiquettes_screen.dart @@ -0,0 +1,276 @@ +import 'package:flutter/material.dart'; +import 'package:printing/printing.dart'; + +import '../models/produit.dart'; +import '../services/etiquette_pdf.dart'; +import '../services/produit_repository.dart'; +import '../theme.dart'; +import '../utils/format.dart'; +import '../utils/tri.dart'; +import '../widgets/produit_image.dart'; + +/// Onglet 3 : sélection de produits puis génération/impression des étiquettes. +class EtiquettesScreen extends StatefulWidget { + const EtiquettesScreen({super.key}); + + @override + State createState() => _EtiquettesScreenState(); +} + +class _EtiquettesScreenState extends State { + final _repo = ProduitRepository.instance; + final Set _selection = {}; + Tri _tri = Tri.recent; + + bool _tousSelectionnes(List produits) => + produits.isNotEmpty && _selection.length == produits.length; + + void _basculerTout(List produits) { + setState(() { + if (_tousSelectionnes(produits)) { + _selection.clear(); + } else { + _selection + ..clear() + ..addAll(produits.map((p) => p.id)); + } + }); + } + + Future _imprimer(List produits) async { + final choisis = + produits.where((p) => _selection.contains(p.id)).toList(); + if (choisis.isEmpty) return; + + await Printing.layoutPdf( + name: 'etiquettes_prix', + onLayout: (format) => EtiquettePdf.construire(choisis), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: ListenableBuilder( + listenable: _repo, + builder: (context, _) { + final produits = trierProduits(_repo.produits, _tri); + // Nettoie la sélection des produits supprimés. + _selection.retainWhere((id) => produits.any((p) => p.id == id)); + + return Column( + children: [ + _entete(produits), + Expanded( + child: produits.isEmpty + ? _vide() + : ListView.separated( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 120), + itemCount: produits.length, + separatorBuilder: (_, _) => + const SizedBox(height: 8), + itemBuilder: (_, i) { + final p = produits[i]; + final sel = _selection.contains(p.id); + return _LigneSelection( + produit: p, + selectionne: sel, + onTap: () => setState(() { + sel + ? _selection.remove(p.id) + : _selection.add(p.id); + }), + ); + }, + ), + ), + ], + ); + }, + ), + ), + floatingActionButton: ListenableBuilder( + listenable: _repo, + builder: (context, _) { + final n = _selection.length; + return FloatingActionButton.extended( + onPressed: n == 0 + ? null + : () => _imprimer(trierProduits(_repo.produits, _tri)), + backgroundColor: n == 0 ? Colors.grey : AppTheme.accent, + foregroundColor: Colors.white, + icon: const Icon(Icons.print), + label: Text(n == 0 ? 'Imprimer' : 'Imprimer ($n)'), + ); + }, + ), + ); + } + + Widget _entete(List produits) { + return Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Étiquettes', + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.w800, + letterSpacing: -1)), + const SizedBox(height: 4), + const Text('Sélectionne les produits à imprimer', + style: TextStyle(color: AppTheme.grisTexte, fontSize: 14)), + const SizedBox(height: 12), + Row( + children: [ + Text('${_selection.length} sélectionné(s)', + style: const TextStyle(fontWeight: FontWeight.w600)), + const Spacer(), + TextButton.icon( + onPressed: + produits.isEmpty ? null : () => _basculerTout(produits), + icon: Icon(_tousSelectionnes(produits) + ? Icons.remove_done + : Icons.done_all), + label: Text(_tousSelectionnes(produits) + ? 'Tout désélectionner' + : 'Tout sélectionner'), + style: TextButton.styleFrom(foregroundColor: AppTheme.accent), + ), + ], + ), + const SizedBox(height: 8), + SizedBox( + height: 36, + child: ListView( + scrollDirection: Axis.horizontal, + children: [for (final t in Tri.values) _puceTri(t)], + ), + ), + ], + ), + ); + } + + Widget _puceTri(Tri t) { + final sel = _tri == t; + return Padding( + padding: const EdgeInsets.only(right: 8), + child: ChoiceChip( + label: Text(t.libelle), + selected: sel, + onSelected: (_) => setState(() => _tri = t), + showCheckmark: false, + labelStyle: TextStyle( + fontWeight: FontWeight.w600, + color: sel ? Colors.white : AppTheme.grisTexte, + ), + selectedColor: AppTheme.accent, + backgroundColor: Theme.of(context).colorScheme.surface, + side: BorderSide( + color: sel + ? AppTheme.accent + : Theme.of(context).colorScheme.outlineVariant, + ), + ), + ); + } + + Widget _vide() { + return const Center( + child: Padding( + padding: EdgeInsets.all(32), + child: Text( + 'Ajoute d’abord des produits pour pouvoir imprimer leurs étiquettes.', + textAlign: TextAlign.center, + style: TextStyle(color: AppTheme.grisTexte, fontSize: 15), + ), + ), + ); + } +} + +class _LigneSelection extends StatelessWidget { + final Produit produit; + final bool selectionne; + final VoidCallback onTap; + + const _LigneSelection({ + required this.produit, + required this.selectionne, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return Material( + color: selectionne + ? AppTheme.accent.withValues(alpha: 0.08) + : scheme.surface, + borderRadius: BorderRadius.circular(16), + child: InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(16), + child: Container( + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + color: selectionne + ? AppTheme.accent + : scheme.outlineVariant.withValues(alpha: 0.5), + width: selectionne ? 1.6 : 1, + ), + ), + child: Row( + children: [ + _Case(coche: selectionne), + const SizedBox(width: 12), + ProduitImage(url: produit.imageUrl, taille: 44, radius: 10), + const SizedBox(width: 12), + Expanded( + child: Text(produit.titre, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontSize: 15, fontWeight: FontWeight.w600)), + ), + const SizedBox(width: 8), + Text(euro(produit.prix), + style: const TextStyle( + fontSize: 16, fontWeight: FontWeight.w800)), + ], + ), + ), + ), + ); + } +} + +class _Case extends StatelessWidget { + final bool coche; + const _Case({required this.coche}); + + @override + Widget build(BuildContext context) { + return AnimatedContainer( + duration: const Duration(milliseconds: 120), + width: 26, + height: 26, + decoration: BoxDecoration( + color: coche ? AppTheme.accent : Colors.transparent, + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: coche ? AppTheme.accent : AppTheme.grisTexte, + width: 2, + ), + ), + child: coche + ? const Icon(Icons.check, size: 18, color: Colors.white) + : null, + ); + } +} diff --git a/lib/screens/home_shell.dart b/lib/screens/home_shell.dart new file mode 100644 index 0000000..78c58ec --- /dev/null +++ b/lib/screens/home_shell.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; + +import 'etiquettes_screen.dart'; +import 'produits_screen.dart'; +import 'scan_screen.dart'; + +/// Coquille principale : contient les 3 onglets et la barre de navigation. +class HomeShell extends StatefulWidget { + const HomeShell({super.key}); + + @override + State createState() => _HomeShellState(); +} + +class _HomeShellState extends State { + int _index = 0; + + @override + Widget build(BuildContext context) { + final pages = [ + ProduitsScreen(onAllerScanner: () => setState(() => _index = 1)), + ScanScreen(active: _index == 1), + const EtiquettesScreen(), + ]; + return Scaffold( + body: IndexedStack(index: _index, children: pages), + bottomNavigationBar: NavigationBar( + selectedIndex: _index, + height: 68, + labelBehavior: NavigationDestinationLabelBehavior.alwaysShow, + onDestinationSelected: (i) => setState(() => _index = i), + destinations: const [ + NavigationDestination( + icon: Icon(Icons.inventory_2_outlined), + selectedIcon: Icon(Icons.inventory_2), + label: 'Produits', + ), + NavigationDestination( + icon: Icon(Icons.qr_code_scanner_outlined), + selectedIcon: Icon(Icons.qr_code_scanner), + label: 'Scanner', + ), + NavigationDestination( + icon: Icon(Icons.print_outlined), + selectedIcon: Icon(Icons.print), + label: 'Étiquettes', + ), + ], + ), + ); + } +} diff --git a/lib/screens/produit_edit_screen.dart b/lib/screens/produit_edit_screen.dart new file mode 100644 index 0000000..ccb6855 --- /dev/null +++ b/lib/screens/produit_edit_screen.dart @@ -0,0 +1,703 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:image_picker/image_picker.dart'; + +import '../models/produit.dart'; +import '../services/photo_service.dart'; +import '../services/produit_repository.dart'; +import '../services/reglages.dart'; +import '../theme.dart'; +import '../widgets/produit_image.dart'; + +/// Écran d'ajout / modification d'un produit. +/// +/// - [produit] fourni → mode modification. +/// - sinon → mode création (les champs *Initial servent au scan). +class ProduitEditScreen extends StatefulWidget { + final Produit? produit; + final String? codeBarresInitial; + final String? nomInitial; + final String? imageUrlInitial; + final double? quantiteInitial; + final String? uniteInitial; + + const ProduitEditScreen({ + super.key, + this.produit, + this.codeBarresInitial, + this.nomInitial, + this.imageUrlInitial, + this.quantiteInitial, + this.uniteInitial, + }); + + @override + State createState() => _ProduitEditScreenState(); +} + +class _ProduitEditScreenState extends State { + final _repo = ProduitRepository.instance; + final _formKey = GlobalKey(); + + late final TextEditingController _nom; + late final TextEditingController _prix; + late final TextEditingController _prixAchat; + late final TextEditingController _quantite; + late final TextEditingController _nbContenants; + late final TextEditingController _stock; + + String? _codeBarres; + String? _imageUrl; + late String _unite; + bool _estPack = false; + bool _enregistre = false; + + bool get _modification => widget.produit != null; + + /// Produit scanné mais absent d'OpenFoodFacts (nom à saisir à la main). + bool get _scanNonTrouve => + widget.produit == null && + widget.codeBarresInitial != null && + (widget.nomInitial == null || widget.nomInitial!.trim().isEmpty); + + @override + void initState() { + super.initState(); + final p = widget.produit; + _nom = TextEditingController(text: p?.nom ?? widget.nomInitial ?? ''); + _prix = TextEditingController(text: p != null ? _fmt(p.prix) : ''); + _prixAchat = TextEditingController( + text: (p != null && p.prixAchat > 0) ? _fmt(p.prixAchat) : ''); + final q = p?.quantite ?? widget.quantiteInitial; + _quantite = TextEditingController( + text: (q != null && q > 0) ? _fmtQuantite(q) : ''); + _estPack = p?.estPack ?? false; + _nbContenants = TextEditingController( + text: (p != null && p.estPack) ? p.nbContenants.toString() : ''); + _stock = TextEditingController(text: (p?.stock ?? 0).toString()); + // Unité : celle du produit si valide, sinon celle du scan, sinon 'g' par défaut. + _unite = Unites.estValide(p?.unite) + ? p!.unite! + : (Unites.estValide(widget.uniteInitial) ? widget.uniteInitial! : Unites.g); + _codeBarres = p?.codeBarres ?? widget.codeBarresInitial; + _imageUrl = p?.imageUrl ?? widget.imageUrlInitial; + + // Nouveau produit sans unité connue → on re-propose la dernière unité utilisée. + if (p == null && !Unites.estValide(widget.uniteInitial)) { + Reglages.instance.derniereUnite().then((u) { + if (mounted && _quantite.text.isEmpty && Unites.estValide(u)) { + setState(() => _unite = u); + } + }); + } + } + + @override + void dispose() { + _nom.dispose(); + _prix.dispose(); + _prixAchat.dispose(); + _quantite.dispose(); + _nbContenants.dispose(); + _stock.dispose(); + super.dispose(); + } + + String _fmtQuantite(double v) => + v == v.roundToDouble() ? v.toInt().toString() : v.toString(); + + String _fmt(double v) => + v.toStringAsFixed(2).replaceAll('.', ','); + + double _parse(String s) => + double.tryParse(s.trim().replaceAll(',', '.')) ?? 0; + + Future _enregistrer() async { + if (!_formKey.currentState!.validate()) return; + setState(() => _enregistre = true); + + final base = widget.produit; + final q = _parse(_quantite.text); + final nb = _estPack ? (int.tryParse(_nbContenants.text.trim()) ?? 0) : 1; + final produit = Produit( + id: base?.id ?? 'temp', + codeBarres: _codeBarres, + nom: _nom.text.trim(), + imageUrl: _imageUrl, + prix: _parse(_prix.text), + prixAchat: _parse(_prixAchat.text), + quantite: q > 0 ? q : null, + unite: _unite, + nbContenants: (_estPack && nb > 1) ? nb : null, + creeLe: base?.creeLe ?? 0, + stock: int.tryParse(_stock.text.trim()) ?? 0, + ); + + try { + if (_modification) { + await _repo.modifier(produit); + } else { + await _repo.ajouter(produit); + } + // Mémorise l'unité pour accélérer la saisie du produit suivant. + await Reglages.instance.memoriserUnite(produit.unite ?? Unites.piece); + if (mounted) Navigator.of(context).pop(true); + } catch (e) { + setState(() => _enregistre = false); + if (mounted) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Erreur : $e')), + ); + } + } + } + + Future _changerPhoto() async { + FocusScope.of(context).unfocus(); + final action = await showModalBottomSheet( + context: context, + showDragHandle: true, + builder: (ctx) => SafeArea( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ListTile( + leading: const Icon(Icons.photo_camera, color: AppTheme.accent), + title: const Text('Prendre une photo'), + onTap: () => Navigator.pop(ctx, 'camera'), + ), + ListTile( + leading: const Icon(Icons.photo_library, color: AppTheme.accent), + title: const Text('Choisir dans la galerie'), + onTap: () => Navigator.pop(ctx, 'gallery'), + ), + if (_imageUrl != null) + ListTile( + leading: const Icon(Icons.delete_outline, color: Colors.red), + title: const Text('Supprimer la photo'), + onTap: () => Navigator.pop(ctx, 'remove'), + ), + ], + ), + ), + ); + if (action == null) return; + if (action == 'remove') { + setState(() => _imageUrl = null); + return; + } + final source = + action == 'camera' ? ImageSource.camera : ImageSource.gallery; + try { + final chemin = await PhotoService.choisir(source); + if (chemin != null && mounted) setState(() => _imageUrl = chemin); + } catch (e) { + if (mounted) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Photo impossible : $e')), + ); + } + } + } + + Future _supprimer() async { + final ok = await showDialog( + context: context, + builder: (_) => AlertDialog( + title: const Text('Supprimer ce produit ?'), + content: Text('« ${widget.produit!.nom} » sera retiré de la liste.'), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context, false), + child: const Text('Annuler')), + FilledButton( + style: FilledButton.styleFrom(backgroundColor: Colors.red), + onPressed: () => Navigator.pop(context, true), + child: const Text('Supprimer'), + ), + ], + ), + ); + if (ok == true) { + await _repo.supprimer(widget.produit!.id); + if (mounted) Navigator.of(context).pop(true); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(_modification ? 'Modifier' : 'Nouveau produit'), + actions: [ + if (_modification) + IconButton( + icon: const Icon(Icons.delete_outline), + color: Colors.red, + onPressed: _supprimer, + ), + ], + ), + body: SafeArea( + child: Form( + key: _formKey, + child: ListView( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 24), + children: [ + Center( + child: GestureDetector( + onTap: _changerPhoto, + child: Stack( + clipBehavior: Clip.none, + children: [ + ProduitImage(url: _imageUrl, taille: 120, radius: 20), + Positioned( + right: -6, + bottom: -6, + child: Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: AppTheme.accent, + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + ), + child: const Icon(Icons.photo_camera, + color: Colors.white, size: 18), + ), + ), + ], + ), + ), + ), + const SizedBox(height: 8), + Center( + child: Text( + _imageUrl == null ? 'Ajouter une photo' : 'Changer la photo', + style: const TextStyle( + color: AppTheme.accent, + fontWeight: FontWeight.w600, + fontSize: 13), + ), + ), + if (_codeBarres != null) ...[ + const SizedBox(height: 12), + Center( + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.qr_code, size: 16, + color: AppTheme.grisTexte), + const SizedBox(width: 6), + Text(_codeBarres!, + style: const TextStyle( + color: AppTheme.grisTexte, + fontWeight: FontWeight.w600)), + ], + ), + ), + ], + const SizedBox(height: 20), + if (_scanNonTrouve) ...[ + _banniereNonTrouve(), + const SizedBox(height: 16), + ], + _label('Nom du produit'), + TextFormField( + controller: _nom, + autofocus: !_modification && _nom.text.isEmpty, + textCapitalization: TextCapitalization.sentences, + onChanged: (_) => setState(() {}), + decoration: const InputDecoration(hintText: 'Ex : Nutella 400g'), + validator: (v) => + (v == null || v.trim().isEmpty) ? 'Nom obligatoire' : null, + ), + const SizedBox(height: 20), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _label('Prix d\'achat'), + _champPrix(_prixAchat, obligatoire: false), + ], + ), + ), + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _label('Prix de vente'), + _champPrix(_prix, + autofocus: !_modification && _nom.text.isNotEmpty), + ], + ), + ), + ], + ), + _apercuMarge(), + const SizedBox(height: 20), + _label('Conditionnement'), + _toggleUnitePack(), + const SizedBox(height: 20), + if (!_estPack) + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [_label('Quantité'), _champQuantite()], + ), + ), + const SizedBox(width: 14), + Expanded( + flex: 2, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [_label('Unité'), _selecteurUnite()], + ), + ), + ], + ) + else + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [_label('Nombre'), _champNombre()], + ), + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [_label('Contenance'), _champQuantite()], + ), + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [_label('Unité'), _selecteurUnite()], + ), + ), + ], + ), + _apercuPrixMesure(), + const SizedBox(height: 24), + _label('Inventaire (stock)'), + _sectionStock(), + const SizedBox(height: 24), + FilledButton.icon( + onPressed: _enregistre ? null : _enregistrer, + icon: _enregistre + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator( + strokeWidth: 2, color: Colors.white)) + : const Icon(Icons.check), + label: Text(_modification ? 'Enregistrer' : 'Ajouter à la liste'), + ), + ], + ), + ), + ), + ); + } + + Widget _label(String t) => Padding( + padding: const EdgeInsets.only(bottom: 8, left: 4), + child: Text(t, + style: const TextStyle( + fontWeight: FontWeight.w600, fontSize: 14)), + ); + + Widget _banniereNonTrouve() { + return Container( + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: AppTheme.accent.withValues(alpha: 0.08), + borderRadius: BorderRadius.circular(12), + border: Border.all(color: AppTheme.accent.withValues(alpha: 0.3)), + ), + child: const Row( + children: [ + Icon(Icons.info_outline, color: AppTheme.accent, size: 20), + SizedBox(width: 10), + Expanded( + child: Text( + 'Produit non trouvé en ligne. Saisis-le : il sera mémorisé et ' + 'reconnu automatiquement aux prochains scans.', + style: TextStyle(fontSize: 13, color: AppTheme.noir), + ), + ), + ], + ), + ); + } + + Widget _champPrix(TextEditingController c, + {bool autofocus = false, bool obligatoire = true}) { + return TextFormField( + controller: c, + autofocus: autofocus, + keyboardType: const TextInputType.numberWithOptions(decimal: true), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9.,]')), + ], + onChanged: (_) => setState(() {}), + decoration: const InputDecoration(hintText: '0,00', suffixText: '€'), + validator: (v) { + if (v == null || v.trim().isEmpty) return obligatoire ? 'Requis' : null; + if (_parse(v) <= 0) return 'Invalide'; + return null; + }, + ); + } + + Widget _apercuMarge() { + final achat = _parse(_prixAchat.text); + final vente = _parse(_prix.text); + if (achat <= 0 || vente <= 0) return const SizedBox.shrink(); + + final gain = vente - achat; + final coef = vente / achat; + final positif = coef >= 1; + final couleur = positif ? const Color(0xFF1B873F) : Colors.red; + final signe = gain >= 0 ? '+' : ''; + final gainTxt = '$signe${gain.toStringAsFixed(2).replaceAll('.', ',')} €'; + final apercu = Produit(id: '', nom: '', prix: vente, prixAchat: achat); + + return Padding( + padding: const EdgeInsets.only(top: 10, left: 4), + child: Row( + children: [ + Icon(positif ? Icons.trending_up : Icons.trending_down, + color: couleur, size: 18), + const SizedBox(width: 8), + Text('Marge ${apercu.margeLibelle} ($gainTxt)', + style: TextStyle(color: couleur, fontWeight: FontWeight.w700)), + ], + ), + ); + } + + Widget _champQuantite() { + return TextFormField( + controller: _quantite, + keyboardType: const TextInputType.numberWithOptions(decimal: true), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9.,]')), + ], + onChanged: (_) => setState(() {}), + decoration: const InputDecoration(hintText: '0'), + validator: (v) { + if (v == null || v.trim().isEmpty) return 'Requis'; + if (_parse(v) <= 0) return 'Invalide'; + return null; + }, + ); + } + + Widget _selecteurUnite() { + return DropdownButtonFormField( + initialValue: _unite, + isExpanded: true, + items: [ + for (final u in Unites.tout) + DropdownMenuItem(value: u, child: Text(Unites.libelle(u))), + ], + onChanged: (v) => setState(() { + final nouvelle = v ?? Unites.g; + _convertirQuantite(_unite, nouvelle); + _unite = nouvelle; + }), + ); + } + + /// Convertit la quantité saisie quand on change d'unité dans la même + /// dimension (ex : 1500 ml → L = 1,5 ; 1500 g → kg = 1,5). + /// Changement de dimension (poids ↔ volume) : on garde la valeur telle quelle. + void _convertirQuantite(String from, String to) { + if (from == to) return; + final q = _parse(_quantite.text); + if (q <= 0) return; + + const poids = {Unites.g: 1.0, Unites.kg: 1000.0}; // base : grammes + const volume = {Unites.ml: 1.0, Unites.cl: 10.0, Unites.l: 1000.0}; // base : ml + + double? conv; + if (poids.containsKey(from) && poids.containsKey(to)) { + conv = q * poids[from]! / poids[to]!; + } else if (volume.containsKey(from) && volume.containsKey(to)) { + conv = q * volume[from]! / volume[to]!; + } + if (conv != null) { + conv = (conv * 1000).round() / 1000; // évite le bruit de virgule flottante + _quantite.text = _fmtQuantite(conv); + } + } + + Widget _toggleUnitePack() { + return SizedBox( + width: double.infinity, + child: SegmentedButton( + segments: const [ + ButtonSegment( + value: false, + label: Text('Unité'), + icon: Icon(Icons.water_drop_outlined)), + ButtonSegment( + value: true, + label: Text('Pack'), + icon: Icon(Icons.inventory_2_outlined)), + ], + selected: {_estPack}, + showSelectedIcon: false, + onSelectionChanged: (s) => setState(() { + _estPack = s.first; + // En passant en Pack, on pré-remplit le nombre de contenants à 6 + // (valeur courante, modifiable) pour que l'étiquette affiche direct « 6X… ». + if (_estPack && _nbContenants.text.trim().isEmpty) { + _nbContenants.text = '6'; + } + }), + ), + ); + } + + Widget _champNombre() { + return TextFormField( + controller: _nbContenants, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + onChanged: (_) => setState(() {}), + decoration: const InputDecoration(hintText: '6', suffixText: '×'), + validator: (v) { + if (!_estPack) return null; + if ((int.tryParse((v ?? '').trim()) ?? 0) < 2) return '≥ 2'; + return null; + }, + ); + } + + void _ajusterStock(int delta) { + final cur = int.tryParse(_stock.text.trim()) ?? 0; + final n = (cur + delta).clamp(0, 999999); + _stock.text = n.toString(); + setState(() {}); + } + + Widget _sectionStock() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + _btnStock(Icons.remove, () => _ajusterStock(-1)), + const SizedBox(width: 12), + Expanded( + child: TextFormField( + controller: _stock, + textAlign: TextAlign.center, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + onChanged: (_) => setState(() {}), + style: const TextStyle(fontSize: 22, fontWeight: FontWeight.w800), + decoration: const InputDecoration(suffixText: 'en stock'), + ), + ), + const SizedBox(width: 12), + _btnStock(Icons.add, () => _ajusterStock(1)), + ], + ), + const SizedBox(height: 12), + Wrap( + spacing: 8, + runSpacing: 8, + alignment: WrapAlignment.center, + children: [for (final d in [1, 5, 10, 50]) _chipStock(d)], + ), + ], + ); + } + + Widget _btnStock(IconData icon, VoidCallback onTap) { + return Material( + color: AppTheme.accent.withValues(alpha: 0.12), + shape: const CircleBorder(), + child: InkWell( + customBorder: const CircleBorder(), + onTap: onTap, + child: Padding( + padding: const EdgeInsets.all(12), + child: Icon(icon, color: AppTheme.accent, size: 22), + ), + ), + ); + } + + Widget _chipStock(int d) { + return ActionChip( + label: Text('+$d', + style: const TextStyle( + fontWeight: FontWeight.w700, color: AppTheme.accent)), + onPressed: () => _ajusterStock(d), + backgroundColor: AppTheme.accent.withValues(alpha: 0.08), + side: BorderSide(color: AppTheme.accent.withValues(alpha: 0.3)), + ); + } + + Widget _apercuPrixMesure() { + final q = _parse(_quantite.text); + final nb = _estPack ? (int.tryParse(_nbContenants.text.trim()) ?? 0) : 1; + final apercu = Produit( + id: '', + nom: _nom.text.trim(), + prix: _parse(_prix.text), + quantite: q > 0 ? q : null, + unite: _unite, + nbContenants: (_estPack && nb > 1) ? nb : null, + ); + final mesure = apercu.prixMesure; + if (mesure == null || apercu.nom.isEmpty) return const SizedBox.shrink(); + + final txt = + '${mesure.valeur.toStringAsFixed(2).replaceAll('.', ',')} €${mesure.suffixe}'; + return Container( + margin: const EdgeInsets.only(top: 14), + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: AppTheme.accent.withValues(alpha: 0.08), + borderRadius: BorderRadius.circular(12), + ), + child: Row( + children: [ + const Icon(Icons.sell_outlined, size: 18, color: AppTheme.accent), + const SizedBox(width: 8), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Sur l’étiquette : ${apercu.titre}', + style: const TextStyle( + color: AppTheme.noir, fontWeight: FontWeight.w700)), + const SizedBox(height: 2), + Text('soit $txt', + style: const TextStyle( + color: AppTheme.accent, fontWeight: FontWeight.w600)), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/screens/produits_screen.dart b/lib/screens/produits_screen.dart new file mode 100644 index 0000000..7273368 --- /dev/null +++ b/lib/screens/produits_screen.dart @@ -0,0 +1,294 @@ +import 'package:flutter/material.dart'; + +import '../models/produit.dart'; +import '../services/produit_repository.dart'; +import '../theme.dart'; +import '../utils/format.dart'; +import '../utils/tri.dart'; +import '../widgets/produit_image.dart'; +import 'produit_edit_screen.dart'; + +/// Onglet 1 : liste de tous les produits avec recherche, tri et édition. +class ProduitsScreen extends StatefulWidget { + /// Appelé par le bouton « Ajouter » pour basculer sur l'onglet Scanner. + final VoidCallback onAllerScanner; + + const ProduitsScreen({super.key, required this.onAllerScanner}); + + @override + State createState() => _ProduitsScreenState(); +} + +class _ProduitsScreenState extends State { + final _repo = ProduitRepository.instance; + String _recherche = ''; + Tri _tri = Tri.recent; + + List _filtrerEtTrier(List tous) { + final q = _recherche.trim().toLowerCase(); + final list = q.isEmpty + ? tous + : tous + .where((p) => + p.nom.toLowerCase().contains(q) || + (p.codeBarres?.contains(q) ?? false)) + .toList(); + return trierProduits(list, _tri); + } + + Future _ouvrir(Produit p) async { + await Navigator.of(context).push( + MaterialPageRoute(builder: (_) => ProduitEditScreen(produit: p)), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + floatingActionButton: FloatingActionButton.extended( + onPressed: widget.onAllerScanner, + backgroundColor: AppTheme.accent, + foregroundColor: Colors.white, + icon: const Icon(Icons.add), + label: const Text('Ajouter'), + ), + body: SafeArea( + child: ListenableBuilder( + listenable: _repo, + builder: (context, _) { + final produits = _filtrerEtTrier(_repo.produits); + return CustomScrollView( + slivers: [ + SliverToBoxAdapter(child: _entete(_repo.produits.length)), + if (_repo.enCours && _repo.produits.isEmpty) + const SliverFillRemaining( + child: Center(child: CircularProgressIndicator()), + ) + else if (produits.isEmpty) + SliverFillRemaining( + hasScrollBody: false, + child: _vide(), + ) + else + SliverPadding( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 96), + sliver: SliverList.separated( + itemCount: produits.length, + separatorBuilder: (_, _) => const SizedBox(height: 10), + itemBuilder: (_, i) => _ProduitCard( + produit: produits[i], + onTap: () => _ouvrir(produits[i]), + ), + ), + ), + ], + ); + }, + ), + ), + ); + } + + Widget _entete(int total) { + return Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, + children: [ + const Text('Produits', + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.w800, + letterSpacing: -1)), + const SizedBox(width: 10), + Text('$total', + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: AppTheme.grisTexte)), + const Spacer(), + ], + ), + const SizedBox(height: 14), + TextField( + onChanged: (v) => setState(() => _recherche = v), + decoration: const InputDecoration( + hintText: 'Rechercher un produit…', + prefixIcon: Icon(Icons.search), + ), + ), + const SizedBox(height: 12), + SizedBox( + height: 36, + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + for (final t in Tri.values) _puceTri(t), + ], + ), + ), + ], + ), + ); + } + + Widget _puceTri(Tri t) { + final sel = _tri == t; + return Padding( + padding: const EdgeInsets.only(right: 8), + child: ChoiceChip( + label: Text(t.libelle), + selected: sel, + onSelected: (_) => setState(() => _tri = t), + showCheckmark: false, + labelStyle: TextStyle( + fontWeight: FontWeight.w600, + color: sel ? Colors.white : AppTheme.grisTexte, + ), + selectedColor: AppTheme.accent, + backgroundColor: Theme.of(context).colorScheme.surface, + side: BorderSide( + color: sel + ? AppTheme.accent + : Theme.of(context).colorScheme.outlineVariant, + ), + ), + ); + } + + Widget _vide() { + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.inventory_2_outlined, + size: 64, color: AppTheme.grisTexte), + const SizedBox(height: 16), + Text( + _recherche.isEmpty + ? 'Aucun produit pour l’instant.\nScanne un code-barres pour commencer.' + : 'Aucun résultat pour « $_recherche ».', + textAlign: TextAlign.center, + style: const TextStyle(color: AppTheme.grisTexte, fontSize: 15), + ), + ], + ); + } +} + +class _ProduitCard extends StatelessWidget { + final Produit produit; + final VoidCallback onTap; + + const _ProduitCard({required this.produit, required this.onTap}); + + @override + Widget build(BuildContext context) { + return Card( + child: InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(16), + child: Padding( + padding: const EdgeInsets.all(12), + child: Row( + children: [ + ProduitImage(url: produit.imageUrl), + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + produit.titre, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontSize: 16, fontWeight: FontWeight.w700), + ), + const SizedBox(height: 5), + Row( + children: [ + _PastilleStock(stock: produit.stock), + if (produit.codeBarres != null) ...[ + const SizedBox(width: 8), + Flexible( + child: Text(produit.codeBarres!, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontSize: 12.5, color: AppTheme.grisTexte)), + ), + ], + ], + ), + ], + ), + ), + const SizedBox(width: 10), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text(euro(produit.prix), + style: const TextStyle( + fontSize: 18, fontWeight: FontWeight.w800)), + if (produit.prixMesure != null) + Text( + '${produit.prixMesure!.valeur.toStringAsFixed(2).replaceAll('.', ',')} €${produit.prixMesure!.suffixe}', + style: const TextStyle( + fontSize: 11.5, color: AppTheme.grisTexte), + ), + if (produit.coefficient != null) + Text( + produit.margeLibelle, + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w800, + color: produit.coefficient! >= 1 + ? const Color(0xFF1B873F) + : Colors.red, + ), + ), + ], + ), + const Icon(Icons.chevron_right, color: AppTheme.grisTexte), + ], + ), + ), + ), + ); + } +} + +/// Pastille indiquant le stock d'un produit (rouge si épuisé). +class _PastilleStock extends StatelessWidget { + final int stock; + const _PastilleStock({required this.stock}); + + @override + Widget build(BuildContext context) { + final epuise = stock <= 0; + final couleur = epuise ? Colors.red : AppTheme.accent; + return Container( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3), + decoration: BoxDecoration( + color: couleur.withValues(alpha: 0.12), + borderRadius: BorderRadius.circular(20), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.inventory_2_outlined, size: 13, color: couleur), + const SizedBox(width: 4), + Text( + epuise ? 'Rupture' : '$stock en stock', + style: TextStyle( + fontSize: 12, fontWeight: FontWeight.w700, color: couleur), + ), + ], + ), + ); + } +} diff --git a/lib/screens/scan_screen.dart b/lib/screens/scan_screen.dart new file mode 100644 index 0000000..847d280 --- /dev/null +++ b/lib/screens/scan_screen.dart @@ -0,0 +1,254 @@ +import 'package:flutter/material.dart'; +import 'package:mobile_scanner/mobile_scanner.dart'; + +import '../models/produit.dart'; +import '../services/openfoodfacts_service.dart'; +import '../services/produit_repository.dart'; +import '../theme.dart'; +import 'produit_edit_screen.dart'; + +/// Onglet 2 : scan d'un code-barres → recherche OpenFoodFacts → formulaire. +class ScanScreen extends StatefulWidget { + final bool active; + const ScanScreen({super.key, required this.active}); + + @override + State createState() => _ScanScreenState(); +} + +class _ScanScreenState extends State { + final _controller = MobileScannerController( + detectionSpeed: DetectionSpeed.noDuplicates, + formats: const [ + BarcodeFormat.ean13, + BarcodeFormat.ean8, + BarcodeFormat.upcA, + BarcodeFormat.upcE, + BarcodeFormat.code128, + ], + ); + final _off = OpenFoodFactsService(); + final _repo = ProduitRepository.instance; + + bool _traite = false; + + // La caméra est démarrée/arrêtée automatiquement par le widget MobileScanner + // quand il est monté/démonté selon l'onglet actif (autoStart). On ne fait + // AUCUN start()/stop() manuel ici : ça provoquerait un double démarrage. + + @override + void didUpdateWidget(covariant ScanScreen old) { + super.didUpdateWidget(old); + // En revenant sur l'onglet Scanner, on réautorise la détection. + if (widget.active && !old.active) _traite = false; + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + Future _onDetect(BarcodeCapture capture) async { + if (_traite || !widget.active) return; + final code = capture.barcodes.firstOrNull?.rawValue; + if (code == null || code.isEmpty) return; + + // On bloque les détections suivantes pendant le traitement (sans couper la caméra). + setState(() => _traite = true); + + // Déjà connu ? → on ouvre directement la fiche. + final existant = _repo.parCodeBarres(code); + if (existant != null) { + await _ouvrirExistant(existant); + return; + } + + // Sinon on interroge OpenFoodFacts (avec un petit loader). + final info = await _off.chercherParCodeBarres(code); + if (!mounted) return; + + final ajoute = await Navigator.of(context).push( + MaterialPageRoute( + builder: (_) => ProduitEditScreen( + codeBarresInitial: code, + nomInitial: info?.nom, + imageUrlInitial: info?.imageUrl, + quantiteInitial: info?.quantite, + uniteInitial: info?.unite, + ), + ), + ); + + if (mounted) { + setState(() => _traite = false); + if (ajoute == true) await _popupAjoute(); + } + } + + Future _ouvrirExistant(Produit p) async { + await Navigator.of(context).push( + MaterialPageRoute(builder: (_) => ProduitEditScreen(produit: p)), + ); + if (mounted) setState(() => _traite = false); + } + + /// Ajout manuel via le bouton « + » (sans scanner). + Future _ajouterManuel() async { + setState(() => _traite = true); // bloque les détections pendant la saisie + final ajoute = await Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const ProduitEditScreen()), + ); + if (mounted) { + setState(() => _traite = false); + if (ajoute == true) await _popupAjoute(); + } + } + + /// Pop-up de confirmation « Produit ajouté », se ferme tout seul. + Future _popupAjoute() async { + await showDialog( + context: context, + barrierDismissible: true, + builder: (ctx) { + final nav = Navigator.of(ctx); + Future.delayed(const Duration(milliseconds: 1300), () { + if (nav.canPop()) nav.pop(); + }); + return Dialog( + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 28, horizontal: 24), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: Colors.green.withValues(alpha: 0.12), + shape: BoxShape.circle, + ), + child: const Icon(Icons.check_circle, + color: Colors.green, size: 44), + ), + const SizedBox(height: 16), + const Text('Produit ajouté', + style: + TextStyle(fontSize: 18, fontWeight: FontWeight.w700)), + ], + ), + ), + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + // La caméra (et donc la demande d'autorisation) n'est construite que + // lorsque l'onglet Scanner est réellement affiché. + if (!widget.active) { + return const ColoredBox(color: Colors.black); + } + return Scaffold( + backgroundColor: Colors.black, + floatingActionButton: FloatingActionButton.extended( + onPressed: _traite ? null : _ajouterManuel, + backgroundColor: Colors.white, + foregroundColor: AppTheme.noir, + icon: const Icon(Icons.add), + label: const Text('Ajout manuel'), + ), + body: Stack( + fit: StackFit.expand, + children: [ + MobileScanner( + controller: _controller, + onDetect: _onDetect, + errorBuilder: (context, error) => _erreurCamera(error), + ), + _cadre(), + _bandeauHaut(), + if (_traite) + Container( + color: Colors.black54, + child: const Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + CircularProgressIndicator(color: Colors.white), + SizedBox(height: 16), + Text('Recherche du produit…', + style: TextStyle(color: Colors.white, fontSize: 16)), + ], + ), + ), + ), + ], + ), + ); + } + + Widget _bandeauHaut() { + return SafeArea( + child: Align( + alignment: Alignment.topCenter, + child: Container( + margin: const EdgeInsets.only(top: 24), + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12), + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 0.55), + borderRadius: BorderRadius.circular(30), + ), + child: const Text( + 'Vise le code-barres du produit', + style: TextStyle( + color: Colors.white, + fontSize: 15, + fontWeight: FontWeight.w600), + ), + ), + ), + ); + } + + Widget _cadre() { + return Center( + child: Container( + width: 260, + height: 170, + decoration: BoxDecoration( + border: Border.all(color: AppTheme.accent, width: 3), + borderRadius: BorderRadius.circular(20), + ), + ), + ); + } + + Widget _erreurCamera(MobileScannerException error) { + return Center( + child: Padding( + padding: const EdgeInsets.all(32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.no_photography_outlined, + color: Colors.white70, size: 56), + const SizedBox(height: 16), + const Text( + 'Accès à la caméra impossible.\nAutorise la caméra dans les réglages.', + textAlign: TextAlign.center, + style: TextStyle(color: Colors.white70, fontSize: 15), + ), + const SizedBox(height: 20), + FilledButton( + onPressed: () => _controller.start(), + child: const Text('Réessayer'), + ), + ], + ), + ), + ); + } +} diff --git a/lib/services/etiquette_pdf.dart b/lib/services/etiquette_pdf.dart new file mode 100644 index 0000000..019f09a --- /dev/null +++ b/lib/services/etiquette_pdf.dart @@ -0,0 +1,106 @@ +import 'dart:typed_data'; + +import 'package:pdf/pdf.dart'; +import 'package:pdf/widgets.dart' as pw; + +import '../models/produit.dart'; + +/// Génère une planche A4 d'étiquettes de prix (nom, prix TTC, prix HT, code-barres), +/// imprimable sur une imprimante classique (ex : Canon TS4550). +class EtiquettePdf { + /// Construit le document PDF pour les [produits] sélectionnés. + static Future construire(List produits) async { + final doc = pw.Document(); + + doc.addPage( + pw.MultiPage( + pageFormat: PdfPageFormat.a4, + margin: const pw.EdgeInsets.all(12), + build: (context) { + return [ + pw.Wrap( + spacing: 6, + runSpacing: 6, + children: produits.map(_etiquette).toList(), + ), + ]; + }, + ), + ); + + return doc.save(); + } + + static pw.Widget _etiquette(Produit p) { + // 3 colonnes sur A4 (~186mm utiles / 3 ≈ 62mm). + const largeur = 185.0; // points (~65mm) + const hauteur = 110.0; // points (~39mm) + + return pw.Container( + width: largeur, + height: hauteur, + padding: const pw.EdgeInsets.all(8), + decoration: pw.BoxDecoration( + border: pw.Border.all(color: PdfColors.grey400, width: 0.7), + borderRadius: pw.BorderRadius.circular(6), + ), + child: pw.Column( + crossAxisAlignment: pw.CrossAxisAlignment.start, + mainAxisAlignment: pw.MainAxisAlignment.spaceBetween, + children: [ + pw.Text( + p.titre, + maxLines: 2, + overflow: pw.TextOverflow.clip, + style: pw.TextStyle(fontSize: 10, fontWeight: pw.FontWeight.bold), + ), + pw.Container( + width: double.infinity, + alignment: pw.Alignment.center, + child: pw.Column( + mainAxisSize: pw.MainAxisSize.min, + crossAxisAlignment: pw.CrossAxisAlignment.center, + children: [ + pw.Text( + _prix(p.prix), + style: pw.TextStyle( + fontSize: 22, fontWeight: pw.FontWeight.bold), + ), + if (p.prixMesure != null) + pw.Text( + _prixMesure(p), + style: const pw.TextStyle( + fontSize: 9, color: PdfColors.grey700), + ), + ], + ), + ), + _codeBarres(p.codeBarres), + ], + ), + ); + } + + static pw.Widget _codeBarres(String? code) { + if (code == null || code.isEmpty) { + return pw.SizedBox(height: 22); + } + final estEan13 = code.length == 13 && int.tryParse(code) != null; + return pw.BarcodeWidget( + barcode: estEan13 ? pw.Barcode.ean13() : pw.Barcode.code128(), + data: code, + width: 150, + height: 26, + drawText: true, + textStyle: const pw.TextStyle(fontSize: 6), + ); + } + + static String _prix(double v) => '${v.toStringAsFixed(2).replaceAll('.', ',')} EUR'; + + static String _prixMesure(Produit p) { + final m = p.prixMesure!; + final unite = m.suffixe == '/kg' ? 'kg' : 'L'; + return 'soit ${m.valeur.toStringAsFixed(2).replaceAll('.', ',')} EUR / $unite'; + } +} diff --git a/lib/services/local_db.dart b/lib/services/local_db.dart new file mode 100644 index 0000000..f8e91a4 --- /dev/null +++ b/lib/services/local_db.dart @@ -0,0 +1,69 @@ +import 'package:sqflite/sqflite.dart'; + +/// Accès à la base SQLite locale (persistée sur la tablette). +class LocalDb { + LocalDb._(); + static final LocalDb instance = LocalDb._(); + + Database? _db; + + Future get database async { + return _db ??= await _ouvrir(); + } + + Future _ouvrir() async { + final dir = await getDatabasesPath(); + final chemin = '$dir/gestion_prix.db'; + return openDatabase( + chemin, + version: 6, + onCreate: (db, version) async { + await _creerTable(db); + }, + onUpgrade: (db, ancienne, nouvelle) async { + if (ancienne < 2) { + // Ancien schéma (prix HT/TTC) → refonte complète. + await db.execute('DROP TABLE IF EXISTS produits'); + await _creerTable(db); + } + if (ancienne < 3) { + // Ajout quantité + unité pour le prix au kilo/litre. + await db.execute('ALTER TABLE produits ADD COLUMN quantite REAL'); + await db.execute('ALTER TABLE produits ADD COLUMN unite TEXT'); + } + if (ancienne < 4) { + // Ajout du nombre de contenants (packs). + await db.execute('ALTER TABLE produits ADD COLUMN nb_contenants INTEGER'); + } + if (ancienne < 5) { + // Ajout du stock (inventaire). + await db.execute( + 'ALTER TABLE produits ADD COLUMN stock INTEGER NOT NULL DEFAULT 0'); + } + if (ancienne < 6) { + // Ajout du prix d'achat (marge). + await db.execute( + 'ALTER TABLE produits ADD COLUMN prix_achat REAL NOT NULL DEFAULT 0'); + } + }, + ); + } + + Future _creerTable(Database db) async { + await db.execute(''' + CREATE TABLE produits( + id INTEGER PRIMARY KEY AUTOINCREMENT, + code_barres TEXT UNIQUE, + nom TEXT NOT NULL, + image_url TEXT, + prix REAL NOT NULL DEFAULT 0, + prix_achat REAL NOT NULL DEFAULT 0, + quantite REAL, + unite TEXT, + nb_contenants INTEGER, + stock INTEGER NOT NULL DEFAULT 0, + cree_le INTEGER NOT NULL DEFAULT 0 + ) + '''); + } +} diff --git a/lib/services/openfoodfacts_service.dart b/lib/services/openfoodfacts_service.dart new file mode 100644 index 0000000..f086040 --- /dev/null +++ b/lib/services/openfoodfacts_service.dart @@ -0,0 +1,84 @@ +import 'dart:convert'; +import 'package:http/http.dart' as http; + +import '../models/produit.dart'; + +/// Résultat d'une recherche produit sur OpenFoodFacts. +class InfoProduit { + final String? nom; + final String? imageUrl; + final String? marque; + final double? quantite; + final String? unite; + + const InfoProduit({ + this.nom, + this.imageUrl, + this.marque, + this.quantite, + this.unite, + }); + + bool get estVide => (nom == null || nom!.isEmpty) && imageUrl == null; +} + +/// Interroge l'API publique OpenFoodFacts pour récupérer le nom, l'image et la +/// quantité (grammage / litrage) d'un produit à partir de son code-barres. +class OpenFoodFactsService { + static const String _base = 'https://world.openfoodfacts.org/api/v2/product'; + + Future chercherParCodeBarres(String codeBarres) async { + final uri = Uri.parse( + '$_base/$codeBarres.json?fields=product_name,product_name_fr,brands,' + 'image_front_url,image_url,product_quantity,product_quantity_unit', + ); + + try { + final res = await http + .get(uri, headers: {'User-Agent': 'GestionPrixProduit/1.0'}) + .timeout(const Duration(seconds: 8)); + + if (res.statusCode != 200) return null; + + final data = jsonDecode(res.body) as Map; + // status == 1 => produit trouvé + if (data['status'] != 1) return const InfoProduit(); + + final p = data['product'] as Map? ?? {}; + final nom = (p['product_name_fr'] as String?)?.trim(); + final nomEn = (p['product_name'] as String?)?.trim(); + final image = (p['image_front_url'] as String?)?.trim() ?? + (p['image_url'] as String?)?.trim(); + + final (quantite, unite) = _quantite(p); + + return InfoProduit( + nom: (nom != null && nom.isNotEmpty) ? nom : nomEn, + imageUrl: (image != null && image.isNotEmpty) ? image : null, + marque: (p['brands'] as String?)?.split(',').first.trim(), + quantite: quantite, + unite: unite, + ); + } catch (_) { + // Pas de réseau ou timeout : on retourne null, l'utilisateur saisit à la main. + return null; + } + } + + /// Normalise la quantité OpenFoodFacts (product_quantity + unité) vers nos unités. + (double?, String?) _quantite(Map p) { + final q = (p['product_quantity'] as num?)?.toDouble(); + final u = (p['product_quantity_unit'] as String?)?.toLowerCase().trim(); + if (q == null || q <= 0 || u == null) return (null, null); + + return switch (u) { + 'g' => (q, Unites.g), + 'kg' => (q, Unites.kg), + 'mg' => (q / 1000, Unites.g), + 'ml' => (q, Unites.ml), + 'cl' => (q, Unites.cl), + 'l' => (q, Unites.l), + _ => (null, null), + }; + } +} diff --git a/lib/services/photo_service.dart b/lib/services/photo_service.dart new file mode 100644 index 0000000..4211433 --- /dev/null +++ b/lib/services/photo_service.dart @@ -0,0 +1,33 @@ +import 'dart:io'; + +import 'package:image_picker/image_picker.dart'; +import 'package:path_provider/path_provider.dart'; + +/// Prise et stockage local des photos de produits. +class PhotoService { + static final _picker = ImagePicker(); + + /// Ouvre l'appareil photo ([ImageSource.camera]) ou la galerie, copie l'image + /// choisie dans le stockage de l'app et retourne son chemin local (ou null si annulé). + static Future choisir(ImageSource source) async { + final x = await _picker.pickImage( + source: source, + maxWidth: 1200, + imageQuality: 82, + ); + if (x == null) return null; + + final dir = await getApplicationDocumentsDirectory(); + final dossier = Directory('${dir.path}/photos'); + if (!await dossier.exists()) await dossier.create(recursive: true); + + final nom = 'produit_${DateTime.now().millisecondsSinceEpoch}.jpg'; + final dest = '${dossier.path}/$nom'; + await File(x.path).copy(dest); + return dest; + } + + /// Vrai si l'url pointe vers un fichier local (photo prise), pas vers le web. + static bool estLocale(String? url) => + url != null && url.isNotEmpty && !url.startsWith('http'); +} diff --git a/lib/services/produit_repository.dart b/lib/services/produit_repository.dart new file mode 100644 index 0000000..d9254ca --- /dev/null +++ b/lib/services/produit_repository.dart @@ -0,0 +1,91 @@ +import 'package:flutter/foundation.dart'; +import 'package:sqflite/sqflite.dart'; + +import '../models/produit.dart'; +import 'local_db.dart'; + +/// Source de vérité des produits, partagée par tous les écrans. +/// Persistée localement dans une base SQLite (aucun serveur, fonctionne hors-ligne). +class ProduitRepository extends ChangeNotifier { + ProduitRepository._(); + static final ProduitRepository instance = ProduitRepository._(); + + final List _produits = []; + bool _charge = false; + bool _enCours = false; + String? _erreur; + + List get produits => List.unmodifiable(_produits); + bool get charge => _charge; + bool get enCours => _enCours; + String? get erreur => _erreur; + + Future get _db async => LocalDb.instance.database; + + Future charger() async { + _enCours = true; + _erreur = null; + notifyListeners(); + + try { + final db = await _db; + final rows = await db.query('produits', orderBy: 'nom COLLATE NOCASE ASC'); + _produits + ..clear() + ..addAll(rows.map(Produit.fromMap)); + _charge = true; + } catch (e) { + _erreur = e.toString(); + } finally { + _enCours = false; + notifyListeners(); + } + } + + Produit? parCodeBarres(String code) { + for (final p in _produits) { + if (p.codeBarres == code) return p; + } + return null; + } + + Future ajouter(Produit p) async { + final db = await _db; + final ts = DateTime.now().millisecondsSinceEpoch; + final data = p.toInsertMap()..['cree_le'] = ts; + final id = await db.insert( + 'produits', + data, + conflictAlgorithm: ConflictAlgorithm.replace, + ); + final cree = p.copyWith(id: id.toString(), creeLe: ts); + _produits.add(cree); + _trier(); + notifyListeners(); + return cree; + } + + Future modifier(Produit p) async { + final db = await _db; + await db.update( + 'produits', + p.toInsertMap(), + where: 'id = ?', + whereArgs: [int.tryParse(p.id) ?? p.id], + ); + final i = _produits.indexWhere((e) => e.id == p.id); + if (i != -1) _produits[i] = p; + _trier(); + notifyListeners(); + } + + Future supprimer(String id) async { + final db = await _db; + await db.delete('produits', where: 'id = ?', whereArgs: [int.tryParse(id) ?? id]); + _produits.removeWhere((e) => e.id == id); + notifyListeners(); + } + + void _trier() => _produits + .sort((a, b) => a.nom.toLowerCase().compareTo(b.nom.toLowerCase())); +} diff --git a/lib/services/reglages.dart b/lib/services/reglages.dart new file mode 100644 index 0000000..14c9a89 --- /dev/null +++ b/lib/services/reglages.dart @@ -0,0 +1,27 @@ +import 'package:shared_preferences/shared_preferences.dart'; + +import '../models/produit.dart'; + +/// Petits réglages persistés (préférences utilisateur) pour accélérer la saisie. +class Reglages { + Reglages._(); + static final Reglages instance = Reglages._(); + + static const _cleDerniereUnite = 'derniere_unite'; + + SharedPreferences? _prefs; + + Future get _p async => + _prefs ??= await SharedPreferences.getInstance(); + + /// Dernière unité choisie lors d'un ajout (pour la re-proposer par défaut). + Future derniereUnite() async { + final p = await _p; + return p.getString(_cleDerniereUnite) ?? Unites.g; + } + + Future memoriserUnite(String unite) async { + final p = await _p; + await p.setString(_cleDerniereUnite, unite); + } +} diff --git a/lib/theme.dart b/lib/theme.dart new file mode 100644 index 0000000..0623296 --- /dev/null +++ b/lib/theme.dart @@ -0,0 +1,116 @@ +import 'package:flutter/material.dart'; + +/// Thème noir & blanc épuré, avec une seule couleur d'accent. +/// Change [accent] pour ajuster la touche de couleur de toute l'app. +class AppTheme { + static const Color accent = Color(0xFF2F6FED); // bleu moderne + static const Color noir = Color(0xFF111114); + static const Color grisTexte = Color(0xFF6B6B72); + + static ThemeData clair() { + final scheme = ColorScheme.fromSeed( + seedColor: accent, + brightness: Brightness.light, + ).copyWith( + primary: noir, + onPrimary: Colors.white, + secondary: accent, + surface: Colors.white, + onSurface: noir, + ); + + return _base(scheme, const Color(0xFFF6F6F7)); + } + + static ThemeData sombre() { + final scheme = ColorScheme.fromSeed( + seedColor: accent, + brightness: Brightness.dark, + ).copyWith( + primary: Colors.white, + onPrimary: noir, + secondary: accent, + ); + + return _base(scheme, const Color(0xFF0E0E11)); + } + + static ThemeData _base(ColorScheme scheme, Color fond) { + final base = ThemeData( + useMaterial3: true, + colorScheme: scheme, + scaffoldBackgroundColor: fond, + fontFamily: 'Roboto', + ); + + return base.copyWith( + appBarTheme: AppBarTheme( + backgroundColor: fond, + foregroundColor: scheme.onSurface, + elevation: 0, + centerTitle: false, + titleTextStyle: TextStyle( + color: scheme.onSurface, + fontSize: 24, + fontWeight: FontWeight.w700, + letterSpacing: -0.5, + ), + ), + cardTheme: CardThemeData( + elevation: 0, + color: scheme.surface, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + side: BorderSide(color: scheme.outlineVariant.withValues(alpha: 0.5)), + ), + margin: EdgeInsets.zero, + ), + filledButtonTheme: FilledButtonThemeData( + style: FilledButton.styleFrom( + backgroundColor: scheme.primary, + foregroundColor: scheme.onPrimary, + minimumSize: const Size.fromHeight(52), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(14), + ), + textStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600), + ), + ), + inputDecorationTheme: InputDecorationTheme( + filled: true, + fillColor: scheme.surface, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(14), + borderSide: BorderSide(color: scheme.outlineVariant), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(14), + borderSide: BorderSide(color: scheme.outlineVariant), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(14), + borderSide: const BorderSide(color: accent, width: 2), + ), + ), + navigationBarTheme: NavigationBarThemeData( + backgroundColor: scheme.surface, + indicatorColor: accent.withValues(alpha: 0.14), + elevation: 0, + labelTextStyle: WidgetStateProperty.resolveWith((states) { + final selected = states.contains(WidgetState.selected); + return TextStyle( + fontSize: 12, + fontWeight: selected ? FontWeight.w700 : FontWeight.w500, + color: selected ? scheme.onSurface : grisTexte, + ); + }), + iconTheme: WidgetStateProperty.resolveWith((states) { + final selected = states.contains(WidgetState.selected); + return IconThemeData( + color: selected ? accent : grisTexte, + ); + }), + ), + ); + } +} diff --git a/lib/utils/format.dart b/lib/utils/format.dart new file mode 100644 index 0000000..e1e4b52 --- /dev/null +++ b/lib/utils/format.dart @@ -0,0 +1,5 @@ +import 'package:intl/intl.dart'; + +final NumberFormat _euro = NumberFormat.currency(locale: 'fr_FR', symbol: '€'); + +String euro(double v) => _euro.format(v); diff --git a/lib/utils/tri.dart b/lib/utils/tri.dart new file mode 100644 index 0000000..ac3c259 --- /dev/null +++ b/lib/utils/tri.dart @@ -0,0 +1,41 @@ +import '../models/produit.dart'; + +/// Critères de tri partagés (page Produits et page Étiquettes). +enum Tri { + recent('Récents'), + alpha('A → Z'), + prixAsc('Prix ↑'), + prixDesc('Prix ↓'), + margeDesc('Marge ↓'), + margeAsc('Marge ↑'); + + const Tri(this.libelle); + final String libelle; +} + +/// Retourne une copie triée de [source] selon [tri]. +List trierProduits(List source, Tri tri) { + final list = List.of(source); + switch (tri) { + case Tri.recent: + // Plus récemment ajouté en premier (date d'ajout, puis id). + list.sort((a, b) { + final c = b.creeLe.compareTo(a.creeLe); + if (c != 0) return c; + return (int.tryParse(b.id) ?? 0).compareTo(int.tryParse(a.id) ?? 0); + }); + case Tri.alpha: + list.sort((a, b) => a.nom.toLowerCase().compareTo(b.nom.toLowerCase())); + case Tri.prixAsc: + list.sort((a, b) => a.prix.compareTo(b.prix)); + case Tri.prixDesc: + list.sort((a, b) => b.prix.compareTo(a.prix)); + case Tri.margeDesc: + list.sort( + (a, b) => (b.coefficient ?? -1e18).compareTo(a.coefficient ?? -1e18)); + case Tri.margeAsc: + list.sort( + (a, b) => (a.coefficient ?? 1e18).compareTo(b.coefficient ?? 1e18)); + } + return list; +} diff --git a/lib/widgets/produit_image.dart b/lib/widgets/produit_image.dart new file mode 100644 index 0000000..ce4d1cb --- /dev/null +++ b/lib/widgets/produit_image.dart @@ -0,0 +1,62 @@ +import 'dart:io'; + +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; + +import '../services/photo_service.dart'; + +/// Vignette d'image produit : photo locale, image web (OpenFoodFacts) ou icône par défaut. +class ProduitImage extends StatelessWidget { + final String? url; + final double taille; + final double radius; + + const ProduitImage({ + super.key, + required this.url, + this.taille = 52, + this.radius = 12, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return ClipRRect( + borderRadius: BorderRadius.circular(radius), + child: Container( + width: taille, + height: taille, + color: scheme.surfaceContainerHighest, + child: _contenu(scheme), + ), + ); + } + + Widget _contenu(ColorScheme scheme) { + if (url == null || url!.isEmpty) { + return Icon(Icons.image_outlined, + color: scheme.onSurfaceVariant, size: taille * 0.42); + } + if (PhotoService.estLocale(url)) { + return Image.file( + File(url!), + fit: BoxFit.cover, + errorBuilder: (_, _, _) => Icon(Icons.broken_image_outlined, + color: scheme.onSurfaceVariant, size: taille * 0.42), + ); + } + return CachedNetworkImage( + imageUrl: url!, + fit: BoxFit.cover, + placeholder: (_, _) => const Center( + child: SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ), + ), + errorWidget: (_, _, _) => Icon(Icons.broken_image_outlined, + color: scheme.onSurfaceVariant, size: taille * 0.42), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..4ef12e0 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,866 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + sha256: a96e8b390886ee8abb49b7bd3ac8df6f451c621619f52a26e815fdcf568959ff + url: "https://pub.dev" + source: hosted + version: "4.0.9" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + barcode: + dependency: transitive + description: + name: barcode + sha256: "7b6729c37e3b7f34233e2318d866e8c48ddb46c1f7ad01ff7bb2a8de1da2b9f4" + url: "https://pub.dev" + source: hosted + version: "2.2.9" + bidi: + dependency: transitive + description: + name: bidi + sha256: "77f475165e94b261745cf1032c751e2032b8ed92ccb2bf5716036db79320637d" + url: "https://pub.dev" + source: hosted + version: "2.0.13" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + cached_network_image: + dependency: "direct main" + description: + name: cached_network_image + sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + cached_network_image_platform_interface: + dependency: transitive + description: + name: cached_network_image_platform_interface + sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829" + url: "https://pub.dev" + source: hosted + version: "4.1.1" + cached_network_image_web: + dependency: transitive + description: + name: cached_network_image_web + sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + code_assets: + dependency: transitive + description: + name: code_assets + sha256: bf394f466ba9205f1812a0433b392d6af280f155f56651eda7c18cc32ed493b8 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "92c9c43c383bfa1c32079d3bc492d55d6d4318044b7b47edaff8971cbb555c51" + url: "https://pub.dev" + source: hosted + version: "0.3.5+4" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd" + url: "https://pub.dev" + source: hosted + version: "1.0.9" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "2567f398e06ac72dcf2e98a0c95df2a9edd03c2c2e0cacd4780f20cdf56263a0" + url: "https://pub.dev" + source: hosted + version: "0.9.4" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: "5e0bbe9c312416f1787a68259ea1505b52f258c587f12920422671807c4d618a" + url: "https://pub.dev" + source: hosted + version: "0.9.5" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: "35e0bd61ebcdb91a3505813b055b09b79dfdc7d0aee9c09a7ba59ae4bb13dc85" + url: "https://pub.dev" + source: hosted + version: "2.7.0" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: "62197474ae75893a62df75939c777763d39c2bc5f73ce5b88497208bc269abfd" + url: "https://pub.dev" + source: hosted + version: "0.9.3+5" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + flutter_launcher_icons: + dependency: "direct dev" + description: + name: flutter_launcher_icons + sha256: "10f13781741a2e3972126fae08393d3c4e01fa4cd7473326b94b72cf594195e7" + url: "https://pub.dev" + source: hosted + version: "0.14.4" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: "3854fe5e3bff0b113c658f260b90c95dea17c92db0f2addeac2e343dd9969785" + url: "https://pub.dev" + source: hosted + version: "2.0.35" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + hooks: + dependency: transitive + description: + name: hooks + sha256: "9a62a50b50b769a737bc0a8ff381f333529df3ab746b2f6b02e83760231455ba" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + http: + dependency: "direct main" + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + image: + dependency: transitive + description: + name: image + sha256: "6300175e00616bbc832e2fc91bfa4d776af5402c81c7151bee6905bb08473c52" + url: "https://pub.dev" + source: hosted + version: "4.9.1" + image_picker: + dependency: "direct main" + description: + name: image_picker + sha256: d8402284df184bc05f4a2210c6c23983b0720f4cd87cbd05c5390a78af602667 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: "6f3a1995eafb000333174fae92202622033b0ee7fd917a6cd3730295264df84a" + url: "https://pub.dev" + source: hosted + version: "0.8.13+19" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: "66257a3191ab360d23a55c8241c91a6e329d31e94efa7be9cf7a212e65850214" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: b9c4a438a9ff4f60808c9cf0039b93a42bb6c2211ef6ebb647394b2b3fa84588 + url: "https://pub.dev" + source: hosted + version: "0.8.13+6" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "1f81c5f2046b9ab724f85523e4af65be1d47b038160a8c8deed909762c308ed4" + url: "https://pub.dev" + source: hosted + version: "0.2.2" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "86f0f15a309de7e1a552c12df9ce5b59fe927e71385329355aec4776c6a8ec91" + url: "https://pub.dev" + source: hosted + version: "0.2.2+1" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: "567e056716333a1647c64bb6bd873cff7622233a5c3f694be28a583d4715690c" + url: "https://pub.dev" + source: hosted + version: "2.11.1" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: d248c86554a72b5495a31c56f060cf73a41c7ff541689327b1a7dbccc33adfae + url: "https://pub.dev" + source: hosted + version: "0.2.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867" + url: "https://pub.dev" + source: hosted + version: "0.20.3" + jni: + dependency: transitive + description: + name: jni + sha256: c2230682d5bc2362c1c9e8d3c7f406d9cbba23ab3f2e203a025dd47e0fb2e68f + url: "https://pub.dev" + source: hosted + version: "1.0.0" + jni_flutter: + dependency: transitive + description: + name: jni_flutter + sha256: "8b59e590786050b1cd866677dddaf76b1ade5e7bc751abe04b86e84d379d3ba6" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80" + url: "https://pub.dev" + source: hosted + version: "4.12.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 + url: "https://pub.dev" + source: hosted + version: "0.12.19" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: transitive + description: + name: meta + sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349" + url: "https://pub.dev" + source: hosted + version: "1.18.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + mobile_scanner: + dependency: "direct main" + description: + name: mobile_scanner + sha256: c92c26bf2231695b6d3477c8dcf435f51e28f87b1745966b1fe4c47a286171ce + url: "https://pub.dev" + source: hosted + version: "7.2.0" + objective_c: + dependency: transitive + description: + name: objective_c + sha256: "6cb691c686fa2838c6deb34980d426145c2a5d537491cb83d463c33cdbc726ed" + url: "https://pub.dev" + source: hosted + version: "9.4.1" + octo_image: + dependency: transitive + description: + name: octo_image + sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825 + url: "https://pub.dev" + source: hosted + version: "2.1.6" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "2a376b7d6392d80cd3705782d2caa734ca4727776db0b6ec36ef3f1855197699" + url: "https://pub.dev" + source: hosted + version: "2.6.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: "58c2005f147315b11e9b4a7bc889cd5203e250cba8e3f012dae259b4972b5c16" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "484838772624c3a4b94f1e44a3e19897fee738f2d5c4ce448443b0417f7c9dda" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + pdf: + dependency: "direct main" + description: + name: pdf + sha256: "517df47af468734a23c8b513c0c6a8a62357403ab1b8ab7fad1606576a9dbdd0" + url: "https://pub.dev" + source: hosted + version: "3.13.0" + pdf_widget_wrapper: + dependency: transitive + description: + name: pdf_widget_wrapper + sha256: c930860d987213a3d58c7ec3b7ecf8085c3897f773e8dc23da9cae60a5d6d0f5 + url: "https://pub.dev" + source: hosted + version: "1.0.4" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675" + url: "https://pub.dev" + source: hosted + version: "7.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + posix: + dependency: transitive + description: + name: posix + sha256: "185ef7606574f789b40f289c233efa52e96dead518aed988e040a10737febb07" + url: "https://pub.dev" + source: hosted + version: "6.5.0" + printing: + dependency: "direct main" + description: + name: printing + sha256: f6cd14c768c1352dd37a958a3ee351aa9ce305b398218d3acd86389d5f7ecad1 + url: "https://pub.dev" + source: hosted + version: "5.15.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + qr: + dependency: transitive + description: + name: qr + sha256: "5a1d2586170e172b8a8c8470bbbffd5eb0cd38a66c0d77155ea138d3af3a4445" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + record_use: + dependency: transitive + description: + name: record_use + sha256: "2551bd8eecfe95d14ae75f6021ad0248be5c27f138c2ec12fcb52b500b3ba1ed" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + url: "https://pub.dev" + source: hosted + version: "0.28.0" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: c3025c5534b01739267eb7d76959bbc25a6d10f6988e1c2a3036940133dd10bf + url: "https://pub.dev" + source: hosted + version: "2.5.5" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "93ae5884a9df5d3bb696825bceb3a17590754548b5d740eba51500afc8d088f5" + url: "https://pub.dev" + source: hosted + version: "2.4.26" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f" + url: "https://pub.dev" + source: hosted + version: "2.5.6" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "649dc798a33931919ea356c4305c2d1f81619ea6e92244070b520187b5140ef9" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + sqflite: + dependency: "direct main" + description: + name: sqflite + sha256: "58a799e6ac17dd32fbab93813d39ed835a75ccc0f8f85b8955fe318c6712b082" + url: "https://pub.dev" + source: hosted + version: "2.4.3" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: d0548f9d7422a2dae99ec6f8b0a3074463b132d216fa5ba0d230eeefc901983b + url: "https://pub.dev" + source: hosted + version: "2.4.3" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "5bf6a55c166e73bf651ba7ec3ed486e577620e3dc8f3a9c6a258a8031b624590" + url: "https://pub.dev" + source: hosted + version: "2.5.11" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: c86ca18b8f666bbf903924687fe21cc16fc385d086005067e26619ca530bef9f + url: "https://pub.dev" + source: hosted + version: "2.4.3+1" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: f84939f84350d92d04416f8bc4dc52d3896aec7716cc9e80cf0146342139dc50 + url: "https://pub.dev" + source: hosted + version: "2.4.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "93b153dcb6a26dcddee6ca087dd634b53e38c10b5aa163e8e49501a776456153" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e" + url: "https://pub.dev" + source: hosted + version: "0.7.11" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + uuid: + dependency: transitive + description: + name: uuid + sha256: "1fef9e8e11e2991bb773070d4656b7bd5d850967a2456cfc83cf47925ba79489" + url: "https://pub.dev" + source: hosted + version: "4.5.3" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0016aef94fc66495ac78af5859181e3f3bf2026bd8eecc72b9565601e19ab360" + url: "https://pub.dev" + source: hosted + version: "15.2.0" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: "67f0aff7be013d107995e9b75bf4e7f2c3ef2dfdb2c8e68024bba0a7fd5756a4" + url: "https://pub.dev" + source: hosted + version: "7.0.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.12.2 <4.0.0" + flutter: ">=3.44.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..db68e41 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,108 @@ +name: gestion_prix_produit +description: "A new Flutter project." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ^3.12.2 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + mobile_scanner: ^7.2.0 + http: ^1.6.0 + pdf: ^3.13.0 + printing: ^5.15.0 + cached_network_image: ^3.4.1 + intl: ^0.20.3 + sqflite: ^2.4.3 + shared_preferences: ^2.5.5 + image_picker: ^1.2.3 + path_provider: ^2.1.6 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^6.0.0 + flutter_launcher_icons: ^0.14.4 + +flutter_launcher_icons: + android: true + ios: false + image_path: "assets/icon/icon.png" + adaptive_icon_background: "#14141A" + adaptive_icon_foreground: "assets/icon/icon_foreground.png" + min_sdk_android: 21 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..aa3c76f --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,18 @@ +// Test de fumée : l'app démarre et affiche la barre de navigation. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:gestion_prix_produit/main.dart'; + +void main() { + testWidgets('L\'app démarre avec les 3 onglets', (WidgetTester tester) async { + await tester.pumpWidget(const MonApp()); + await tester.pump(); + + expect(find.text('Produits'), findsWidgets); + expect(find.text('Scanner'), findsOneWidget); + expect(find.text('Étiquettes'), findsWidgets); + expect(find.byType(NavigationBar), findsOneWidget); + }); +}