2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

More code cleanup

This commit is contained in:
Oliver 2021-08-02 21:53:57 +10:00
parent 68859b3d2e
commit d47a8db289
7 changed files with 15 additions and 50 deletions

View File

@ -18,7 +18,7 @@ import 'package:inventree/user_profile.dart';
import 'package:inventree/widget/snacks.dart';
/**
/*
* Class representing an API response from the server
*/
class APIResponse {
@ -38,7 +38,7 @@ class APIResponse {
}
/**
/*
* Custom FileService for caching network images
* Requires a custom badCertificateCallback,
* so we can accept "dodgy" certificates
@ -82,7 +82,7 @@ class InvenTreeFileService extends FileService {
}
}
/**
/*
* InvenTree API - Access to the InvenTree REST interface.
*
* InvenTree implements token-based authentication, which is
@ -201,7 +201,7 @@ class InvenTreeAPI {
InvenTreeAPI._internal();
/**
/*
* Connect to the remote InvenTree server:
*
* - Check that the InvenTree server exists
@ -502,7 +502,7 @@ class InvenTreeAPI {
return response;
}
/**
/*
* Perform a HTTP OPTIONS request,
* to get the available fields at a given endpoint.
* We send this with the currently selected "locale",
@ -523,7 +523,7 @@ class InvenTreeAPI {
return completeRequest(request);
}
/**
/*
* Perform a HTTP POST request
* Returns a json object (or null if unsuccessful)
*/
@ -572,7 +572,7 @@ class InvenTreeAPI {
return client;
}
/**
/*
* Initiate a HTTP request to the server
*
* @param url is the API endpoint
@ -641,7 +641,7 @@ class InvenTreeAPI {
}
/**
/*
* Complete an API request, and return an APIResponse object
*/
Future<APIResponse> completeRequest(HttpClientRequest request, {String? data, int? statusCode}) async {
@ -701,7 +701,7 @@ class InvenTreeAPI {
}
/**
/*
* Convert a HttpClientResponse response object to JSON
*/
dynamic responseToJson(HttpClientResponse response) async {
@ -737,7 +737,7 @@ class InvenTreeAPI {
}
/**
/*
* Perform a HTTP GET request
* Returns a json object (or null if did not complete)
*/
@ -786,7 +786,7 @@ class InvenTreeAPI {
static String get staticThumb => "/static/img/blank_image.thumbnail.png";
/**
/*
* Load image from the InvenTree server,
* or from local cache (if it has been cached!)
*/

View File

@ -26,7 +26,7 @@ class InvenTreePageResponse {
List<InvenTreeModel> results = [];
}
/**
/*
* The InvenTreeModel class provides a base-level object
* for interacting with InvenTree data.
*/
@ -105,12 +105,9 @@ class InvenTreeModel {
void openLink() async {
if (link.isNotEmpty) {
print("Opening link: ${link}");
if (await canLaunch(link)) {
await launch(link);
} else {
// TODO
}
}
}

View File

@ -320,7 +320,7 @@ class InvenTreeStockItem extends InvenTreeModel {
return img;
}
/**
/*
* Return the Part thumbnail for this stock item.
*/
String get partThumbnail {

View File

@ -326,7 +326,7 @@ class SubcategoryList extends StatelessWidget {
}
/**
/*
* Widget for displaying a list of Part objects within a PartCategory display.
*
* Uses server-side pagination for snappy results

View File

@ -1,8 +1,6 @@
import 'package:inventree/api.dart';
import 'package:inventree/inventree/company.dart';
import 'package:inventree/widget/dialogs.dart';
import 'package:inventree/widget/fields.dart';
import 'package:inventree/widget/refreshable_state.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

View File

@ -384,7 +384,7 @@ class SublocationList extends StatelessWidget {
}
}
/**
/*
* Widget for displaying a list of stock items within a stock location.
*
* Users server-side pagination for snappy results

View File

@ -35,8 +35,6 @@ class PartDetailWidget extends StatefulWidget {
class _PartDisplayState extends RefreshableState<PartDetailWidget> {
final _editImageKey = GlobalKey<FormState>();
@override
String getAppBarTitle(BuildContext context) => L10().partDetails;
@ -102,34 +100,6 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
}
}
/**
* Upload image for this Part.
* Show a SnackBar with upload result.
*/
void _uploadImage(File? image) async {
if (image == null) {
return;
}
final result = await part.uploadImage(image);
if (result) {
showSnackIcon(
L10().imageUploadSuccess,
success: true
);
refresh();
} else {
showSnackIcon(
L10().imageUploadFailure,
success: false,
);
}
}
void _editPartDialog(BuildContext context) {
launchApiForm(