mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Yet more linting
This commit is contained in:
parent
ad0cc36540
commit
77bac9af36
@ -55,5 +55,7 @@ linter:
|
|||||||
|
|
||||||
sort_child_properties_last: false
|
sort_child_properties_last: false
|
||||||
|
|
||||||
|
directives_ordering: false
|
||||||
|
|
||||||
# Blindly follow the Flutter code style, which prefers types everywhere
|
# Blindly follow the Flutter code style, which prefers types everywhere
|
||||||
always_specify_types: false
|
always_specify_types: false
|
||||||
|
27
lib/api.dart
27
lib/api.dart
@ -50,7 +50,7 @@ class APIResponse {
|
|||||||
|
|
||||||
bool clientError() => (statusCode >= 400) && (statusCode < 500);
|
bool clientError() => (statusCode >= 400) && (statusCode < 500);
|
||||||
|
|
||||||
bool serverError() => (statusCode >= 500);
|
bool serverError() => statusCode >= 500;
|
||||||
|
|
||||||
bool isMap() {
|
bool isMap() {
|
||||||
return data != null && data is Map<String, dynamic>;
|
return data != null && data is Map<String, dynamic>;
|
||||||
@ -86,8 +86,6 @@ class APIResponse {
|
|||||||
*/
|
*/
|
||||||
class InvenTreeFileService extends FileService {
|
class InvenTreeFileService extends FileService {
|
||||||
|
|
||||||
HttpClient? _client;
|
|
||||||
|
|
||||||
InvenTreeFileService({HttpClient? client, bool strictHttps = false}) {
|
InvenTreeFileService({HttpClient? client, bool strictHttps = false}) {
|
||||||
_client = client ?? HttpClient();
|
_client = client ?? HttpClient();
|
||||||
|
|
||||||
@ -99,6 +97,8 @@ class InvenTreeFileService extends FileService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpClient? _client;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FileServiceResponse> get(String url,
|
Future<FileServiceResponse> get(String url,
|
||||||
{Map<String, String>? headers}) async {
|
{Map<String, String>? headers}) async {
|
||||||
@ -133,6 +133,12 @@ class InvenTreeFileService extends FileService {
|
|||||||
|
|
||||||
class InvenTreeAPI {
|
class InvenTreeAPI {
|
||||||
|
|
||||||
|
factory InvenTreeAPI() {
|
||||||
|
return _api;
|
||||||
|
}
|
||||||
|
|
||||||
|
InvenTreeAPI._internal();
|
||||||
|
|
||||||
// Minimum required API version for server
|
// Minimum required API version for server
|
||||||
static const _minApiVersion = 7;
|
static const _minApiVersion = 7;
|
||||||
|
|
||||||
@ -236,14 +242,7 @@ class InvenTreeAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we only ever create a single instance of the API class
|
// Ensure we only ever create a single instance of the API class
|
||||||
static final InvenTreeAPI _api = new InvenTreeAPI._internal();
|
static final InvenTreeAPI _api = InvenTreeAPI._internal();
|
||||||
|
|
||||||
factory InvenTreeAPI() {
|
|
||||||
return _api;
|
|
||||||
}
|
|
||||||
|
|
||||||
InvenTreeAPI._internal();
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Connect to the remote InvenTree server:
|
* Connect to the remote InvenTree server:
|
||||||
@ -481,7 +480,7 @@ class InvenTreeAPI {
|
|||||||
|
|
||||||
// Perform a PATCH request
|
// Perform a PATCH request
|
||||||
Future<APIResponse> patch(String url, {Map<String, String> body = const {}, int? expectedStatusCode}) async {
|
Future<APIResponse> patch(String url, {Map<String, String> body = const {}, int? expectedStatusCode}) async {
|
||||||
var _body = Map<String, String>();
|
Map<String, String> _body = {};
|
||||||
|
|
||||||
// Copy across provided data
|
// Copy across provided data
|
||||||
body.forEach((K, V) => _body[K] = V);
|
body.forEach((K, V) => _body[K] = V);
|
||||||
@ -939,7 +938,7 @@ class InvenTreeAPI {
|
|||||||
|
|
||||||
// Return a list of request headers
|
// Return a list of request headers
|
||||||
Map<String, String> defaultHeaders() {
|
Map<String, String> defaultHeaders() {
|
||||||
var headers = Map<String, String>();
|
Map<String, String> headers = {};
|
||||||
|
|
||||||
headers[HttpHeaders.authorizationHeader] = _authorizationHeader();
|
headers[HttpHeaders.authorizationHeader] = _authorizationHeader();
|
||||||
headers[HttpHeaders.acceptHeader] = "application/json";
|
headers[HttpHeaders.acceptHeader] = "application/json";
|
||||||
@ -983,7 +982,7 @@ class InvenTreeAPI {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return new CachedNetworkImage(
|
return CachedNetworkImage(
|
||||||
imageUrl: url,
|
imageUrl: url,
|
||||||
placeholder: (context, url) => CircularProgressIndicator(),
|
placeholder: (context, url) => CircularProgressIndicator(),
|
||||||
errorWidget: (context, url, error) => FaIcon(FontAwesomeIcons.timesCircle, color: COLOR_DANGER),
|
errorWidget: (context, url, error) => FaIcon(FontAwesomeIcons.timesCircle, color: COLOR_DANGER),
|
||||||
|
@ -209,7 +209,7 @@ class APIFormField {
|
|||||||
// Field for selecting and uploading files
|
// Field for selecting and uploading files
|
||||||
Widget _constructFileField() {
|
Widget _constructFileField() {
|
||||||
|
|
||||||
TextEditingController controller = new TextEditingController();
|
TextEditingController controller = TextEditingController();
|
||||||
|
|
||||||
controller.text = (attachedfile?.path ?? L10().attachmentSelect).split("/").last;
|
controller.text = (attachedfile?.path ?? L10().attachmentSelect).split("/").last;
|
||||||
|
|
||||||
@ -506,7 +506,7 @@ class APIFormField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TextStyle _labelStyle() {
|
TextStyle _labelStyle() {
|
||||||
return new TextStyle(
|
return TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontFamily: "arial",
|
fontFamily: "arial",
|
||||||
@ -516,7 +516,7 @@ class APIFormField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TextStyle _helperStyle() {
|
TextStyle _helperStyle() {
|
||||||
return new TextStyle(
|
return TextStyle(
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
color: hasErrors() ? COLOR_DANGER : COLOR_GRAY,
|
color: hasErrors() ? COLOR_DANGER : COLOR_GRAY,
|
||||||
);
|
);
|
||||||
@ -660,6 +660,18 @@ Future<void> launchApiForm(BuildContext context, String title, String url, Map<S
|
|||||||
|
|
||||||
class APIFormWidget extends StatefulWidget {
|
class APIFormWidget extends StatefulWidget {
|
||||||
|
|
||||||
|
APIFormWidget(
|
||||||
|
this.title,
|
||||||
|
this.url,
|
||||||
|
this.fields,
|
||||||
|
this.method,
|
||||||
|
{
|
||||||
|
Key? key,
|
||||||
|
this.onSuccess,
|
||||||
|
this.fileField = "",
|
||||||
|
}
|
||||||
|
) : super(key: key);
|
||||||
|
|
||||||
//! Form title to display
|
//! Form title to display
|
||||||
final String title;
|
final String title;
|
||||||
|
|
||||||
@ -675,18 +687,6 @@ class APIFormWidget extends StatefulWidget {
|
|||||||
|
|
||||||
Function(Map<String, dynamic>)? onSuccess;
|
Function(Map<String, dynamic>)? onSuccess;
|
||||||
|
|
||||||
APIFormWidget(
|
|
||||||
this.title,
|
|
||||||
this.url,
|
|
||||||
this.fields,
|
|
||||||
this.method,
|
|
||||||
{
|
|
||||||
Key? key,
|
|
||||||
this.onSuccess,
|
|
||||||
this.fileField = "",
|
|
||||||
}
|
|
||||||
) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_APIFormWidgetState createState() => _APIFormWidgetState(title, url, fields, method, onSuccess, fileField);
|
_APIFormWidgetState createState() => _APIFormWidgetState(title, url, fields, method, onSuccess, fileField);
|
||||||
|
|
||||||
@ -695,7 +695,9 @@ class APIFormWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _APIFormWidgetState extends State<APIFormWidget> {
|
class _APIFormWidgetState extends State<APIFormWidget> {
|
||||||
|
|
||||||
final _formKey = new GlobalKey<FormState>();
|
_APIFormWidgetState(this.title, this.url, this.fields, this.method, this.onSuccess, this.fileField) : super();
|
||||||
|
|
||||||
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
String title;
|
String title;
|
||||||
|
|
||||||
@ -709,8 +711,6 @@ class _APIFormWidgetState extends State<APIFormWidget> {
|
|||||||
|
|
||||||
Function(Map<String, dynamic>)? onSuccess;
|
Function(Map<String, dynamic>)? onSuccess;
|
||||||
|
|
||||||
_APIFormWidgetState(this.title, this.url, this.fields, this.method, this.onSuccess, this.fileField) : super();
|
|
||||||
|
|
||||||
bool spacerRequired = false;
|
bool spacerRequired = false;
|
||||||
|
|
||||||
List<Widget> _buildForm() {
|
List<Widget> _buildForm() {
|
||||||
@ -788,29 +788,36 @@ class _APIFormWidgetState extends State<APIFormWidget> {
|
|||||||
if (file != null) {
|
if (file != null) {
|
||||||
|
|
||||||
// A valid file has been supplied
|
// A valid file has been supplied
|
||||||
return await InvenTreeAPI().uploadFile(
|
final response = await InvenTreeAPI().uploadFile(
|
||||||
url,
|
url,
|
||||||
file,
|
file,
|
||||||
name: fileField,
|
name: fileField,
|
||||||
fields: data,
|
fields: data,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method == "POST") {
|
if (method == "POST") {
|
||||||
return await InvenTreeAPI().post(
|
final response = await InvenTreeAPI().post(
|
||||||
url,
|
url,
|
||||||
body: data,
|
body: data,
|
||||||
expectedStatusCode: null
|
expectedStatusCode: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return await InvenTreeAPI().patch(
|
final response = await InvenTreeAPI().patch(
|
||||||
url,
|
url,
|
||||||
body: data,
|
body: data,
|
||||||
expectedStatusCode: null
|
expectedStatusCode: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,15 @@ import "package:inventree/preferences.dart";
|
|||||||
|
|
||||||
class InvenTreeSettingsManager {
|
class InvenTreeSettingsManager {
|
||||||
|
|
||||||
|
factory InvenTreeSettingsManager() {
|
||||||
|
return _manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
InvenTreeSettingsManager._internal();
|
||||||
|
|
||||||
final store = StoreRef("settings");
|
final store = StoreRef("settings");
|
||||||
|
|
||||||
Future<Database> get _db async => await InvenTreePreferencesDB.instance.database;
|
Future<Database> get _db async => InvenTreePreferencesDB.instance.database;
|
||||||
|
|
||||||
Future<dynamic> getValue(String key, dynamic backup) async {
|
Future<dynamic> getValue(String key, dynamic backup) async {
|
||||||
|
|
||||||
@ -39,11 +45,5 @@ class InvenTreeSettingsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we only ever create a single instance of this class
|
// Ensure we only ever create a single instance of this class
|
||||||
static final InvenTreeSettingsManager _manager = new InvenTreeSettingsManager._internal();
|
static final InvenTreeSettingsManager _manager = InvenTreeSettingsManager._internal();
|
||||||
|
}
|
||||||
factory InvenTreeSettingsManager() {
|
|
||||||
return _manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
InvenTreeSettingsManager._internal();
|
|
||||||
}
|
|
||||||
|
@ -32,21 +32,21 @@ class BarcodeHandler {
|
|||||||
* based on the response returned from the InvenTree server
|
* based on the response returned from the InvenTree server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
String getOverlayText(BuildContext context) => "Barcode Overlay";
|
BarcodeHandler();
|
||||||
|
|
||||||
BarcodeHandler();
|
String getOverlayText(BuildContext context) => "Barcode Overlay";
|
||||||
|
|
||||||
QRViewController? _controller;
|
QRViewController? _controller;
|
||||||
|
|
||||||
Future<void> successTone() async {
|
Future<void> successTone() async {
|
||||||
|
|
||||||
final bool en = await InvenTreeSettingsManager().getValue("barcodeSounds", true) as bool;
|
final bool en = await InvenTreeSettingsManager().getValue("barcodeSounds", true) as bool;
|
||||||
|
|
||||||
if (en) {
|
if (en) {
|
||||||
final player = AudioCache();
|
final player = AudioCache();
|
||||||
player.play("sounds/barcode_scan.mp3");
|
player.play("sounds/barcode_scan.mp3");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future <void> failureTone() async {
|
Future <void> failureTone() async {
|
||||||
|
|
||||||
@ -266,10 +266,10 @@ class StockItemBarcodeAssignmentHandler extends BarcodeHandler {
|
|||||||
* Barcode handler for assigning a new barcode to a stock item
|
* Barcode handler for assigning a new barcode to a stock item
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final InvenTreeStockItem item;
|
|
||||||
|
|
||||||
StockItemBarcodeAssignmentHandler(this.item);
|
StockItemBarcodeAssignmentHandler(this.item);
|
||||||
|
|
||||||
|
final InvenTreeStockItem item;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getOverlayText(BuildContext context) => L10().barcodeScanAssign;
|
String getOverlayText(BuildContext context) => L10().barcodeScanAssign;
|
||||||
|
|
||||||
@ -334,10 +334,10 @@ class StockItemScanIntoLocationHandler extends BarcodeHandler {
|
|||||||
* Barcode handler for scanning a provided StockItem into a scanned StockLocation
|
* Barcode handler for scanning a provided StockItem into a scanned StockLocation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final InvenTreeStockItem item;
|
|
||||||
|
|
||||||
StockItemScanIntoLocationHandler(this.item);
|
StockItemScanIntoLocationHandler(this.item);
|
||||||
|
|
||||||
|
final InvenTreeStockItem item;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getOverlayText(BuildContext context) => L10().barcodeScanLocation;
|
String getOverlayText(BuildContext context) => L10().barcodeScanLocation;
|
||||||
|
|
||||||
@ -396,11 +396,11 @@ class StockLocationScanInItemsHandler extends BarcodeHandler {
|
|||||||
/*
|
/*
|
||||||
* Barcode handler for scanning stock item(s) into the specified StockLocation
|
* Barcode handler for scanning stock item(s) into the specified StockLocation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final InvenTreeStockLocation location;
|
|
||||||
|
|
||||||
StockLocationScanInItemsHandler(this.location);
|
StockLocationScanInItemsHandler(this.location);
|
||||||
|
|
||||||
|
final InvenTreeStockLocation location;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getOverlayText(BuildContext context) => L10().barcodeScanItem;
|
String getOverlayText(BuildContext context) => L10().barcodeScanItem;
|
||||||
|
|
||||||
@ -466,10 +466,10 @@ class StockLocationScanInItemsHandler extends BarcodeHandler {
|
|||||||
|
|
||||||
class InvenTreeQRView extends StatefulWidget {
|
class InvenTreeQRView extends StatefulWidget {
|
||||||
|
|
||||||
final BarcodeHandler _handler;
|
|
||||||
|
|
||||||
const InvenTreeQRView(this._handler, {Key? key}) : super(key: key);
|
const InvenTreeQRView(this._handler, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
final BarcodeHandler _handler;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => _QRViewState(_handler);
|
State<StatefulWidget> createState() => _QRViewState(_handler);
|
||||||
}
|
}
|
||||||
@ -477,6 +477,8 @@ class InvenTreeQRView extends StatefulWidget {
|
|||||||
|
|
||||||
class _QRViewState extends State<InvenTreeQRView> {
|
class _QRViewState extends State<InvenTreeQRView> {
|
||||||
|
|
||||||
|
_QRViewState(this._handler) : super();
|
||||||
|
|
||||||
final GlobalKey qrKey = GlobalKey(debugLabel: "QR");
|
final GlobalKey qrKey = GlobalKey(debugLabel: "QR");
|
||||||
|
|
||||||
QRViewController? _controller;
|
QRViewController? _controller;
|
||||||
@ -496,8 +498,6 @@ class _QRViewState extends State<InvenTreeQRView> {
|
|||||||
_controller!.resumeCamera();
|
_controller!.resumeCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
_QRViewState(this._handler) : super();
|
|
||||||
|
|
||||||
void _onViewCreated(BuildContext context, QRViewController controller) {
|
void _onViewCreated(BuildContext context, QRViewController controller) {
|
||||||
_controller = controller;
|
_controller = controller;
|
||||||
controller.scannedDataStream.listen((barcode) {
|
controller.scannedDataStream.listen((barcode) {
|
||||||
|
@ -10,6 +10,8 @@ class InvenTreeCompany extends InvenTreeModel {
|
|||||||
|
|
||||||
InvenTreeCompany() : super();
|
InvenTreeCompany() : super();
|
||||||
|
|
||||||
|
InvenTreeCompany.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get URL => "company/";
|
String get URL => "company/";
|
||||||
|
|
||||||
@ -42,8 +44,6 @@ class InvenTreeCompany extends InvenTreeModel {
|
|||||||
|
|
||||||
bool get isCustomer => (jsondata["is_customer"] ?? false) as bool;
|
bool get isCustomer => (jsondata["is_customer"] ?? false) as bool;
|
||||||
|
|
||||||
InvenTreeCompany.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||||
var company = InvenTreeCompany.fromJson(json);
|
var company = InvenTreeCompany.fromJson(json);
|
||||||
@ -57,6 +57,11 @@ class InvenTreeCompany extends InvenTreeModel {
|
|||||||
* The InvenTreeSupplierPart class represents the SupplierPart model in the InvenTree database
|
* The InvenTreeSupplierPart class represents the SupplierPart model in the InvenTree database
|
||||||
*/
|
*/
|
||||||
class InvenTreeSupplierPart extends InvenTreeModel {
|
class InvenTreeSupplierPart extends InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreeSupplierPart() : super();
|
||||||
|
|
||||||
|
InvenTreeSupplierPart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get URL => "company/part/";
|
String get URL => "company/part/";
|
||||||
|
|
||||||
@ -78,10 +83,6 @@ class InvenTreeSupplierPart extends InvenTreeModel {
|
|||||||
return _filters();
|
return _filters();
|
||||||
}
|
}
|
||||||
|
|
||||||
InvenTreeSupplierPart() : super();
|
|
||||||
|
|
||||||
InvenTreeSupplierPart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
|
||||||
|
|
||||||
int get manufacturerId => (jsondata["manufacturer"] ?? -1) as int;
|
int get manufacturerId => (jsondata["manufacturer"] ?? -1) as int;
|
||||||
|
|
||||||
String get manufacturerName => (jsondata["manufacturer_detail"]["name"] ?? "") as String;
|
String get manufacturerName => (jsondata["manufacturer_detail"]["name"] ?? "") as String;
|
||||||
@ -117,6 +118,10 @@ class InvenTreeSupplierPart extends InvenTreeModel {
|
|||||||
|
|
||||||
class InvenTreeManufacturerPart extends InvenTreeModel {
|
class InvenTreeManufacturerPart extends InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreeManufacturerPart() : super();
|
||||||
|
|
||||||
|
InvenTreeManufacturerPart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String url = "company/part/manufacturer/";
|
String url = "company/part/manufacturer/";
|
||||||
|
|
||||||
@ -127,10 +132,6 @@ class InvenTreeManufacturerPart extends InvenTreeModel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
InvenTreeManufacturerPart() : super();
|
|
||||||
|
|
||||||
InvenTreeManufacturerPart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
|
||||||
|
|
||||||
int get partId => (jsondata["part"] ?? -1) as int;
|
int get partId => (jsondata["part"] ?? -1) as int;
|
||||||
|
|
||||||
int get manufacturerId => (jsondata["manufacturer"] ?? -1) as int;
|
int get manufacturerId => (jsondata["manufacturer"] ?? -1) as int;
|
||||||
|
@ -39,6 +39,11 @@ class InvenTreePageResponse {
|
|||||||
*/
|
*/
|
||||||
class InvenTreeModel {
|
class InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreeModel();
|
||||||
|
|
||||||
|
// Construct an InvenTreeModel from a JSON data object
|
||||||
|
InvenTreeModel.fromJson(this.jsondata);
|
||||||
|
|
||||||
// Override the endpoint URL for each subclass
|
// Override the endpoint URL for each subclass
|
||||||
String get URL => "";
|
String get URL => "";
|
||||||
|
|
||||||
@ -115,19 +120,6 @@ class InvenTreeModel {
|
|||||||
// Accessor for the API
|
// Accessor for the API
|
||||||
var api = InvenTreeAPI();
|
var api = InvenTreeAPI();
|
||||||
|
|
||||||
// Default empty object constructor
|
|
||||||
InvenTreeModel() {
|
|
||||||
jsondata.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct an InvenTreeModel from a JSON data object
|
|
||||||
InvenTreeModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
|
|
||||||
// Store the json object
|
|
||||||
jsondata = json;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int get pk => (jsondata["pk"] ?? -1) as int;
|
int get pk => (jsondata["pk"] ?? -1) as int;
|
||||||
|
|
||||||
// Some common accessors
|
// Some common accessors
|
||||||
@ -185,10 +177,14 @@ class InvenTreeModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> defaultListFilters() { return Map<String, String>(); }
|
Map<String, String> defaultListFilters() {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
// A map of "default" headers to use when performing a GET request
|
// A map of "default" headers to use when performing a GET request
|
||||||
Map<String, String> defaultGetFilters() { return Map<String, String>(); }
|
Map<String, String> defaultGetFilters() {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reload this object, by requesting data from the server
|
* Reload this object, by requesting data from the server
|
||||||
@ -357,7 +353,7 @@ class InvenTreeModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct the response
|
// Construct the response
|
||||||
InvenTreePageResponse page = new InvenTreePageResponse();
|
InvenTreePageResponse page = InvenTreePageResponse();
|
||||||
|
|
||||||
var data = response.asMap();
|
var data = response.asMap();
|
||||||
|
|
||||||
@ -458,9 +454,10 @@ class InvenTreeModel {
|
|||||||
|
|
||||||
class InvenTreeAttachment extends InvenTreeModel {
|
class InvenTreeAttachment extends InvenTreeModel {
|
||||||
// Class representing an "attachment" file
|
// Class representing an "attachment" file
|
||||||
|
|
||||||
InvenTreeAttachment() : super();
|
InvenTreeAttachment() : super();
|
||||||
|
|
||||||
|
InvenTreeAttachment.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
String get attachment => (jsondata["attachment"] ?? "") as String;
|
String get attachment => (jsondata["attachment"] ?? "") as String;
|
||||||
|
|
||||||
// Return the filename of the attachment
|
// Return the filename of the attachment
|
||||||
@ -509,8 +506,6 @@ class InvenTreeAttachment extends InvenTreeModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InvenTreeAttachment.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
|
||||||
|
|
||||||
Future<bool> uploadAttachment(File attachment, {String comment = "", Map<String, String> fields = const {}}) async {
|
Future<bool> uploadAttachment(File attachment, {String comment = "", Map<String, String> fields = const {}}) async {
|
||||||
|
|
||||||
final APIResponse response = await InvenTreeAPI().uploadFile(
|
final APIResponse response = await InvenTreeAPI().uploadFile(
|
||||||
|
@ -10,6 +10,10 @@ import "model.dart";
|
|||||||
|
|
||||||
class InvenTreePartCategory extends InvenTreeModel {
|
class InvenTreePartCategory extends InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreePartCategory() : super();
|
||||||
|
|
||||||
|
InvenTreePartCategory.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get URL => "part/category/";
|
String get URL => "part/category/";
|
||||||
|
|
||||||
@ -25,12 +29,11 @@ class InvenTreePartCategory extends InvenTreeModel {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, String> defaultListFilters() {
|
Map<String, String> defaultListFilters() {
|
||||||
var filters = new Map<String, String>();
|
|
||||||
|
|
||||||
filters["active"] = "true";
|
return {
|
||||||
filters["cascade"] = "false";
|
"active": "true",
|
||||||
|
"cascade": "false"
|
||||||
return filters;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
String get pathstring => (jsondata["pathstring"] ?? "") as String;
|
String get pathstring => (jsondata["pathstring"] ?? "") as String;
|
||||||
@ -54,10 +57,6 @@ class InvenTreePartCategory extends InvenTreeModel {
|
|||||||
|
|
||||||
int get partcount => (jsondata["parts"] ?? 0) as int;
|
int get partcount => (jsondata["parts"] ?? 0) as int;
|
||||||
|
|
||||||
InvenTreePartCategory() : super();
|
|
||||||
|
|
||||||
InvenTreePartCategory.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||||
var cat = InvenTreePartCategory.fromJson(json);
|
var cat = InvenTreePartCategory.fromJson(json);
|
||||||
@ -71,6 +70,10 @@ class InvenTreePartCategory extends InvenTreeModel {
|
|||||||
|
|
||||||
class InvenTreePartTestTemplate extends InvenTreeModel {
|
class InvenTreePartTestTemplate extends InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreePartTestTemplate() : super();
|
||||||
|
|
||||||
|
InvenTreePartTestTemplate.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get URL => "part/test-template/";
|
String get URL => "part/test-template/";
|
||||||
|
|
||||||
@ -84,10 +87,6 @@ class InvenTreePartTestTemplate extends InvenTreeModel {
|
|||||||
|
|
||||||
bool get requiresAttachment => (jsondata["requires_attachment"] ?? false) as bool;
|
bool get requiresAttachment => (jsondata["requires_attachment"] ?? false) as bool;
|
||||||
|
|
||||||
InvenTreePartTestTemplate() : super();
|
|
||||||
|
|
||||||
InvenTreePartTestTemplate.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||||
var template = InvenTreePartTestTemplate.fromJson(json);
|
var template = InvenTreePartTestTemplate.fromJson(json);
|
||||||
@ -123,6 +122,10 @@ class InvenTreePartTestTemplate extends InvenTreeModel {
|
|||||||
|
|
||||||
class InvenTreePart extends InvenTreeModel {
|
class InvenTreePart extends InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreePart() : super();
|
||||||
|
|
||||||
|
InvenTreePart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get URL => "part/";
|
String get URL => "part/";
|
||||||
|
|
||||||
@ -377,12 +380,6 @@ class InvenTreePart extends InvenTreeModel {
|
|||||||
// Return the "starred" status of this part
|
// Return the "starred" status of this part
|
||||||
bool get starred => (jsondata["starred"] ?? false) as bool;
|
bool get starred => (jsondata["starred"] ?? false) as bool;
|
||||||
|
|
||||||
InvenTreePart() : super();
|
|
||||||
|
|
||||||
InvenTreePart.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||||
|
|
||||||
@ -397,11 +394,11 @@ class InvenTreePartAttachment extends InvenTreeAttachment {
|
|||||||
|
|
||||||
InvenTreePartAttachment() : super();
|
InvenTreePartAttachment() : super();
|
||||||
|
|
||||||
|
InvenTreePartAttachment.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get URL => "part/attachment/";
|
String get URL => "part/attachment/";
|
||||||
|
|
||||||
InvenTreePartAttachment.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||||
return InvenTreePartAttachment.fromJson(json);
|
return InvenTreePartAttachment.fromJson(json);
|
||||||
|
@ -13,6 +13,10 @@ const int PO_STATUS_RETURNED = 60;
|
|||||||
|
|
||||||
class InvenTreePurchaseOrder extends InvenTreeModel {
|
class InvenTreePurchaseOrder extends InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreePurchaseOrder() : super();
|
||||||
|
|
||||||
|
InvenTreePurchaseOrder.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get URL => "order/po/";
|
String get URL => "order/po/";
|
||||||
|
|
||||||
@ -28,8 +32,6 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
InvenTreePurchaseOrder() : super();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, String> defaultGetFilters() {
|
Map<String, String> defaultGetFilters() {
|
||||||
return {
|
return {
|
||||||
@ -102,8 +104,6 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
InvenTreePurchaseOrder.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||||
return InvenTreePurchaseOrder.fromJson(json);
|
return InvenTreePurchaseOrder.fromJson(json);
|
||||||
@ -111,6 +111,11 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class InvenTreePOLineItem extends InvenTreeModel {
|
class InvenTreePOLineItem extends InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreePOLineItem() : super();
|
||||||
|
|
||||||
|
InvenTreePOLineItem.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get URL => "order/po-line/";
|
String get URL => "order/po-line/";
|
||||||
|
|
||||||
@ -189,11 +194,6 @@ class InvenTreePOLineItem extends InvenTreeModel {
|
|||||||
|
|
||||||
Map<String, dynamic> get destinationDetail => (jsondata["destination_detail"] ?? {}) as Map<String, dynamic>;
|
Map<String, dynamic> get destinationDetail => (jsondata["destination_detail"] ?? {}) as Map<String, dynamic>;
|
||||||
|
|
||||||
InvenTreePOLineItem() : super();
|
|
||||||
|
|
||||||
InvenTreePOLineItem.fromJson(Map<String, dynamic> json)
|
|
||||||
: super.fromJson(json);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||||
return InvenTreePOLineItem.fromJson(json);
|
return InvenTreePOLineItem.fromJson(json);
|
||||||
|
@ -12,6 +12,10 @@ import "package:inventree/api.dart";
|
|||||||
|
|
||||||
class InvenTreeStockItemTestResult extends InvenTreeModel {
|
class InvenTreeStockItemTestResult extends InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreeStockItemTestResult() : super();
|
||||||
|
|
||||||
|
InvenTreeStockItemTestResult.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get URL => "stock/test/";
|
String get URL => "stock/test/";
|
||||||
|
|
||||||
@ -41,10 +45,6 @@ class InvenTreeStockItemTestResult extends InvenTreeModel {
|
|||||||
|
|
||||||
String get date => (jsondata["date"] ?? "") as String;
|
String get date => (jsondata["date"] ?? "") as String;
|
||||||
|
|
||||||
InvenTreeStockItemTestResult() : super();
|
|
||||||
|
|
||||||
InvenTreeStockItemTestResult.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvenTreeStockItemTestResult createFromJson(Map<String, dynamic> json) {
|
InvenTreeStockItemTestResult createFromJson(Map<String, dynamic> json) {
|
||||||
var result = InvenTreeStockItemTestResult.fromJson(json);
|
var result = InvenTreeStockItemTestResult.fromJson(json);
|
||||||
@ -56,6 +56,10 @@ class InvenTreeStockItemTestResult extends InvenTreeModel {
|
|||||||
|
|
||||||
class InvenTreeStockItem extends InvenTreeModel {
|
class InvenTreeStockItem extends InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreeStockItem() : super();
|
||||||
|
|
||||||
|
InvenTreeStockItem.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
// Stock status codes
|
// Stock status codes
|
||||||
static const int OK = 10;
|
static const int OK = 10;
|
||||||
static const int ATTENTION = 50;
|
static const int ATTENTION = 50;
|
||||||
@ -128,33 +132,23 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||||||
@override
|
@override
|
||||||
Map<String, String> defaultGetFilters() {
|
Map<String, String> defaultGetFilters() {
|
||||||
|
|
||||||
var headers = new Map<String, String>();
|
return {
|
||||||
|
"part_detail": "true",
|
||||||
headers["part_detail"] = "true";
|
"location_detail": "true",
|
||||||
headers["location_detail"] = "true";
|
"supplier_detail": "true",
|
||||||
headers["supplier_detail"] = "true";
|
"cascade": "false"
|
||||||
headers["cascade"] = "false";
|
};
|
||||||
|
|
||||||
return headers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, String> defaultListFilters() {
|
Map<String, String> defaultListFilters() {
|
||||||
|
|
||||||
var headers = new Map<String, String>();
|
return {
|
||||||
|
"part_detail": "true",
|
||||||
headers["part_detail"] = "true";
|
"location_detail": "true",
|
||||||
headers["location_detail"] = "true";
|
"supplier_detail": "true",
|
||||||
headers["supplier_detail"] = "true";
|
"cascade": "false"
|
||||||
headers["cascade"] = "false";
|
};
|
||||||
|
|
||||||
return headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
InvenTreeStockItem() : super();
|
|
||||||
|
|
||||||
InvenTreeStockItem.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<InvenTreePartTestTemplate> testTemplates = [];
|
List<InvenTreePartTestTemplate> testTemplates = [];
|
||||||
@ -533,6 +527,10 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||||||
|
|
||||||
class InvenTreeStockLocation extends InvenTreeModel {
|
class InvenTreeStockLocation extends InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreeStockLocation() : super();
|
||||||
|
|
||||||
|
InvenTreeStockLocation.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get URL => "stock/location/";
|
String get URL => "stock/location/";
|
||||||
|
|
||||||
@ -566,10 +564,6 @@ class InvenTreeStockLocation extends InvenTreeModel {
|
|||||||
|
|
||||||
int get itemcount => (jsondata["items"] ?? 0) as int;
|
int get itemcount => (jsondata["items"] ?? 0) as int;
|
||||||
|
|
||||||
InvenTreeStockLocation() : super();
|
|
||||||
|
|
||||||
InvenTreeStockLocation.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ import "package:path/path.dart";
|
|||||||
*/
|
*/
|
||||||
class InvenTreePreferencesDB {
|
class InvenTreePreferencesDB {
|
||||||
|
|
||||||
|
InvenTreePreferencesDB._();
|
||||||
|
|
||||||
static final InvenTreePreferencesDB _singleton = InvenTreePreferencesDB._();
|
static final InvenTreePreferencesDB _singleton = InvenTreePreferencesDB._();
|
||||||
|
|
||||||
static InvenTreePreferencesDB get instance => _singleton;
|
static InvenTreePreferencesDB get instance => _singleton;
|
||||||
|
|
||||||
InvenTreePreferencesDB._();
|
|
||||||
|
|
||||||
Completer<Database> _dbOpenCompleter = Completer();
|
Completer<Database> _dbOpenCompleter = Completer();
|
||||||
|
|
||||||
bool isOpen = false;
|
bool isOpen = false;
|
||||||
@ -56,6 +56,12 @@ class InvenTreePreferencesDB {
|
|||||||
|
|
||||||
class InvenTreePreferences {
|
class InvenTreePreferences {
|
||||||
|
|
||||||
|
factory InvenTreePreferences() {
|
||||||
|
return _api;
|
||||||
|
}
|
||||||
|
|
||||||
|
InvenTreePreferences._internal();
|
||||||
|
|
||||||
/* The following settings are not stored to persistent storage,
|
/* The following settings are not stored to persistent storage,
|
||||||
* instead they are only used as "session preferences".
|
* instead they are only used as "session preferences".
|
||||||
* They are kept here as a convenience only.
|
* They are kept here as a convenience only.
|
||||||
@ -74,11 +80,6 @@ class InvenTreePreferences {
|
|||||||
bool expandStockList = true;
|
bool expandStockList = true;
|
||||||
|
|
||||||
// Ensure we only ever create a single instance of the preferences class
|
// Ensure we only ever create a single instance of the preferences class
|
||||||
static final InvenTreePreferences _api = new InvenTreePreferences._internal();
|
static final InvenTreePreferences _api = InvenTreePreferences._internal();
|
||||||
|
|
||||||
factory InvenTreePreferences() {
|
|
||||||
return _api;
|
|
||||||
}
|
|
||||||
|
|
||||||
InvenTreePreferences._internal();
|
|
||||||
}
|
}
|
@ -12,10 +12,10 @@ import "package:inventree/l10.dart";
|
|||||||
|
|
||||||
class InvenTreeAboutWidget extends StatelessWidget {
|
class InvenTreeAboutWidget extends StatelessWidget {
|
||||||
|
|
||||||
final PackageInfo info;
|
|
||||||
|
|
||||||
const InvenTreeAboutWidget(this.info) : super();
|
const InvenTreeAboutWidget(this.info) : super();
|
||||||
|
|
||||||
|
final PackageInfo info;
|
||||||
|
|
||||||
Future <void> _releaseNotes(BuildContext context) async {
|
Future <void> _releaseNotes(BuildContext context) async {
|
||||||
|
|
||||||
// Load release notes from external file
|
// Load release notes from external file
|
||||||
|
@ -15,10 +15,10 @@ class InvenTreeAppSettingsWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _InvenTreeAppSettingsState extends State<InvenTreeAppSettingsWidget> {
|
class _InvenTreeAppSettingsState extends State<InvenTreeAppSettingsWidget> {
|
||||||
|
|
||||||
final GlobalKey<_InvenTreeAppSettingsState> _settingsKey = GlobalKey<_InvenTreeAppSettingsState>();
|
|
||||||
|
|
||||||
_InvenTreeAppSettingsState();
|
_InvenTreeAppSettingsState();
|
||||||
|
|
||||||
|
final GlobalKey<_InvenTreeAppSettingsState> _settingsKey = GlobalKey<_InvenTreeAppSettingsState>();
|
||||||
|
|
||||||
bool barcodeSounds = true;
|
bool barcodeSounds = true;
|
||||||
bool serverSounds = true;
|
bool serverSounds = true;
|
||||||
bool partSubcategory = false;
|
bool partSubcategory = false;
|
||||||
|
@ -17,14 +17,14 @@ class InvenTreeLoginSettingsWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
|
class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
|
||||||
|
|
||||||
final GlobalKey<_InvenTreeLoginSettingsState> _loginKey = GlobalKey<_InvenTreeLoginSettingsState>();
|
|
||||||
|
|
||||||
List<UserProfile> profiles = [];
|
|
||||||
|
|
||||||
_InvenTreeLoginSettingsState() {
|
_InvenTreeLoginSettingsState() {
|
||||||
_reload();
|
_reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final GlobalKey<_InvenTreeLoginSettingsState> _loginKey = GlobalKey<_InvenTreeLoginSettingsState>();
|
||||||
|
|
||||||
|
List<UserProfile> profiles = [];
|
||||||
|
|
||||||
Future <void> _reload() async {
|
Future <void> _reload() async {
|
||||||
|
|
||||||
profiles = await UserProfileDBManager().getAllProfiles();
|
profiles = await UserProfileDBManager().getAllProfiles();
|
||||||
@ -237,21 +237,21 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
|
|||||||
|
|
||||||
class ProfileEditWidget extends StatefulWidget {
|
class ProfileEditWidget extends StatefulWidget {
|
||||||
|
|
||||||
UserProfile? profile;
|
|
||||||
|
|
||||||
ProfileEditWidget(this.profile) : super();
|
ProfileEditWidget(this.profile) : super();
|
||||||
|
|
||||||
|
UserProfile? profile;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_ProfileEditState createState() => _ProfileEditState(profile);
|
_ProfileEditState createState() => _ProfileEditState(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ProfileEditState extends State<ProfileEditWidget> {
|
class _ProfileEditState extends State<ProfileEditWidget> {
|
||||||
|
|
||||||
UserProfile? profile;
|
|
||||||
|
|
||||||
_ProfileEditState(this.profile) : super();
|
_ProfileEditState(this.profile) : super();
|
||||||
|
|
||||||
final formKey = new GlobalKey<FormState>();
|
UserProfile? profile;
|
||||||
|
|
||||||
|
final formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
String name = "";
|
String name = "";
|
||||||
String server = "";
|
String server = "";
|
||||||
@ -359,7 +359,7 @@ class _ProfileEditState extends State<ProfileEditWidget> {
|
|||||||
|
|
||||||
if (uri.hasScheme) {
|
if (uri.hasScheme) {
|
||||||
print("Scheme: ${uri.scheme}");
|
print("Scheme: ${uri.scheme}");
|
||||||
if (!(["http", "https"].contains(uri.scheme.toLowerCase()))) {
|
if (!["http", "https"].contains(uri.scheme.toLowerCase())) {
|
||||||
return L10().serverStart;
|
return L10().serverStart;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -6,10 +6,10 @@ import "package:inventree/l10.dart";
|
|||||||
|
|
||||||
class ReleaseNotesWidget extends StatelessWidget {
|
class ReleaseNotesWidget extends StatelessWidget {
|
||||||
|
|
||||||
final String releaseNotes;
|
|
||||||
|
|
||||||
const ReleaseNotesWidget(this.releaseNotes);
|
const ReleaseNotesWidget(this.releaseNotes);
|
||||||
|
|
||||||
|
final String releaseNotes;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build (BuildContext context) {
|
Widget build (BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -27,10 +27,10 @@ class ReleaseNotesWidget extends StatelessWidget {
|
|||||||
|
|
||||||
class CreditsWidget extends StatelessWidget {
|
class CreditsWidget extends StatelessWidget {
|
||||||
|
|
||||||
final String credits;
|
|
||||||
|
|
||||||
const CreditsWidget(this.credits);
|
const CreditsWidget(this.credits);
|
||||||
|
|
||||||
|
final String credits;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build (BuildContext context) {
|
Widget build (BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -16,6 +16,15 @@ class UserProfile {
|
|||||||
this.selected = false,
|
this.selected = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
factory UserProfile.fromJson(int key, Map<String, dynamic> json, bool isSelected) => UserProfile(
|
||||||
|
key: key,
|
||||||
|
name: json["name"] as String,
|
||||||
|
server: json["server"] as String,
|
||||||
|
username: json["username"] as String,
|
||||||
|
password: json["password"] as String,
|
||||||
|
selected: isSelected,
|
||||||
|
);
|
||||||
|
|
||||||
// ID of the profile
|
// ID of the profile
|
||||||
int? key;
|
int? key;
|
||||||
|
|
||||||
@ -36,15 +45,6 @@ class UserProfile {
|
|||||||
// User ID (will be provided by the server on log-in)
|
// User ID (will be provided by the server on log-in)
|
||||||
int user_id = -1;
|
int user_id = -1;
|
||||||
|
|
||||||
factory UserProfile.fromJson(int key, Map<String, dynamic> json, bool isSelected) => UserProfile(
|
|
||||||
key: key,
|
|
||||||
name: json["name"] as String,
|
|
||||||
server: json["server"] as String,
|
|
||||||
username: json["username"] as String,
|
|
||||||
password: json["password"] as String,
|
|
||||||
selected: isSelected,
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"name": name,
|
"name": name,
|
||||||
"server": server,
|
"server": server,
|
||||||
@ -62,7 +62,7 @@ class UserProfileDBManager {
|
|||||||
|
|
||||||
final store = StoreRef("profiles");
|
final store = StoreRef("profiles");
|
||||||
|
|
||||||
Future<Database> get _db async => await InvenTreePreferencesDB.instance.database;
|
Future<Database> get _db async => InvenTreePreferencesDB.instance.database;
|
||||||
|
|
||||||
Future<bool> profileNameExists(String name) async {
|
Future<bool> profileNameExists(String name) async {
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ class CategoryDisplayWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
||||||
|
|
||||||
|
_CategoryDisplayState(this.category);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) => L10().partCategory;
|
String getAppBarTitle(BuildContext context) => L10().partCategory;
|
||||||
@ -74,8 +75,6 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_CategoryDisplayState(this.category);
|
|
||||||
|
|
||||||
// The local InvenTreePartCategory object
|
// The local InvenTreePartCategory object
|
||||||
final InvenTreePartCategory? category;
|
final InvenTreePartCategory? category;
|
||||||
|
|
||||||
@ -350,10 +349,11 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
* Builder for displaying a list of PartCategory objects
|
* Builder for displaying a list of PartCategory objects
|
||||||
*/
|
*/
|
||||||
class SubcategoryList extends StatelessWidget {
|
class SubcategoryList extends StatelessWidget {
|
||||||
final List<InvenTreePartCategory> _categories;
|
|
||||||
|
|
||||||
const SubcategoryList(this._categories);
|
const SubcategoryList(this._categories);
|
||||||
|
|
||||||
|
final List<InvenTreePartCategory> _categories;
|
||||||
|
|
||||||
void _openCategory(BuildContext context, int pk) {
|
void _openCategory(BuildContext context, int pk) {
|
||||||
|
|
||||||
// Attempt to load the sub-category.
|
// Attempt to load the sub-category.
|
||||||
@ -397,12 +397,12 @@ class SubcategoryList extends StatelessWidget {
|
|||||||
|
|
||||||
class PaginatedPartList extends StatefulWidget {
|
class PaginatedPartList extends StatefulWidget {
|
||||||
|
|
||||||
|
PaginatedPartList(this.filters, {this.onTotalChanged});
|
||||||
|
|
||||||
final Map<String, String> filters;
|
final Map<String, String> filters;
|
||||||
|
|
||||||
Function(int)? onTotalChanged;
|
Function(int)? onTotalChanged;
|
||||||
|
|
||||||
PaginatedPartList(this.filters, {this.onTotalChanged});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_PaginatedPartListState createState() => _PaginatedPartListState(filters, onTotalChanged);
|
_PaginatedPartListState createState() => _PaginatedPartListState(filters, onTotalChanged);
|
||||||
}
|
}
|
||||||
@ -410,6 +410,8 @@ class PaginatedPartList extends StatefulWidget {
|
|||||||
|
|
||||||
class _PaginatedPartListState extends State<PaginatedPartList> {
|
class _PaginatedPartListState extends State<PaginatedPartList> {
|
||||||
|
|
||||||
|
_PaginatedPartListState(this.filters, this.onTotalChanged);
|
||||||
|
|
||||||
static const _pageSize = 25;
|
static const _pageSize = 25;
|
||||||
|
|
||||||
String _searchTerm = "";
|
String _searchTerm = "";
|
||||||
@ -418,8 +420,6 @@ class _PaginatedPartListState extends State<PaginatedPartList> {
|
|||||||
|
|
||||||
final Map<String, String> filters;
|
final Map<String, String> filters;
|
||||||
|
|
||||||
_PaginatedPartListState(this.filters, this.onTotalChanged);
|
|
||||||
|
|
||||||
final PagingController<int, InvenTreePart> _pagingController = PagingController(firstPageKey: 0);
|
final PagingController<int, InvenTreePart> _pagingController = PagingController(firstPageKey: 0);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -10,10 +10,10 @@ import "package:inventree/l10.dart";
|
|||||||
|
|
||||||
class CompanyDetailWidget extends StatefulWidget {
|
class CompanyDetailWidget extends StatefulWidget {
|
||||||
|
|
||||||
final InvenTreeCompany company;
|
|
||||||
|
|
||||||
const CompanyDetailWidget(this.company, {Key? key}) : super(key: key);
|
const CompanyDetailWidget(this.company, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
final InvenTreeCompany company;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_CompanyDetailState createState() => _CompanyDetailState(company);
|
_CompanyDetailState createState() => _CompanyDetailState(company);
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@ import "package:font_awesome_flutter/font_awesome_flutter.dart";
|
|||||||
|
|
||||||
class InvenTreeDrawer extends StatelessWidget {
|
class InvenTreeDrawer extends StatelessWidget {
|
||||||
|
|
||||||
final BuildContext context;
|
|
||||||
|
|
||||||
const InvenTreeDrawer(this.context);
|
const InvenTreeDrawer(this.context);
|
||||||
|
|
||||||
|
final BuildContext context;
|
||||||
|
|
||||||
void _closeDrawer() {
|
void _closeDrawer() {
|
||||||
// Close the drawer
|
// Close the drawer
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
@ -31,14 +31,14 @@ class InvenTreeHomePage extends StatefulWidget {
|
|||||||
|
|
||||||
class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
||||||
|
|
||||||
final GlobalKey<_InvenTreeHomePageState> _homeKey = GlobalKey<_InvenTreeHomePageState>();
|
|
||||||
|
|
||||||
_InvenTreeHomePageState() : super() {
|
_InvenTreeHomePageState() : super() {
|
||||||
|
|
||||||
// Initially load the profile and attempt server connection
|
// Initially load the profile and attempt server connection
|
||||||
_loadProfile();
|
_loadProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final GlobalKey<_InvenTreeHomePageState> _homeKey = GlobalKey<_InvenTreeHomePageState>();
|
||||||
|
|
||||||
// Selected user profile
|
// Selected user profile
|
||||||
UserProfile? _profile;
|
UserProfile? _profile;
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(L10().appTitle),
|
title: Text(L10().appTitle),
|
||||||
),
|
),
|
||||||
drawer: new InvenTreeDrawer(context),
|
drawer: InvenTreeDrawer(context),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
physics: ClampingScrollPhysics(),
|
physics: ClampingScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
|
@ -31,6 +31,8 @@ class LocationDisplayWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
||||||
|
|
||||||
|
_LocationDisplayState(this.location);
|
||||||
|
|
||||||
final InvenTreeStockLocation? location;
|
final InvenTreeStockLocation? location;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -92,8 +94,6 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_LocationDisplayState(this.location);
|
|
||||||
|
|
||||||
List<InvenTreeStockLocation> _sublocations = [];
|
List<InvenTreeStockLocation> _sublocations = [];
|
||||||
|
|
||||||
String _locationFilter = "";
|
String _locationFilter = "";
|
||||||
@ -428,10 +428,11 @@ List<Widget> detailTiles() {
|
|||||||
|
|
||||||
|
|
||||||
class SublocationList extends StatelessWidget {
|
class SublocationList extends StatelessWidget {
|
||||||
final List<InvenTreeStockLocation> _locations;
|
|
||||||
|
|
||||||
const SublocationList(this._locations);
|
const SublocationList(this._locations);
|
||||||
|
|
||||||
|
final List<InvenTreeStockLocation> _locations;
|
||||||
|
|
||||||
void _openLocation(BuildContext context, int pk) {
|
void _openLocation(BuildContext context, int pk) {
|
||||||
|
|
||||||
InvenTreeStockLocation().get(pk).then((var loc) {
|
InvenTreeStockLocation().get(pk).then((var loc) {
|
||||||
@ -475,10 +476,10 @@ class SublocationList extends StatelessWidget {
|
|||||||
|
|
||||||
class PaginatedStockList extends StatefulWidget {
|
class PaginatedStockList extends StatefulWidget {
|
||||||
|
|
||||||
final Map<String, String> filters;
|
|
||||||
|
|
||||||
const PaginatedStockList(this.filters);
|
const PaginatedStockList(this.filters);
|
||||||
|
|
||||||
|
final Map<String, String> filters;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_PaginatedStockListState createState() => _PaginatedStockListState(filters);
|
_PaginatedStockListState createState() => _PaginatedStockListState(filters);
|
||||||
}
|
}
|
||||||
@ -486,14 +487,14 @@ class PaginatedStockList extends StatefulWidget {
|
|||||||
|
|
||||||
class _PaginatedStockListState extends State<PaginatedStockList> {
|
class _PaginatedStockListState extends State<PaginatedStockList> {
|
||||||
|
|
||||||
|
_PaginatedStockListState(this.filters);
|
||||||
|
|
||||||
static const _pageSize = 25;
|
static const _pageSize = 25;
|
||||||
|
|
||||||
String _searchTerm = "";
|
String _searchTerm = "";
|
||||||
|
|
||||||
final Map<String, String> filters;
|
final Map<String, String> filters;
|
||||||
|
|
||||||
_PaginatedStockListState(this.filters);
|
|
||||||
|
|
||||||
final PagingController<int, InvenTreeStockItem> _pagingController = PagingController(firstPageKey: 0);
|
final PagingController<int, InvenTreeStockItem> _pagingController = PagingController(firstPageKey: 0);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -5,14 +5,14 @@ import "package:inventree/l10.dart";
|
|||||||
|
|
||||||
class PaginatedSearchWidget extends StatelessWidget {
|
class PaginatedSearchWidget extends StatelessWidget {
|
||||||
|
|
||||||
|
PaginatedSearchWidget(this.controller, this.onChanged, this.results);
|
||||||
|
|
||||||
Function onChanged;
|
Function onChanged;
|
||||||
|
|
||||||
int results = 0;
|
int results = 0;
|
||||||
|
|
||||||
TextEditingController controller;
|
TextEditingController controller;
|
||||||
|
|
||||||
PaginatedSearchWidget(this.controller, this.onChanged, this.results);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
|
@ -34,10 +34,10 @@ class PartDetailWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||||
|
|
||||||
InvenTreePart part;
|
|
||||||
|
|
||||||
_PartDisplayState(this.part);
|
_PartDisplayState(this.part);
|
||||||
|
|
||||||
|
InvenTreePart part;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) => L10().partDetails;
|
String getAppBarTitle(BuildContext context) => L10().partDetails;
|
||||||
|
|
||||||
|
@ -10,10 +10,10 @@ import "package:inventree/l10.dart";
|
|||||||
|
|
||||||
class PartNotesWidget extends StatefulWidget {
|
class PartNotesWidget extends StatefulWidget {
|
||||||
|
|
||||||
final InvenTreePart part;
|
|
||||||
|
|
||||||
const PartNotesWidget(this.part, {Key? key}) : super(key: key);
|
const PartNotesWidget(this.part, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
final InvenTreePart part;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_PartNotesState createState() => _PartNotesState(part);
|
_PartNotesState createState() => _PartNotesState(part);
|
||||||
}
|
}
|
||||||
@ -21,10 +21,10 @@ class PartNotesWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _PartNotesState extends RefreshableState<PartNotesWidget> {
|
class _PartNotesState extends RefreshableState<PartNotesWidget> {
|
||||||
|
|
||||||
final InvenTreePart part;
|
|
||||||
|
|
||||||
_PartNotesState(this.part);
|
_PartNotesState(this.part);
|
||||||
|
|
||||||
|
final InvenTreePart part;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> request() async {
|
Future<void> request() async {
|
||||||
await part.reload();
|
await part.reload();
|
||||||
|
@ -17,18 +17,6 @@ import "package:inventree/api.dart";
|
|||||||
|
|
||||||
class PartSearchDelegate extends SearchDelegate<InvenTreePart?> {
|
class PartSearchDelegate extends SearchDelegate<InvenTreePart?> {
|
||||||
|
|
||||||
final partSearchKey = GlobalKey<ScaffoldState>();
|
|
||||||
|
|
||||||
BuildContext context;
|
|
||||||
|
|
||||||
// What did we search for last time?
|
|
||||||
String _cachedQuery = "";
|
|
||||||
|
|
||||||
bool _searching = false;
|
|
||||||
|
|
||||||
// Custom filters for the part search
|
|
||||||
Map<String, String> _filters = {};
|
|
||||||
|
|
||||||
PartSearchDelegate(this.context, {Map<String, String> filters = const {}}) {
|
PartSearchDelegate(this.context, {Map<String, String> filters = const {}}) {
|
||||||
|
|
||||||
// Copy filter values
|
// Copy filter values
|
||||||
@ -42,6 +30,18 @@ class PartSearchDelegate extends SearchDelegate<InvenTreePart?> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final partSearchKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
|
BuildContext context;
|
||||||
|
|
||||||
|
// What did we search for last time?
|
||||||
|
String _cachedQuery = "";
|
||||||
|
|
||||||
|
bool _searching = false;
|
||||||
|
|
||||||
|
// Custom filters for the part search
|
||||||
|
Map<String, String> _filters = {};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get searchFieldLabel => L10().searchParts;
|
String get searchFieldLabel => L10().searchParts;
|
||||||
|
|
||||||
@ -207,17 +207,6 @@ class PartSearchDelegate extends SearchDelegate<InvenTreePart?> {
|
|||||||
|
|
||||||
class StockSearchDelegate extends SearchDelegate<InvenTreeStockItem?> {
|
class StockSearchDelegate extends SearchDelegate<InvenTreeStockItem?> {
|
||||||
|
|
||||||
final stockSearchKey = GlobalKey<ScaffoldState>();
|
|
||||||
|
|
||||||
final BuildContext context;
|
|
||||||
|
|
||||||
String _cachedQuery = "";
|
|
||||||
|
|
||||||
bool _searching = false;
|
|
||||||
|
|
||||||
// Custom filters for the stock item search
|
|
||||||
Map<String, String> _filters = {};
|
|
||||||
|
|
||||||
StockSearchDelegate(this.context, {Map<String, String> filters = const {}}) {
|
StockSearchDelegate(this.context, {Map<String, String> filters = const {}}) {
|
||||||
|
|
||||||
// Copy filter values
|
// Copy filter values
|
||||||
@ -231,6 +220,17 @@ class StockSearchDelegate extends SearchDelegate<InvenTreeStockItem?> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final stockSearchKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
|
final BuildContext context;
|
||||||
|
|
||||||
|
String _cachedQuery = "";
|
||||||
|
|
||||||
|
bool _searching = false;
|
||||||
|
|
||||||
|
// Custom filters for the stock item search
|
||||||
|
Map<String, String> _filters = {};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get searchFieldLabel => L10().searchStock;
|
String get searchFieldLabel => L10().searchStock;
|
||||||
|
|
||||||
|
@ -5,9 +5,6 @@ import "package:font_awesome_flutter/font_awesome_flutter.dart";
|
|||||||
import "package:inventree/app_colors.dart";
|
import "package:inventree/app_colors.dart";
|
||||||
|
|
||||||
class Spinner extends StatefulWidget {
|
class Spinner extends StatefulWidget {
|
||||||
final IconData? icon;
|
|
||||||
final Duration duration;
|
|
||||||
final Color color;
|
|
||||||
|
|
||||||
const Spinner({
|
const Spinner({
|
||||||
this.color = COLOR_GRAY_LIGHT,
|
this.color = COLOR_GRAY_LIGHT,
|
||||||
@ -16,6 +13,10 @@ class Spinner extends StatefulWidget {
|
|||||||
this.duration = const Duration(milliseconds: 1800),
|
this.duration = const Duration(milliseconds: 1800),
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final IconData? icon;
|
||||||
|
final Duration duration;
|
||||||
|
final Color color;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_SpinnerState createState() => _SpinnerState();
|
_SpinnerState createState() => _SpinnerState();
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,8 @@ class StockDetailWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||||
|
|
||||||
|
_StockItemDisplayState(this.item);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) => L10().stockItem;
|
String getAppBarTitle(BuildContext context) => L10().stockItem;
|
||||||
|
|
||||||
@ -46,8 +48,6 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
final _countStockKey = GlobalKey<FormState>();
|
final _countStockKey = GlobalKey<FormState>();
|
||||||
final _moveStockKey = GlobalKey<FormState>();
|
final _moveStockKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
_StockItemDisplayState(this.item);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Widget> getAppBarActions(BuildContext context) {
|
List<Widget> getAppBarActions(BuildContext context) {
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ class StockItemTestResultsWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestResultsWidget> {
|
class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestResultsWidget> {
|
||||||
|
|
||||||
|
_StockItemTestResultDisplayState(this.item);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) => L10().testResults;
|
String getAppBarTitle(BuildContext context) => L10().testResults;
|
||||||
|
|
||||||
@ -49,8 +51,6 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
|
|||||||
|
|
||||||
final InvenTreeStockItem item;
|
final InvenTreeStockItem item;
|
||||||
|
|
||||||
_StockItemTestResultDisplayState(this.item);
|
|
||||||
|
|
||||||
Future <void> addTestResult(BuildContext context, {String name = "", bool nameIsEditable = true, bool result = false, String value = "", bool valueRequired = false, bool attachmentRequired = false}) async {
|
Future <void> addTestResult(BuildContext context, {String name = "", bool nameIsEditable = true, bool result = false, String value = "", bool valueRequired = false, bool attachmentRequired = false}) async {
|
||||||
|
|
||||||
InvenTreeStockItemTestResult().createForm(
|
InvenTreeStockItemTestResult().createForm(
|
||||||
|
@ -12,10 +12,10 @@ import "package:inventree/api.dart";
|
|||||||
|
|
||||||
class StockNotesWidget extends StatefulWidget {
|
class StockNotesWidget extends StatefulWidget {
|
||||||
|
|
||||||
final InvenTreeStockItem item;
|
|
||||||
|
|
||||||
const StockNotesWidget(this.item, {Key? key}) : super(key: key);
|
const StockNotesWidget(this.item, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
final InvenTreeStockItem item;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_StockNotesState createState() => _StockNotesState(item);
|
_StockNotesState createState() => _StockNotesState(item);
|
||||||
}
|
}
|
||||||
@ -23,10 +23,10 @@ class StockNotesWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _StockNotesState extends RefreshableState<StockNotesWidget> {
|
class _StockNotesState extends RefreshableState<StockNotesWidget> {
|
||||||
|
|
||||||
final InvenTreeStockItem item;
|
|
||||||
|
|
||||||
_StockNotesState(this.item);
|
_StockNotesState(this.item);
|
||||||
|
|
||||||
|
final InvenTreeStockItem item;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) => L10().stockItemNotes;
|
String getAppBarTitle(BuildContext context) => L10().stockItemNotes;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user