diff --git a/mobile/android/app/build.gradle b/mobile/android/app/build.gradle index 2bc068e..35bc869 100644 --- a/mobile/android/app/build.gradle +++ b/mobile/android/app/build.gradle @@ -8,7 +8,8 @@ plugins { android { namespace = "com.example.mobile" compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion + // ndkVersion = flutter.ndkVersion + ndkVersion = "29.0.13113456" compileOptions { sourceCompatibility = JavaVersion.VERSION_21 diff --git a/mobile/android/app/src/main/AndroidManifest.xml b/mobile/android/app/src/main/AndroidManifest.xml index 58284db..1d67c9b 100644 --- a/mobile/android/app/src/main/AndroidManifest.xml +++ b/mobile/android/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:icon="@mipmap/launcher_icon"> [ BottomNavigationBarItem( icon: Icon(currentIndex == 0 ? Icons.home : Icons.home_outlined), - label: "Home"), + label: "Hjem"), BottomNavigationBarItem( icon: Icon( currentIndex == 1 ? Icons.search : Icons.search_outlined), - label: "Products"), + label: "Varer"), BottomNavigationBarItem( icon: cartRepo.totalItemsInCart() == 0 ? Icon(currentIndex == 2 @@ -55,12 +55,12 @@ class Dashboard extends StatelessWidget { ? Icons.shopping_cart : Icons.shopping_cart_outlined), ), - label: "Cart"), + label: "Kurv"), BottomNavigationBarItem( icon: Icon(currentIndex == 3 ? Icons.receipt_long : Icons.receipt_long_outlined), - label: "Receipts") + label: "Kvitteringer") ], ), body: pages[currentIndex], diff --git a/mobile/lib/pages/finish_shopping_page.dart b/mobile/lib/pages/finish_shopping_page.dart index cb15a05..90746d2 100644 --- a/mobile/lib/pages/finish_shopping_page.dart +++ b/mobile/lib/pages/finish_shopping_page.dart @@ -32,19 +32,17 @@ class FinishShoppingPage extends StatelessWidget { const BackButton(), Container( margin: const EdgeInsets.all(20), - child: Expanded( - child: ListView.builder( - shrinkWrap: true, - itemBuilder: (_, idx) => ReceiptItemView( - pricePerAmount: cart[idx].product.priceInDkkCents, - name: cart[idx].product.name, - amount: cart[idx].amount), - itemCount: cart.length)), + child: ListView.builder( + shrinkWrap: true, + itemBuilder: (_, idx) => ReceiptItemView( + pricePerAmount: cart[idx].product.priceInDkkCents, + name: cart[idx].product.name, + amount: cart[idx].amount), + itemCount: cart.length), ), Container( margin: const EdgeInsets.all(20), - child: Expanded( - child: Row( + child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const Text( @@ -53,7 +51,7 @@ class FinishShoppingPage extends StatelessWidget { ), Text(formatDkkCents(cartRepo.totalPrice())), ], - )), + ), ), Expanded( child: Center( diff --git a/mobile/lib/pages/product_location_page.dart b/mobile/lib/pages/product_location_page.dart index 82a25f1..a057622 100644 --- a/mobile/lib/pages/product_location_page.dart +++ b/mobile/lib/pages/product_location_page.dart @@ -12,43 +12,45 @@ class ProductLocationPage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - body: Column( - children: [ - Row( - children: [ - const BackButton(), - Text(product.name), - ], - ), - Consumer(builder: (context, locationImage, child) { - if (locationImage.image == null) { - return const CircularProgressIndicator( - color: Colors.blue, - ); - } - if (product.location == null) { - return Text("Lokation af ${product.name} kunne ikke findes"); - } - return LayoutBuilder( - builder: (context, constraints) { - double parentWidth = constraints.maxWidth; - - final image = locationImage.image!; - double imageWidth = image.width.toDouble(); - double imageHeight = image.height.toDouble(); - double scale = (parentWidth / imageWidth).clamp(0.0, 1.0); - - return CustomPaint( - size: Size(imageWidth * scale, imageHeight * scale), - painter: LocationImagePainter( - image: locationImage.image!, - location: product.location!, - scale: scale), + body: SafeArea( + child: Column( + children: [ + Row( + children: [ + const BackButton(), + Text(product.name), + ], + ), + Consumer(builder: (context, locationImage, child) { + if (locationImage.image == null) { + return const CircularProgressIndicator( + color: Colors.blue, ); - }, - ); - }) - ], + } + if (product.location == null) { + return Text("Lokation af ${product.name} kunne ikke findes"); + } + return LayoutBuilder( + builder: (context, constraints) { + double parentWidth = constraints.maxWidth; + + final image = locationImage.image!; + double imageWidth = image.width.toDouble(); + double imageHeight = image.height.toDouble(); + double scale = (parentWidth / imageWidth).clamp(0.0, 1.0); + + return CustomPaint( + size: Size(imageWidth * scale, imageHeight * scale), + painter: LocationImagePainter( + image: locationImage.image!, + location: product.location!, + scale: scale), + ); + }, + ); + }) + ], + ), )); } } diff --git a/mobile/lib/repos/cart.dart b/mobile/lib/repos/cart.dart index a261293..370ef8b 100644 --- a/mobile/lib/repos/cart.dart +++ b/mobile/lib/repos/cart.dart @@ -4,30 +4,7 @@ import 'package:mobile/models/product.dart'; class ProductIdException implements Exception {} class CartRepo extends ChangeNotifier { - final List cart = [ - CartItem( - product: Product( - id: 1, - name: "Letmælk", - priceInDkkCents: 1295, - description: "Konventionel letmælk med fedtprocent på 1,5%"), - amount: 1), - CartItem( - product: Product( - id: 2, - name: "Frilands Øko Supermælk", - priceInDkkCents: 1995, - description: - "Økologisk mælk af frilandskøer med fedtprocent på 3,5%. Ikke homogeniseret eller pasteuriseret. Skaber store muskler og styrker knoglerne 💪"), - amount: 6), - CartItem( - product: Product( - id: 3, - name: "Minimælk", - priceInDkkCents: 1195, - description: "Konventionel minimælk med fedtprocent på 0,4%"), - amount: 1), - ]; + final List cart = []; List allCartItems() { return cart; diff --git a/mobile/lib/repos/product.dart b/mobile/lib/repos/product.dart index 1159825..5047b47 100644 --- a/mobile/lib/repos/product.dart +++ b/mobile/lib/repos/product.dart @@ -99,9 +99,22 @@ class ProductRepo extends ChangeNotifier { description: ""), Product( id: _nextId++, + barcode: "5060337502900", name: "Monster Energi Drik", - priceInDkkCents: 2000, + priceInDkkCents: 1500, description: ""), + Product( + id: _nextId++, + barcode: "5712870659220", + name: "Amper Energi Drik", + priceInDkkCents: 750, + description: ""), + Product( + id: _nextId++, + barcode: "5710326001937", + name: "Danskvand Med Brus", + priceInDkkCents: 500, + description: "Med smag a blåbær"), Product( id: _nextId++, name: "Spaghetti", diff --git a/mobile/lib/repos/receipt.dart b/mobile/lib/repos/receipt.dart index 5e07871..a44ef6f 100644 --- a/mobile/lib/repos/receipt.dart +++ b/mobile/lib/repos/receipt.dart @@ -4,46 +4,7 @@ import 'package:mobile/repos/cart.dart'; class ReceiptRepo extends ChangeNotifier { int nextId = 0; - final List receipts = [ - Receipt( - id: 0, - date: DateTime.fromMillisecondsSinceEpoch(1730031200000), - receiptItems: [ - ReceiptItem( - product: Product( - id: 1243, - name: "Letmælk", - priceInDkkCents: 13, - description: "Konventionel minimælk med fedtprocent på 0,4%"), - amount: 1), - ReceiptItem( - product: Product( - id: 340, - name: "Minimælk", - priceInDkkCents: 12, - description: "Konventionel minimælk med fedtprocent på 0,4%"), - amount: 3), - ]), - Receipt( - id: 1, - date: DateTime.fromMillisecondsSinceEpoch(1735031200000), - receiptItems: [ - ReceiptItem( - product: Product( - id: 12341, - name: "Letmælk", - priceInDkkCents: 13, - description: "Konventionel minimælk med fedtprocent på 0,4%"), - amount: 3), - ReceiptItem( - product: Product( - id: 1234443, - name: "Minimælk", - priceInDkkCents: 12, - description: "Konventionel minimælk med fedtprocent på 0,4%"), - amount: 1), - ]) - ]; + final List receipts = []; List allReceipts() { return receipts; diff --git a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index a2ec33f..96d3fee 100644 --- a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,68 +1,68 @@ { - "images" : [ - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "app_icon_16.png", - "scale" : "1x" + "info": { + "version": 1, + "author": "xcode" }, - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "app_icon_32.png", - "scale" : "2x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "app_icon_32.png", - "scale" : "1x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "app_icon_64.png", - "scale" : "2x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "app_icon_128.png", - "scale" : "1x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "app_icon_256.png", - "scale" : "2x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "app_icon_256.png", - "scale" : "1x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "app_icon_512.png", - "scale" : "2x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "app_icon_512.png", - "scale" : "1x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "app_icon_1024.png", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} + "images": [ + { + "size": "16x16", + "idiom": "mac", + "filename": "app_icon_16.png", + "scale": "1x" + }, + { + "size": "16x16", + "idiom": "mac", + "filename": "app_icon_32.png", + "scale": "2x" + }, + { + "size": "32x32", + "idiom": "mac", + "filename": "app_icon_32.png", + "scale": "1x" + }, + { + "size": "32x32", + "idiom": "mac", + "filename": "app_icon_64.png", + "scale": "2x" + }, + { + "size": "128x128", + "idiom": "mac", + "filename": "app_icon_128.png", + "scale": "1x" + }, + { + "size": "128x128", + "idiom": "mac", + "filename": "app_icon_256.png", + "scale": "2x" + }, + { + "size": "256x256", + "idiom": "mac", + "filename": "app_icon_256.png", + "scale": "1x" + }, + { + "size": "256x256", + "idiom": "mac", + "filename": "app_icon_512.png", + "scale": "2x" + }, + { + "size": "512x512", + "idiom": "mac", + "filename": "app_icon_512.png", + "scale": "1x" + }, + { + "size": "512x512", + "idiom": "mac", + "filename": "app_icon_1024.png", + "scale": "2x" + } + ] +} \ No newline at end of file diff --git a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png index 82b6f9d..83e8a10 100644 Binary files a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png and b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png index 13b35eb..6ecb07b 100644 Binary files a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png and b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png index 0a3f5fa..e57e684 100644 Binary files a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png and b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png index bdb5722..6f26ca6 100644 Binary files a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png and b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png index f083318..1047c91 100644 Binary files a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png and b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png index 326c0e7..a5fe4c8 100644 Binary files a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png and b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png index 2f1632c..c692fd9 100644 Binary files a/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png and b/mobile/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock index d2029a6..580c03e 100644 --- a/mobile/pubspec.lock +++ b/mobile/pubspec.lock @@ -1,6 +1,22 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + sha256: "0c64e928dcbefddecd234205422bcfc2b5e6d31be0b86fef0d0dd48d7b4c9742" + url: "https://pub.dev" + source: hosted + version: "4.0.4" + args: + dependency: transitive + description: + name: args + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + url: "https://pub.dev" + source: hosted + version: "2.6.0" async: dependency: transitive description: @@ -33,6 +49,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" clock: dependency: transitive description: @@ -94,6 +126,14 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_launcher_icons: + dependency: "direct dev" + description: + name: flutter_launcher_icons + sha256: bfa04787c85d80ecb3f8777bde5fc10c3de809240c48fa061a2c2bf15ea5211c + url: "https://pub.dev" + source: hosted + version: "0.14.3" flutter_lints: dependency: "direct dev" description: @@ -131,6 +171,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.2" + image: + dependency: transitive + description: + name: image + sha256: "13d3349ace88f12f4a0d175eb5c12dcdd39d35c4c109a8a13dfeb6d0bd9e31c3" + url: "https://pub.dev" + source: hosted + version: "4.5.3" intl: dependency: "direct main" description: @@ -139,6 +187,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.20.2" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" leak_tracker: dependency: transitive description: @@ -259,6 +315,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646" + url: "https://pub.dev" + source: hosted + version: "6.1.0" platform: dependency: transitive description: @@ -275,6 +339,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + posix: + dependency: transitive + description: + name: posix + sha256: a0117dc2167805aa9125b82eee515cc891819bac2f538c83646d355b16f58b9a + url: "https://pub.dev" + source: hosted + version: "6.0.1" protobuf: dependency: transitive description: @@ -384,6 +456,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" sdks: dart: ">=3.7.0 <4.0.0" flutter: ">=3.24.0" diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml index 44b64b4..9b52646 100644 --- a/mobile/pubspec.yaml +++ b/mobile/pubspec.yaml @@ -1,5 +1,5 @@ name: mobile -description: "A new Flutter project." +description: "Freshplaza Shopping app." # 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 @@ -50,6 +50,8 @@ dev_dependencies: # package. See that file for information about deactivating specific lint # rules and activating additional ones. flutter_lints: ^5.0.0 + + flutter_launcher_icons: "^0.14.3" # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/mobile/web/favicon.png b/mobile/web/favicon.png index 8aaa46a..e57e684 100644 Binary files a/mobile/web/favicon.png and b/mobile/web/favicon.png differ diff --git a/mobile/web/icons/Icon-192.png b/mobile/web/icons/Icon-192.png index b749bfe..dbac5f7 100644 Binary files a/mobile/web/icons/Icon-192.png and b/mobile/web/icons/Icon-192.png differ diff --git a/mobile/web/icons/Icon-512.png b/mobile/web/icons/Icon-512.png index 88cfd48..a5fe4c8 100644 Binary files a/mobile/web/icons/Icon-512.png and b/mobile/web/icons/Icon-512.png differ diff --git a/mobile/web/icons/Icon-maskable-192.png b/mobile/web/icons/Icon-maskable-192.png index eb9b4d7..dbac5f7 100644 Binary files a/mobile/web/icons/Icon-maskable-192.png and b/mobile/web/icons/Icon-maskable-192.png differ diff --git a/mobile/web/icons/Icon-maskable-512.png b/mobile/web/icons/Icon-maskable-512.png index d69c566..a5fe4c8 100644 Binary files a/mobile/web/icons/Icon-maskable-512.png and b/mobile/web/icons/Icon-maskable-512.png differ diff --git a/mobile/web/manifest.json b/mobile/web/manifest.json index 9dc3ff2..5a6591a 100644 --- a/mobile/web/manifest.json +++ b/mobile/web/manifest.json @@ -3,8 +3,8 @@ "short_name": "mobile", "start_url": ".", "display": "standalone", - "background_color": "#0175C2", - "theme_color": "#0175C2", + "background_color": "#hexcode", + "theme_color": "#hexcode", "description": "A new Flutter project.", "orientation": "portrait-primary", "prefer_related_applications": false, @@ -32,4 +32,4 @@ "purpose": "maskable" } ] -} +} \ No newline at end of file diff --git a/mobile/windows/runner/resources/app_icon.ico b/mobile/windows/runner/resources/app_icon.ico index c04e20c..be6188b 100644 Binary files a/mobile/windows/runner/resources/app_icon.ico and b/mobile/windows/runner/resources/app_icon.ico differ