2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-15 11:45:31 +00:00

Code cleanup

This commit is contained in:
Oliver
2021-07-15 11:27:19 +10:00
parent 2a5bb4631b
commit d2ce3fadf1
19 changed files with 36 additions and 81 deletions

View File

@ -126,7 +126,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
);
}
_CategoryDisplayState(this.category) {}
_CategoryDisplayState(this.category);
// The local InvenTreePartCategory object
final InvenTreePartCategory? category;

View File

@ -42,7 +42,7 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
void _saveCompany(Map<String, String> values) async {
Navigator.of(context).pop();
var response = await company.update(values: values);
await company.update(values: values);
refresh();
}
@ -57,13 +57,13 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
showFormDialog(L10().edit,
key: _editCompanyKey,
actions: <Widget>[
FlatButton(
TextButton(
child: Text(L10().cancel),
onPressed: () {
Navigator.pop(context);
},
),
FlatButton(
TextButton(
child: Text(L10().save),
onPressed: () {
if (_editCompanyKey.currentState!.validate()) {

View File

@ -5,9 +5,7 @@ import 'package:flutter/material.dart';
import 'package:InvenTree/api.dart';
import 'package:InvenTree/inventree/company.dart';
import 'package:InvenTree/widget/drawer.dart';
import 'package:InvenTree/widget/refreshable_state.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
abstract class CompanyListWidget extends StatefulWidget {
@ -50,7 +48,7 @@ class _CompanyListState extends RefreshableState<CompanyListWidget> {
Map<String, String> _filters = Map<String, String>();
_CompanyListState(this._title, this._filters) {}
_CompanyListState(this._title, this._filters);
@override
Future<void> onBuild(BuildContext context) async {

View File

@ -163,10 +163,6 @@ Future<void> showStatusCodeError(int status, {int expected = 200}) async {
}
Future<void> showTimeoutError() async {
// Use OneContext as "sometimes" context is null here?
var ctx = OneContext().context;
await showServerError(L10().timeout, L10().noResponse);
}
@ -174,8 +170,6 @@ void showFormDialog(String title, {String? acceptText, String? cancelText, Globa
BuildContext? dialogContext;
var ctx = OneContext().context;
String _accept = acceptText ?? L10().save;
String _cancel = cancelText ?? L10().cancel;

View File

@ -1,10 +1,7 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:image_picker/image_picker.dart';
import 'package:one_context/one_context.dart';
import 'package:InvenTree/l10.dart';
import 'dart:async';

View File

@ -1,5 +1,4 @@
import 'package:InvenTree/user_profile.dart';
import 'package:InvenTree/widget/starred_parts.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

View File

@ -127,7 +127,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
);
}
_LocationDisplayState(this.location) {}
_LocationDisplayState(this.location);
List<InvenTreeStockLocation> _sublocations = [];

View File

@ -2,8 +2,6 @@ import 'package:InvenTree/widget/drawer.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:InvenTree/widget/drawer.dart';
abstract class RefreshableState<T extends StatefulWidget> extends State<T> {

View File

@ -48,8 +48,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
final _moveStockKey = GlobalKey<FormState>();
final _editStockKey = GlobalKey<FormState>();
_StockItemDisplayState(this.item) {
}
_StockItemDisplayState(this.item);
@override
List<Widget> getAppBarActions(BuildContext context) {