mirror of
https://github.com/inventree/inventree-app.git
synced 2025-08-13 07:50:52 +00:00
.github
android
assets
ios
lib
barcode
generated
inventree
l10n
settings
widget
company
order
part
stock
location_display.dart
location_list.dart
stock_detail.dart
stock_item_history.dart
stock_item_test_results.dart
stock_list.dart
attachment_widget.dart
back.dart
dialogs.dart
drawer.dart
fields.dart
home.dart
notes_widget.dart
notifications.dart
paginator.dart
progress.dart
refreshable_state.dart
search.dart
snacks.dart
spinner.dart
api.dart
api_form.dart
app_colors.dart
dsn.dart
helpers.dart
l10.dart
labels.dart
main.dart
preferences.dart
user_profile.dart
res
test
.gitignore
.gitmodules
.metadata
BUILDING.md
LICENSE
README.md
analysis_options.yaml
crowdin.yml
find_dart_files.py
l10n.yaml
pubspec.lock
pubspec.yaml
requirements.txt
tasks.py
* Change from fontawesome to tabler icons - Consistent with the frontend * Cleanup conflicts * Use double quotes * remove unused import * Update release notes * Migrate some google icons to tabler icons * Icon update * Properly support display of custom icons * Fix lookup
99 lines
2.6 KiB
Dart
99 lines
2.6 KiB
Dart
import "package:flutter/material.dart";
|
|
|
|
import "package:inventree/inventree/model.dart";
|
|
import "package:inventree/inventree/stock.dart";
|
|
import "package:inventree/widget/stock/location_display.dart";
|
|
import "package:inventree/widget/paginator.dart";
|
|
|
|
import "package:inventree/widget/refreshable_state.dart";
|
|
import "package:inventree/l10.dart";
|
|
|
|
|
|
class StockLocationList extends StatefulWidget {
|
|
|
|
const StockLocationList(this.filters);
|
|
|
|
final Map<String, String> filters;
|
|
|
|
@override
|
|
_StockLocationListState createState() => _StockLocationListState(filters);
|
|
}
|
|
|
|
|
|
class _StockLocationListState extends RefreshableState<StockLocationList> {
|
|
|
|
_StockLocationListState(this.filters);
|
|
|
|
final Map<String, String> filters;
|
|
|
|
@override
|
|
String getAppBarTitle() => L10().stockLocations;
|
|
|
|
@override
|
|
Widget getBody(BuildContext context) {
|
|
return PaginatedStockLocationList(filters);
|
|
}
|
|
}
|
|
|
|
|
|
class PaginatedStockLocationList extends PaginatedSearchWidget {
|
|
|
|
const PaginatedStockLocationList(Map<String, String> filters, {String title = ""}) : super(filters: filters, title: title);
|
|
|
|
@override
|
|
String get searchTitle => title.isNotEmpty ? title : L10().stockLocations;
|
|
|
|
@override
|
|
_PaginatedStockLocationListState createState() => _PaginatedStockLocationListState();
|
|
}
|
|
|
|
|
|
class _PaginatedStockLocationListState extends PaginatedSearchState<PaginatedStockLocationList> {
|
|
|
|
_PaginatedStockLocationListState() : super();
|
|
|
|
@override
|
|
Map<String, String> get orderingOptions => {
|
|
"name": L10().name,
|
|
"items": L10().stockItems,
|
|
"level": L10().level,
|
|
};
|
|
|
|
@override
|
|
Map<String, Map<String, dynamic>> get filterOptions => {
|
|
"cascade": {
|
|
"label": L10().includeSublocations,
|
|
"help_text": L10().includeSublocationsDetail,
|
|
"tristate": false,
|
|
}
|
|
};
|
|
|
|
@override
|
|
Future<InvenTreePageResponse?> requestPage(int limit, int offset, Map<String, String> params) async {
|
|
|
|
final page = await InvenTreeStockLocation().listPaginated(limit, offset, filters: params);
|
|
|
|
return page;
|
|
}
|
|
|
|
@override
|
|
Widget buildItem(BuildContext context, InvenTreeModel model) {
|
|
|
|
InvenTreeStockLocation location = model as InvenTreeStockLocation;
|
|
|
|
return ListTile(
|
|
title: Text(location.name),
|
|
subtitle: Text(location.pathstring),
|
|
trailing: Text("${location.itemcount}"),
|
|
leading: location.customIcon == null ? null : Icon(location.customIcon),
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => LocationDisplayWidget(location)
|
|
)
|
|
);
|
|
},
|
|
);
|
|
}
|
|
} |