mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-12 10:15:32 +00:00
.github
android
assets
ios
lib
generated
inventree
l10n
settings
widget
back.dart
category_display.dart
category_list.dart
company_detail.dart
company_list.dart
dialogs.dart
drawer.dart
fields.dart
home.dart
location_display.dart
location_list.dart
paginator.dart
part_attachments_widget.dart
part_detail.dart
part_image_widget.dart
part_list.dart
part_notes.dart
part_suppliers.dart
progress.dart
purchase_order_detail.dart
purchase_order_list.dart
refreshable_state.dart
search.dart
snacks.dart
spinner.dart
starred_parts.dart
stock_detail.dart
stock_item_history.dart
stock_item_test_results.dart
stock_list.dart
stock_notes.dart
submit_feedback.dart
api.dart
api_form.dart
app_colors.dart
app_settings.dart
barcode.dart
dummy_dsn.dart
helpers.dart
l10.dart
main.dart
preferences.dart
user_profile.dart
res
test
.gitignore
.gitmodules
.metadata
LICENSE
README.md
RELEASE.md
analysis_options.yaml
crowdin.yml
l10n.yaml
pubspec.lock
pubspec.yaml
81 lines
2.0 KiB
Dart
81 lines
2.0 KiB
Dart
import "package:flutter/material.dart";
|
|
|
|
import "package:inventree/inventree/model.dart";
|
|
import "package:inventree/inventree/stock.dart";
|
|
import "package:inventree/widget/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(BuildContext context) => L10().stockLocations;
|
|
|
|
@override
|
|
Widget getBody(BuildContext context) {
|
|
return PaginatedStockLocationList(filters);
|
|
}
|
|
}
|
|
|
|
|
|
class PaginatedStockLocationList extends StatefulWidget {
|
|
|
|
const PaginatedStockLocationList(this.filters);
|
|
|
|
final Map<String, String> filters;
|
|
|
|
@override
|
|
_PaginatedStockLocationListState createState() => _PaginatedStockLocationListState(filters);
|
|
}
|
|
|
|
|
|
class _PaginatedStockLocationListState extends PaginatedSearchState<PaginatedStockLocationList> {
|
|
|
|
_PaginatedStockLocationListState(Map<String, String> filters) : super(filters);
|
|
|
|
@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}"),
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => LocationDisplayWidget(location)
|
|
)
|
|
);
|
|
},
|
|
);
|
|
}
|
|
} |