mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
* Add "global actions" to title bar * Implement actions * Add "speed dial" action buttons * tweak global action icons * Refactor actions for "stock item" display * Refactor "part" detail * part category * SupplierPart * More updates * Add BottomAppBar * Add a global bottom app bar * Move "edit" buttons back to the app bar * tweaks * Updates to drawer navigation menu * home screen improvements * text tweaks * Fix appBarTitle for notifications widget * Update "tabs" for category display * Fix for attachment widget * Update tabs for purchaseorder view * Update part display * Cleanup * Add "BOM" tab to part detail widget * Paginated list search cleanup * Update release notes * Update old function * linting * linting * Tweaks to bottomappbar - Increase icon size slightly - Adjust "actions" icon
111 lines
2.8 KiB
Dart
111 lines
2.8 KiB
Dart
import "package:flutter/material.dart";
|
|
import "package:font_awesome_flutter/font_awesome_flutter.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;
|
|
|
|
bool showFilterOptions = false;
|
|
|
|
@override
|
|
List<Widget> appBarActions(BuildContext context) => [
|
|
IconButton(
|
|
icon: FaIcon(FontAwesomeIcons.filter),
|
|
onPressed: () async {
|
|
setState(() {
|
|
showFilterOptions = !showFilterOptions;
|
|
});
|
|
},
|
|
)
|
|
];
|
|
|
|
@override
|
|
String getAppBarTitle() => L10().stockLocations;
|
|
|
|
@override
|
|
Widget getBody(BuildContext context) {
|
|
return PaginatedStockLocationList(filters, showFilterOptions);
|
|
}
|
|
}
|
|
|
|
|
|
class PaginatedStockLocationList extends PaginatedSearchWidget {
|
|
|
|
const PaginatedStockLocationList(Map<String, String> filters, bool showSearch) : super(filters: filters, showSearch: showSearch);
|
|
|
|
@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,
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => LocationDisplayWidget(location)
|
|
)
|
|
);
|
|
},
|
|
);
|
|
}
|
|
} |