This commit is contained in:
JMARyA 2024-09-05 11:08:52 +02:00
parent fb1677ed73
commit 378e777589
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
8 changed files with 156 additions and 24 deletions

View file

@ -1,5 +1,6 @@
import 'package:cdb_ui/api.dart';
import 'package:flutter/material.dart';
import 'package:qr_bar_code_scanner_dialog/qr_bar_code_scanner_dialog.dart';
class ItemView extends StatelessWidget {
final Item item;
@ -217,29 +218,45 @@ class _SupplyPageState extends State<SupplyPage> {
),
// Location Dropdown
DropdownButtonFormField<String>(
hint: const Text('Select Location'),
value: _selectedLocation,
onChanged: (value) {
setState(() {
_selectedLocation = value!;
});
},
items: locations.map<DropdownMenuItem<String>>((location) {
return DropdownMenuItem<String>(
value: location,
child: Text(location),
);
}).toList(),
validator: (value) {
if (value == null) {
return 'Please select a location';
}
return null;
},
onSaved: (value) {
_selectedLocation = value!;
},
Row(
children: [
DropdownButtonFormField<String>(
hint: const Text('Select Location'),
value: _selectedLocation,
onChanged: (value) {
setState(() {
_selectedLocation = value!;
});
},
items:
locations.map<DropdownMenuItem<String>>((location) {
return DropdownMenuItem<String>(
value: location,
child: Text(location),
);
}).toList(),
validator: (value) {
if (value == null) {
return 'Please select a location';
}
return null;
},
onSaved: (value) {
_selectedLocation = value!;
},
),
IconButton(
onPressed: () {
QrBarCodeScannerDialog().getScannedQrBarCode(
context: context,
onCode: (code) {
setState(() {
_selectedLocation = code!;
});
});
},
icon: const Icon(Icons.qr_code))
],
),
const SizedBox(height: 20),

View file

@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h"
#include <qr_bar_code/qr_bar_code_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) qr_bar_code_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "QrBarCodePlugin");
qr_bar_code_plugin_register_with_registrar(qr_bar_code_registrar);
}

View file

@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
qr_bar_code
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

View file

@ -5,6 +5,8 @@
import FlutterMacOS
import Foundation
import qr_bar_code
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
QrBarCodePlugin.register(with: registry.registrar(forPlugin: "QrBarCodePlugin"))
}

View file

@ -1,6 +1,14 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
animated_tree_view:
dependency: "direct main"
description:
name: animated_tree_view
sha256: ed982be7fa2cf51b62bb76e95b6a0f423cde12f1da8745a1da938e82a7baacf2
url: "https://pub.dev"
source: hosted
version: "2.3.0"
async:
dependency: transitive
description:
@ -41,6 +49,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.18.0"
crypto:
dependency: transitive
description:
name: crypto
sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27
url: "https://pub.dev"
source: hosted
version: "3.0.5"
cupertino_icons:
dependency: "direct main"
description:
@ -49,6 +65,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.8"
diffutil_dart:
dependency: transitive
description:
name: diffutil_dart
sha256: "5e74883aedf87f3b703cb85e815bdc1ed9208b33501556e4a8a5572af9845c81"
url: "https://pub.dev"
source: hosted
version: "4.0.1"
fake_async:
dependency: transitive
description:
@ -57,6 +81,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
fixnum:
dependency: transitive
description:
name: fixnum
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
@ -75,6 +107,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: "direct main"
description:
@ -91,6 +128,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.2"
js:
dependency: transitive
description:
name: js
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.6.7"
leak_tracker:
dependency: transitive
description:
@ -155,6 +200,46 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.8"
qr_bar_code:
dependency: "direct main"
description:
name: qr_bar_code
sha256: "9a67246a28d23884c6beeaed730e3b8db171e6c7962b9543b29f990c7e607616"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
qr_bar_code_scanner_dialog:
dependency: "direct main"
description:
name: qr_bar_code_scanner_dialog
sha256: dcb937816d4e562141530265bd1ca39fe00f57000fd79e26c163c957d443e9e4
url: "https://pub.dev"
source: hosted
version: "0.0.5"
qr_code_scanner:
dependency: transitive
description:
name: qr_code_scanner
sha256: f23b68d893505a424f0bd2e324ebea71ed88465d572d26bb8d2e78a4749591fd
url: "https://pub.dev"
source: hosted
version: "1.0.1"
scroll_to_index:
dependency: transitive
description:
name: scroll_to_index
sha256: b707546e7500d9f070d63e5acf74fd437ec7eeeb68d3412ef7b0afada0b4f176
url: "https://pub.dev"
source: hosted
version: "3.0.1"
sky_engine:
dependency: transitive
description: flutter
@ -168,6 +253,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.10.0"
sprintf:
dependency: transitive
description:
name: sprintf
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
stack_trace:
dependency: transitive
description:
@ -216,6 +309,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
uuid:
dependency: transitive
description:
name: uuid
sha256: f33d6bb662f0e4f79dcd7ada2e6170f3b3a2530c28fc41f49a411ddedd576a77
url: "https://pub.dev"
source: hosted
version: "4.5.0"
vector_math:
dependency: transitive
description:
@ -241,5 +342,5 @@ packages:
source: hosted
version: "0.5.1"
sdks:
dart: ">=3.3.0 <4.0.0"
dart: ">=3.4.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"

View file

@ -30,6 +30,9 @@ environment:
dependencies:
flutter:
sdk: flutter
animated_tree_view: ^2.3.0
qr_bar_code: ^1.3.0
qr_bar_code_scanner_dialog: ^0.0.5
# The following adds the Cupertino Icons font to your application.

View file

@ -6,6 +6,9 @@
#include "generated_plugin_registrant.h"
#include <qr_bar_code/qr_bar_code_plugin_c_api.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
QrBarCodePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("QrBarCodePluginCApi"));
}

View file

@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
qr_bar_code
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST