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
82 lines
2.0 KiB
Dart
82 lines
2.0 KiB
Dart
|
|
import "package:flutter/material.dart";
|
|
|
|
import "package:inventree/api.dart";
|
|
|
|
import "package:inventree/inventree/company.dart";
|
|
import "package:inventree/inventree/model.dart";
|
|
|
|
import "package:inventree/widget/paginator.dart";
|
|
import "package:inventree/widget/refreshable_state.dart";
|
|
import "package:inventree/widget/company_detail.dart";
|
|
|
|
|
|
/*
|
|
* Widget for displaying a filterable list of Company instances
|
|
*/
|
|
class CompanyListWidget extends StatefulWidget {
|
|
|
|
const CompanyListWidget(this.title, this.filters, {Key? key}) : super(key: key);
|
|
|
|
final String title;
|
|
|
|
final Map<String, String> filters;
|
|
|
|
@override
|
|
_CompanyListWidgetState createState() => _CompanyListWidgetState();
|
|
}
|
|
|
|
|
|
class _CompanyListWidgetState extends RefreshableState<CompanyListWidget> {
|
|
|
|
_CompanyListWidgetState();
|
|
|
|
@override
|
|
String getAppBarTitle() => widget.title;
|
|
|
|
@override
|
|
Widget getBody(BuildContext context) {
|
|
return PaginatedCompanyList(widget.filters, true);
|
|
}
|
|
|
|
}
|
|
|
|
class PaginatedCompanyList extends PaginatedSearchWidget {
|
|
|
|
const PaginatedCompanyList(Map<String, String> filters, bool showSearch) : super(filters: filters, showSearch: showSearch);
|
|
|
|
@override
|
|
_CompanyListState createState() => _CompanyListState();
|
|
}
|
|
|
|
class _CompanyListState extends PaginatedSearchState<PaginatedCompanyList> {
|
|
|
|
_CompanyListState() : super();
|
|
|
|
@override
|
|
Future<InvenTreePageResponse?> requestPage(int limit, int offset, Map<String, String> params) async {
|
|
|
|
final page = await InvenTreeCompany().listPaginated(limit, offset, filters: params);
|
|
|
|
return page;
|
|
}
|
|
|
|
@override
|
|
Widget buildItem(BuildContext context, InvenTreeModel model) {
|
|
|
|
InvenTreeCompany company = model as InvenTreeCompany;
|
|
|
|
return ListTile(
|
|
title: Text(company.name),
|
|
subtitle: Text(company.description),
|
|
leading: InvenTreeAPI().getImage(
|
|
company.image,
|
|
width: 40,
|
|
height: 40
|
|
),
|
|
onTap: () async {
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => CompanyDetailWidget(company)));
|
|
},
|
|
);
|
|
}
|
|
} |