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
87 lines
2.1 KiB
Dart
87 lines
2.1 KiB
Dart
import "dart:core";
|
|
|
|
import "package:inventree/l10.dart";
|
|
|
|
import "package:inventree/api.dart";
|
|
|
|
import "package:flutter/material.dart";
|
|
import "package:inventree/inventree/part.dart";
|
|
import "package:inventree/inventree/company.dart";
|
|
import "package:inventree/widget/company_detail.dart";
|
|
import "package:inventree/widget/refreshable_state.dart";
|
|
|
|
class PartSupplierWidget extends StatefulWidget {
|
|
|
|
const PartSupplierWidget(this.part, {Key? key}) : super(key: key);
|
|
|
|
final InvenTreePart part;
|
|
|
|
@override
|
|
_PartSupplierState createState() => _PartSupplierState(part);
|
|
|
|
}
|
|
|
|
|
|
class _PartSupplierState extends RefreshableState<PartSupplierWidget> {
|
|
|
|
_PartSupplierState(this.part);
|
|
|
|
final InvenTreePart part;
|
|
|
|
List<InvenTreeSupplierPart> _supplierParts = [];
|
|
|
|
@override
|
|
Future<void> request(BuildContext context) async {
|
|
// TODO - Request list of suppliers for the part
|
|
await part.reload();
|
|
_supplierParts = await part.getSupplierParts();
|
|
}
|
|
|
|
@override
|
|
String getAppBarTitle() => L10().partSuppliers;
|
|
|
|
@override
|
|
List<Widget> appBarActions(BuildContext contexts) {
|
|
// TODO
|
|
return [];
|
|
}
|
|
|
|
Widget _supplierPartTile(BuildContext context, int index) {
|
|
|
|
InvenTreeSupplierPart _part = _supplierParts[index];
|
|
|
|
return ListTile(
|
|
leading: InvenTreeAPI().getImage(
|
|
_part.supplierImage,
|
|
width: 40,
|
|
height: 40,
|
|
),
|
|
title: Text("${_part.SKU}"),
|
|
subtitle: Text("${_part.manufacturerName}: ${_part.MPN}"),
|
|
onTap: () async {
|
|
var company = await InvenTreeCompany().get(_part.supplierId);
|
|
|
|
if (company != null && company is InvenTreeCompany) {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => CompanyDetailWidget(company)
|
|
)
|
|
);
|
|
}
|
|
},
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget getBody(BuildContext context) {
|
|
return ListView.separated(
|
|
shrinkWrap: true,
|
|
physics: ClampingScrollPhysics(),
|
|
separatorBuilder: (_, __) => const Divider(height: 3),
|
|
itemCount: _supplierParts.length,
|
|
itemBuilder: _supplierPartTile,
|
|
);
|
|
}
|
|
|
|
} |