diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 3c2adb58..1e122a70 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip \ No newline at end of file diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index 25584508..45b3742b 100644 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -2,13 +2,12 @@ # This is a generated file; do not edit or check into version control. export "FLUTTER_ROOT=C:\flutter" export "FLUTTER_APPLICATION_PATH=C:\inventree-app" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "FLUTTER_TARGET=lib\main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build\ios" -export "OTHER_LDFLAGS=$(inherited) -framework Flutter" -export "FLUTTER_FRAMEWORK_DIR=C:\flutter\bin\cache\artifacts\engine\ios" -export "FLUTTER_BUILD_NAME=0.1.3" -export "FLUTTER_BUILD_NUMBER=7" +export "FLUTTER_BUILD_NAME=0.1.5" +export "FLUTTER_BUILD_NUMBER=9" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=false" export "TREE_SHAKE_ICONS=false" diff --git a/lib/barcode.dart b/lib/barcode.dart index d40da535..ced482e3 100644 --- a/lib/barcode.dart +++ b/lib/barcode.dart @@ -1,7 +1,7 @@ import 'package:InvenTree/app_settings.dart'; import 'package:InvenTree/widget/dialogs.dart'; import 'package:InvenTree/widget/snacks.dart'; -import 'package:audioplayers/audio_cache.dart'; +import 'package:audioplayers/audioplayers.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -43,7 +43,7 @@ class BarcodeHandler { final bool en = await InvenTreeSettingsManager().getValue("barcodeSounds", true) as bool; if (en) { - AudioCache player = AudioCache(); + final player = AudioCache(); player.play("sounds/barcode_scan.mp3"); } } @@ -53,7 +53,7 @@ class BarcodeHandler { final bool en = await InvenTreeSettingsManager().getValue("barcodeSounds", true) as bool; if (en) { - AudioCache player = AudioCache(); + final player = AudioCache(); player.play("sounds/barcode_error.mp3"); } } @@ -223,7 +223,7 @@ class BarcodeScanHandler extends BarcodeHandler { onAction: () { showDialog( context: _context, - child: SimpleDialog( + builder: (BuildContext context) => SimpleDialog( title: Text(L10().unknownResponse), children: [ ListTile( diff --git a/lib/inventree/model.dart b/lib/inventree/model.dart index 19204aa7..0d269c4d 100644 --- a/lib/inventree/model.dart +++ b/lib/inventree/model.dart @@ -7,7 +7,7 @@ import 'package:flutter/cupertino.dart'; import 'package:one_context/one_context.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +// import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'dart:convert'; diff --git a/lib/inventree/part.dart b/lib/inventree/part.dart index 0e9e9c0d..ea71051f 100644 --- a/lib/inventree/part.dart +++ b/lib/inventree/part.dart @@ -301,6 +301,10 @@ class InvenTreePart extends InvenTreeModel { return img.isNotEmpty ? img : InvenTreeAPI.staticThumb; } + void uploadImage(File image) async { + // TODO + } + // Return the "starred" status of this part bool get starred => jsondata['starred'] as bool ?? false; diff --git a/lib/l10n b/lib/l10n index 55e409cf..f0001812 160000 --- a/lib/l10n +++ b/lib/l10n @@ -1 +1 @@ -Subproject commit 55e409cf7d1200c0e0a30af96ceabd9e67947a97 +Subproject commit f00018125f82ba6fdecc9be9de59e22054c75f32 diff --git a/lib/main.dart b/lib/main.dart index 036b18a8..db2e4323 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,8 +5,6 @@ import 'package:InvenTree/inventree/sentry.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'file:///C:/inventree-app/lib/l10.dart'; - import 'package:InvenTree/widget/home.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/lib/widget/dialogs.dart b/lib/widget/dialogs.dart index 9a07d05f..6d636fc0 100644 --- a/lib/widget/dialogs.dart +++ b/lib/widget/dialogs.dart @@ -1,7 +1,7 @@ import 'package:InvenTree/app_settings.dart'; import 'package:InvenTree/widget/snacks.dart'; -import 'package:audioplayers/audio_cache.dart'; +import 'package:audioplayers/audioplayers.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -64,7 +64,7 @@ Future showInfoDialog(BuildContext context, String title, String descripti showDialog( context: context, - child: SimpleDialog( + builder: (BuildContext context) => SimpleDialog( title: ListTile( title: Text(info), leading: FaIcon(icon), @@ -119,7 +119,7 @@ Future showServerError(String title, String description) async { final bool tones = await InvenTreeSettingsManager().getValue("serverSounds", true) as bool; if (tones) { - AudioCache player = AudioCache(); + final player = AudioCache(); player.play("sounds/server_error.mp3"); } diff --git a/lib/widget/fields.dart b/lib/widget/fields.dart index 006974fa..7039f128 100644 --- a/lib/widget/fields.dart +++ b/lib/widget/fields.dart @@ -28,24 +28,28 @@ class ImagePickerField extends FormField { } static Future _getImageFromGallery(FormFieldState field) async { - - File image; - - await ImagePicker.pickImage(source: ImageSource.gallery).then((File img) { - image = img; - }); - field.didChange(image); + final picker = ImagePicker(); + + final pickedImage = await picker.getImage(source: ImageSource.gallery); + + if (pickedImage != null) + { + field.didChange(File(pickedImage.path)); + } } static Future _getImageFromCamera(FormFieldState field) async { - File image; - await ImagePicker.pickImage(source: ImageSource.camera).then((File img) { - image = img; - }); + final picker = ImagePicker(); + + final pickedImage = await picker.getImage(source: ImageSource.camera); + + if (pickedImage != null) + { + field.didChange(File(pickedImage.path)); + } - field.didChange(image); } ImagePickerField(BuildContext context, {String label = "Attach Image", Function onSaved, bool required = false}) : diff --git a/lib/widget/part_detail.dart b/lib/widget/part_detail.dart index 2d539768..4a92b570 100644 --- a/lib/widget/part_detail.dart +++ b/lib/widget/part_detail.dart @@ -34,6 +34,7 @@ class PartDetailWidget extends StatefulWidget { class _PartDisplayState extends RefreshableState { + final _editImageKey = GlobalKey(); final _editPartKey = GlobalKey(); @override @@ -116,6 +117,39 @@ class _PartDisplayState extends RefreshableState { refresh(); } + void _uploadImage(File image) async { + + print("Uploading image..."); + await part.uploadImage(image); + print("Done"); + + refresh(); + } + + void _selectImage() { + + File _attachment; + + if (!InvenTreeAPI().checkPermission('part', 'change')) { + return; + } + + showFormDialog(L10().selectImage, + key: _editImageKey, + callback: () { + _uploadImage(_attachment); + }, + fields: [ + ImagePickerField( + context, + label: L10().attachImage, + required: true, + onSaved: (attachment) => _attachment = attachment, + ), + ] + ); + } + void _editPartDialog() { // Values which can be edited @@ -189,6 +223,7 @@ class _PartDisplayState extends RefreshableState { MaterialPageRoute(builder: (context) => FullScreenWidget(part.fullname, part.image)) ); }), + onLongPress: _selectImage, ), ); } diff --git a/pubspec.lock b/pubspec.lock index fb5bd960..c1c9d3d1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,35 +7,35 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.13" + version: "3.1.2" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.6.0" + version: "2.0.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.6.1" audioplayers: dependency: "direct main" description: name: audioplayers url: "https://pub.dartlang.org" source: hosted - version: "0.17.4" + version: "0.19.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" cached_network_image: dependency: "direct main" description: @@ -49,63 +49,56 @@ packages: name: camera url: "https://pub.dartlang.org" source: hosted - version: "0.7.0+2" + version: "0.8.1+3" camera_platform_interface: dependency: transitive description: name: camera_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.5.0" + version: "2.0.1" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.3" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" + version: "1.15.0" cross_file: dependency: transitive description: name: cross_file url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "0.3.1+1" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "3.0.1" cupertino_icons: dependency: "direct main" description: @@ -119,35 +112,35 @@ packages: name: device_info url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "2.0.2" device_info_platform_interface: dependency: transitive description: name: device_info_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.1" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.1.2" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "5.2.1" + version: "6.1.2" flutter: dependency: "direct main" description: flutter @@ -166,35 +159,21 @@ packages: name: flutter_cache_manager url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" flutter_keyboard_visibility: dependency: transitive description: name: flutter_keyboard_visibility url: "https://pub.dartlang.org" source: hosted - version: "4.0.3" - flutter_keyboard_visibility_platform_interface: - dependency: transitive - description: - name: flutter_keyboard_visibility_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" - flutter_keyboard_visibility_web: - dependency: transitive - description: - name: flutter_keyboard_visibility_web - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" + version: "3.3.0" flutter_launcher_icons: dependency: "direct dev" description: name: flutter_launcher_icons url: "https://pub.dartlang.org" source: hosted - version: "0.8.1" + version: "0.9.0" flutter_localizations: dependency: "direct main" description: flutter @@ -206,14 +185,14 @@ packages: name: flutter_markdown url: "https://pub.dartlang.org" source: hosted - version: "0.5.2" + version: "0.6.2" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle url: "https://pub.dartlang.org" source: hosted - version: "1.0.11" + version: "2.0.2" flutter_speed_dial: dependency: "direct main" description: @@ -232,7 +211,7 @@ packages: name: flutter_typeahead url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.8.8" flutter_web_plugins: dependency: transitive description: flutter @@ -251,35 +230,42 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.2" + version: "0.13.3" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "4.0.0" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.1.19" + version: "3.0.2" image_picker: dependency: "direct main" description: name: image_picker url: "https://pub.dartlang.org" source: hosted - version: "0.6.7+22" + version: "0.8.0+3" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "2.1.0" infinite_scroll_pagination: dependency: "direct main" description: @@ -293,28 +279,35 @@ packages: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.16.1" + version: "0.17.0" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.3" markdown: dependency: transitive description: name: markdown url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "4.0.0" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" octo_image: dependency: transitive description: @@ -335,84 +328,126 @@ packages: name: package_info url: "https://pub.dartlang.org" source: hosted - version: "0.4.3+4" + version: "2.0.2" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + package_info_plus_linux: + dependency: transitive + description: + name: package_info_plus_linux + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + package_info_plus_macos: + dependency: transitive + description: + name: package_info_plus_macos + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + package_info_plus_web: + dependency: transitive + description: + name: package_info_plus_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + package_info_plus_windows: + dependency: transitive + description: + name: package_info_plus_windows + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" path: dependency: "direct main" description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.6.27" + version: "2.0.1" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+2" + version: "2.0.0" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+8" + version: "2.0.0" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+3" + version: "2.0.1" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.9.2" + version: "1.11.1" petitparser: dependency: transitive description: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "4.1.0" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.0.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" process: dependency: transitive description: name: process url: "https://pub.dartlang.org" source: hosted - version: "3.0.13" + version: "4.2.1" qr_code_scanner: dependency: "direct main" description: @@ -426,7 +461,7 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "3.0.1" rxdart: dependency: transitive description: @@ -447,28 +482,21 @@ packages: name: sentry url: "https://pub.dartlang.org" source: hosted - version: "4.0.5" + version: "5.1.0" sentry_flutter: dependency: "direct main" description: name: sentry_flutter url: "https://pub.dartlang.org" source: hosted - version: "4.0.5" + version: "5.0.0" shared_preferences: dependency: transitive description: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "0.5.12+4" - shared_preferences_linux: - dependency: transitive - description: - name: shared_preferences_linux - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.2+4" + version: "0.5.7+3" shared_preferences_macos: dependency: transitive description: @@ -490,13 +518,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.2+7" - shared_preferences_windows: - dependency: transitive - description: - name: shared_preferences_windows - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.2+3" sky_engine: dependency: transitive description: flutter @@ -515,7 +536,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.1" sqflite: dependency: transitive description: @@ -536,28 +557,28 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" synchronized: dependency: transitive description: @@ -571,105 +592,105 @@ packages: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.3.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" url_launcher: dependency: "direct main" description: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "5.7.10" + version: "6.0.0" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+4" + version: "2.0.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+9" + version: "2.0.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.9" + version: "2.0.3" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.5+3" + version: "2.0.1" url_launcher_windows: dependency: transitive description: name: url_launcher_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+3" + version: "2.0.0" uuid: dependency: transitive description: name: uuid url: "https://pub.dartlang.org" source: hosted - version: "2.2.2" + version: "3.0.4" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.4+1" + version: "2.1.5" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.2.0" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted - version: "4.5.1" + version: "5.1.2" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.1.0" sdks: - dart: ">=2.10.2 <2.11.0" - flutter: ">=1.22.2 <2.0.0" + dart: ">=2.13.0 <3.0.0" + flutter: ">=2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index a5f8c166..6188edcd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,27 +19,27 @@ dependencies: flutter_localizations: sdk: flutter - intl: ^0.16.1 + intl: ^0.17.0 cupertino_icons: ^0.1.3 - http: ^0.12.1 + http: ^0.13.0 cached_network_image: ^2.5.0 qr_code_scanner: ^0.3.5 # Barcode scanning - package_info: ^0.4.0 # App information introspection - device_info: ^1.0.0 # Information about the device + package_info: ^2.0.0 # App information introspection + device_info: ^2.0.0 # Information about the device font_awesome_flutter: ^8.8.1 # FontAwesome icon set flutter_speed_dial: ^1.2.5 # FAB menu elements - sentry_flutter: ^4.0.4 # Error reporting + sentry_flutter: 5.0.0 # Error reporting flutter_typeahead: ^1.8.1 # Auto-complete input field - image_picker: ^0.6.6 # Select or take photos - url_launcher: ^5.7.10 # Open link in system browser - flutter_markdown: ^0.5.2 # Rendering markdown + image_picker: ^0.8.0 # Select or take photos + url_launcher: 6.0.0 # Open link in system browser + flutter_markdown: ^0.6.2 # Rendering markdown camera: # Camera - path_provider: ^1.6.27 # Local file storage + path_provider: 2.0.1 #^1.6.28 # Local file storage sembast: ^2.4.9 # NoSQL data storage one_context: ^0.5.0 # Dialogs without requiring context infinite_scroll_pagination: ^2.3.0 # Let the server do all the work! - audioplayers: + audioplayers: ^0.19.0 path: dev_dependencies: