mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-13 10:45:29 +00:00
More linting again
This commit is contained in:
@ -198,7 +198,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
||||
|
||||
if (loading) {
|
||||
tiles.add(progressIndicator());
|
||||
} else if (_subcategories.length == 0) {
|
||||
} else if (_subcategories.isEmpty) {
|
||||
tiles.add(ListTile(
|
||||
title: Text(L10().noSubcategories),
|
||||
subtitle: Text(
|
||||
@ -301,7 +301,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
||||
}
|
||||
}
|
||||
|
||||
if (tiles.length == 0) {
|
||||
if (tiles.isEmpty) {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(
|
||||
@ -397,11 +397,11 @@ class SubcategoryList extends StatelessWidget {
|
||||
|
||||
class PaginatedPartList extends StatefulWidget {
|
||||
|
||||
PaginatedPartList(this.filters, {this.onTotalChanged});
|
||||
const PaginatedPartList(this.filters, {this.onTotalChanged});
|
||||
|
||||
final Map<String, String> filters;
|
||||
|
||||
Function(int)? onTotalChanged;
|
||||
final Function(int)? onTotalChanged;
|
||||
|
||||
@override
|
||||
_PaginatedPartListState createState() => _PaginatedPartListState(filters, onTotalChanged);
|
||||
|
@ -15,11 +15,11 @@ import "package:inventree/l10.dart";
|
||||
|
||||
class CompanyListWidget extends StatefulWidget {
|
||||
|
||||
CompanyListWidget(this.title, this.filters, {Key? key}) : super(key: key);
|
||||
const CompanyListWidget(this.title, this.filters, {Key? key}) : super(key: key);
|
||||
|
||||
String title;
|
||||
final String title;
|
||||
|
||||
Map<String, String> filters;
|
||||
final Map<String, String> filters;
|
||||
|
||||
@override
|
||||
_CompanyListWidgetState createState() => _CompanyListWidgetState(title, filters);
|
||||
@ -49,11 +49,11 @@ class _CompanyListWidgetState extends RefreshableState<CompanyListWidget> {
|
||||
|
||||
class PaginatedCompanyList extends StatefulWidget {
|
||||
|
||||
PaginatedCompanyList(this.filters, {this.onTotalChanged});
|
||||
const PaginatedCompanyList(this.filters, {this.onTotalChanged});
|
||||
|
||||
final Map<String, String> filters;
|
||||
|
||||
Function(int)? onTotalChanged;
|
||||
final Function(int)? onTotalChanged;
|
||||
|
||||
@override
|
||||
_CompanyListState createState() => _CompanyListState(filters, onTotalChanged);
|
||||
|
@ -194,7 +194,7 @@ class StringField extends TextFormField {
|
||||
*/
|
||||
class QuantityField extends TextFormField {
|
||||
|
||||
QuantityField({String label = "", String hint = "", String initial = "", double? max, TextEditingController? controller}) :
|
||||
QuantityField({String label = "", String hint = "", double? max, TextEditingController? controller}) :
|
||||
super(
|
||||
decoration: InputDecoration(
|
||||
labelText: label,
|
||||
|
@ -313,13 +313,13 @@ List<Widget> detailTiles() {
|
||||
L10().sublocations,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
trailing: sublocations.length > 0 ? Text("${sublocations.length}") : null,
|
||||
trailing: sublocations.isNotEmpty ? Text("${sublocations.length}") : null,
|
||||
),
|
||||
];
|
||||
|
||||
if (loading) {
|
||||
tiles.add(progressIndicator());
|
||||
} else if (_sublocations.length > 0) {
|
||||
} else if (_sublocations.isNotEmpty) {
|
||||
tiles.add(SublocationList(_sublocations));
|
||||
} else {
|
||||
tiles.add(ListTile(
|
||||
|
@ -5,13 +5,13 @@ import "package:inventree/l10.dart";
|
||||
|
||||
class PaginatedSearchWidget extends StatelessWidget {
|
||||
|
||||
PaginatedSearchWidget(this.controller, this.onChanged, this.results);
|
||||
const PaginatedSearchWidget(this.controller, this.onChanged, this.results);
|
||||
|
||||
Function onChanged;
|
||||
final Function onChanged;
|
||||
|
||||
int results = 0;
|
||||
final int results;
|
||||
|
||||
TextEditingController controller;
|
||||
final TextEditingController controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -123,7 +123,7 @@ class _PartAttachmentDisplayState extends RefreshableState<PartAttachmentsWidget
|
||||
));
|
||||
}
|
||||
|
||||
if (tiles.length == 0) {
|
||||
if (tiles.isEmpty) {
|
||||
tiles.add(ListTile(
|
||||
title: Text(L10().attachmentNone),
|
||||
subtitle: Text(
|
||||
|
@ -17,7 +17,7 @@ import "package:inventree/widget/refreshable_state.dart";
|
||||
import "package:inventree/widget/part_image_widget.dart";
|
||||
import "package:inventree/widget/stock_detail.dart";
|
||||
|
||||
import "pcakage:inventree/widget/location_display.dart";
|
||||
import "package:inventree/widget/location_display.dart";
|
||||
|
||||
|
||||
class PartDetailWidget extends StatefulWidget {
|
||||
@ -442,20 +442,22 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
);
|
||||
|
||||
// TODO - Add this action back in once implemented
|
||||
if (false) {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().barcodeScanItem),
|
||||
leading: FaIcon(FontAwesomeIcons.box),
|
||||
trailing: FaIcon(FontAwesomeIcons.qrcode),
|
||||
onTap: () {
|
||||
// TODO
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (false && !part.isActive && InvenTreeAPI().checkPermission("part", "delete")) {
|
||||
/*
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().barcodeScanItem),
|
||||
leading: FaIcon(FontAwesomeIcons.box),
|
||||
trailing: FaIcon(FontAwesomeIcons.qrcode),
|
||||
onTap: () {
|
||||
// TODO
|
||||
},
|
||||
),
|
||||
);
|
||||
*/
|
||||
|
||||
/*
|
||||
// TODO: Implement part deletion
|
||||
if (!part.isActive && InvenTreeAPI().checkPermission("part", "delete")) {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().deletePart),
|
||||
@ -467,6 +469,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
)
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
return tiles;
|
||||
}
|
||||
|
@ -43,11 +43,11 @@ class _PurchaseOrderListWidgetState extends RefreshableState<PurchaseOrderListWi
|
||||
|
||||
class _PaginatedPurchaseOrderList extends StatefulWidget {
|
||||
|
||||
_PaginatedPurchaseOrderList(this.filters, {this.onTotalChanged});
|
||||
const _PaginatedPurchaseOrderList(this.filters, {this.onTotalChanged});
|
||||
|
||||
final Map<String, String> filters;
|
||||
|
||||
Function(int)? onTotalChanged;
|
||||
final Function(int)? onTotalChanged;
|
||||
|
||||
@override
|
||||
_PaginatedPurchaseOrderListState createState() => _PaginatedPurchaseOrderListState(filters, onTotalChanged);
|
||||
|
@ -9,7 +9,7 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> {
|
||||
final refreshableKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
// Storage for context once "Build" is called
|
||||
BuildContext? _context;
|
||||
late BuildContext? _context;
|
||||
|
||||
// Current tab index (used for widgets which display bottom tabs)
|
||||
int tabIndex = 0;
|
||||
|
@ -86,7 +86,7 @@ class PartSearchDelegate extends SearchDelegate<InvenTreePart?> {
|
||||
|
||||
showSnackIcon(
|
||||
"${partResults.length} ${L10().results}",
|
||||
success: partResults.length > 0,
|
||||
success: partResults.isNotEmpty,
|
||||
icon: FontAwesomeIcons.pollH,
|
||||
);
|
||||
|
||||
@ -161,7 +161,7 @@ class PartSearchDelegate extends SearchDelegate<InvenTreePart?> {
|
||||
|
||||
search(context);
|
||||
|
||||
if (query.length == 0) {
|
||||
if (query.isEmpty) {
|
||||
return ListTile(
|
||||
title: Text(L10().queryEnter)
|
||||
);
|
||||
@ -174,7 +174,7 @@ class PartSearchDelegate extends SearchDelegate<InvenTreePart?> {
|
||||
);
|
||||
}
|
||||
|
||||
if (partResults.length == 0) {
|
||||
if (partResults.isEmpty) {
|
||||
return ListTile(
|
||||
title: Text(L10().noResults),
|
||||
subtitle: Text(L10().queryNoResults + " '${query}'")
|
||||
@ -275,7 +275,7 @@ class StockSearchDelegate extends SearchDelegate<InvenTreeStockItem?> {
|
||||
|
||||
showSnackIcon(
|
||||
"${itemResults.length} ${L10().results}",
|
||||
success: itemResults.length > 0,
|
||||
success: itemResults.isNotEmpty,
|
||||
icon: FontAwesomeIcons.pollH,
|
||||
);
|
||||
|
||||
@ -349,7 +349,7 @@ class StockSearchDelegate extends SearchDelegate<InvenTreeStockItem?> {
|
||||
|
||||
search(context);
|
||||
|
||||
if (query.length == 0) {
|
||||
if (query.isEmpty) {
|
||||
return ListTile(
|
||||
title: Text(L10().queryEnter)
|
||||
);
|
||||
@ -362,7 +362,7 @@ class StockSearchDelegate extends SearchDelegate<InvenTreeStockItem?> {
|
||||
);
|
||||
}
|
||||
|
||||
if (itemResults.length == 0) {
|
||||
if (itemResults.isEmpty) {
|
||||
return ListTile(
|
||||
title: Text(L10().noResults),
|
||||
subtitle: Text(L10().queryNoResults + " '${query}'")
|
||||
|
@ -17,7 +17,11 @@ import "package:inventree/l10.dart";
|
||||
|
||||
void showSnackIcon(String text, {IconData? icon, Function()? onAction, bool? success, String? actionText}) {
|
||||
|
||||
OneContext().hideCurrentSnackBar();
|
||||
BuildContext? context = OneContext().context;
|
||||
|
||||
if (context != null) {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
}
|
||||
|
||||
Color backgroundColor = Colors.deepOrange;
|
||||
|
||||
|
@ -22,7 +22,7 @@ class Spinner extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SpinnerState extends State<Spinner> with SingleTickerProviderStateMixin {
|
||||
AnimationController? _controller;
|
||||
late AnimationController? _controller;
|
||||
Widget? _child;
|
||||
|
||||
@override
|
||||
|
@ -71,7 +71,7 @@ class _StarredPartState extends RefreshableState<StarredPartWidget> {
|
||||
return progressIndicator();
|
||||
}
|
||||
|
||||
if (starredParts.length == 0) {
|
||||
if (starredParts.isEmpty) {
|
||||
return ListView(
|
||||
children: [
|
||||
ListTile(
|
||||
|
@ -142,7 +142,7 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
|
||||
|
||||
var results = getTestResults();
|
||||
|
||||
if (results.length == 0) {
|
||||
if (results.isEmpty) {
|
||||
tiles.add(ListTile(
|
||||
title: Text(L10().testResultNone),
|
||||
subtitle: Text(L10().testResultNoneDetail),
|
||||
|
Reference in New Issue
Block a user