2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-07-07 06:10:47 +00:00

Link icons (#677)

* Add LinkIcon component

* Visual UI updates

- Refactor some components
- Clearer text display
- Add obvious chevron icon when a "tile" will take the user somewhere else

* dart format

* Adjust release notes

* Add visual separator

* Cleanup unused imports
This commit is contained in:
Oliver
2025-07-04 21:16:04 +10:00
committed by GitHub
parent c30f1a19d1
commit 2adf8e3430
28 changed files with 261 additions and 195 deletions

View File

@ -10,6 +10,7 @@ import "package:inventree/inventree/company.dart";
import "package:inventree/inventree/purchase_order.dart";
import "package:inventree/inventree/sales_order.dart";
import "package:inventree/widget/attachment_widget.dart";
import "package:inventree/widget/link_icon.dart";
import "package:inventree/widget/order/purchase_order_list.dart";
import "package:inventree/widget/order/sales_order_list.dart";
import "package:inventree/widget/refreshable_state.dart";
@ -240,8 +241,10 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
if (widget.company.website.isNotEmpty) {
tiles.add(
ListTile(
title: Text("${widget.company.website}"),
title: Text(L10().website),
subtitle: Text("${widget.company.website}"),
leading: Icon(TablerIcons.globe, color: COLOR_ACTION),
trailing: LinkIcon(external: true),
onTap: () async {
openLink(widget.company.website);
},
@ -254,8 +257,10 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
if (widget.company.email.isNotEmpty) {
tiles.add(
ListTile(
title: Text("${widget.company.email}"),
title: Text(L10().email),
subtitle: Text("${widget.company.email}"),
leading: Icon(TablerIcons.at, color: COLOR_ACTION),
trailing: LinkIcon(external: true),
onTap: () async {
openLink("mailto:${widget.company.email}");
},
@ -268,8 +273,10 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
if (widget.company.phone.isNotEmpty) {
tiles.add(
ListTile(
title: Text("${widget.company.phone}"),
title: Text(L10().phone),
subtitle: Text("${widget.company.phone}"),
leading: Icon(TablerIcons.phone, color: COLOR_ACTION),
trailing: LinkIcon(external: true),
onTap: () {
openLink("tel:${widget.company.phone}");
},
@ -283,8 +290,10 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
if (widget.company.link.isNotEmpty) {
tiles.add(
ListTile(
title: Text("${widget.company.link}"),
title: Text(L10().link),
subtitle: Text("${widget.company.link}"),
leading: Icon(TablerIcons.link, color: COLOR_ACTION),
trailing: LinkIcon(external: true),
onTap: () {
widget.company.openLink();
},
@ -304,7 +313,7 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
ListTile(
title: Text(L10().supplierParts),
leading: Icon(TablerIcons.building, color: COLOR_ACTION),
trailing: Text(supplierPartCount.toString()),
trailing: LinkIcon(text: supplierPartCount.toString()),
onTap: () {
Navigator.push(
context,
@ -323,7 +332,7 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
ListTile(
title: Text(L10().purchaseOrders),
leading: Icon(TablerIcons.shopping_cart, color: COLOR_ACTION),
trailing: Text("${outstandingPurchaseOrders}"),
trailing: LinkIcon(text: "${outstandingPurchaseOrders}"),
onTap: () {
Navigator.push(
context,
@ -343,7 +352,7 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
ListTile(
title: Text(L10().suppliedParts),
leading: Icon(TablerIcons.box),
trailing: Text("${company.partSuppliedCount}"),
trailing: LargeText("${company.partSuppliedCount}"),
)
);
*/
@ -358,7 +367,7 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
ListTile(
title: Text(L10().salesOrders),
leading: Icon(TablerIcons.truck, color: COLOR_ACTION),
trailing: Text("${outstandingSalesOrders}"),
trailing: LinkIcon(text: "${outstandingSalesOrders}"),
onTap: () {
Navigator.push(
context,
@ -377,6 +386,7 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
tiles.add(
ListTile(
title: Text(L10().notes),
subtitle: Text(widget.company.notes),
leading: Icon(TablerIcons.note),
onTap: null,
),
@ -387,7 +397,9 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
ListTile(
title: Text(L10().attachments),
leading: Icon(TablerIcons.file, color: COLOR_ACTION),
trailing: attachmentCount > 0 ? Text(attachmentCount.toString()) : null,
trailing: LinkIcon(
text: attachmentCount > 0 ? attachmentCount.toString() : null,
),
onTap: () {
Navigator.push(
context,

View File

@ -1,9 +1,9 @@
import "package:flutter/material.dart";
import "package:flutter_speed_dial/flutter_speed_dial.dart";
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
import "package:inventree/widget/link_icon.dart";
import "package:url_launcher/url_launcher.dart";
import "package:inventree/api.dart";
import "package:inventree/app_colors.dart";
import "package:inventree/l10.dart";
@ -117,7 +117,7 @@ class _SupplierPartDisplayState
title: Text(L10().internalPart),
subtitle: Text(widget.supplierPart.partName),
leading: Icon(TablerIcons.box, color: COLOR_ACTION),
trailing: InvenTreeAPI().getThumbnail(widget.supplierPart.partImage),
trailing: LinkIcon(),
onTap: () async {
showLoadingOverlay();
final part = await InvenTreePart().get(widget.supplierPart.partId);
@ -149,9 +149,7 @@ class _SupplierPartDisplayState
title: Text(L10().supplier),
subtitle: Text(widget.supplierPart.supplierName),
leading: Icon(TablerIcons.building, color: COLOR_ACTION),
trailing: InvenTreeAPI().getThumbnail(
widget.supplierPart.supplierImage,
),
trailing: LinkIcon(),
onTap: () async {
showLoadingOverlay();
var supplier = await InvenTreeCompany().get(
@ -182,9 +180,7 @@ class _SupplierPartDisplayState
title: Text(L10().manufacturer),
subtitle: Text(widget.supplierPart.manufacturerName),
leading: Icon(TablerIcons.building_factory_2, color: COLOR_ACTION),
trailing: InvenTreeAPI().getThumbnail(
widget.supplierPart.manufacturerImage,
),
trailing: LinkIcon(),
onTap: () async {
showLoadingOverlay();
var supplier = await InvenTreeCompany().get(
@ -204,6 +200,7 @@ class _SupplierPartDisplayState
title: Text(L10().manufacturerPartNumber),
subtitle: Text(widget.supplierPart.MPN),
leading: Icon(TablerIcons.hash, color: COLOR_ACTION),
trailing: LinkIcon(),
onTap: () async {
showLoadingOverlay();
var manufacturerPart = await InvenTreeManufacturerPart().get(
@ -236,7 +233,7 @@ class _SupplierPartDisplayState
: null,
leading: Icon(TablerIcons.package),
trailing: widget.supplierPart.pack_quantity.isNotEmpty
? Text(widget.supplierPart.pack_quantity)
? LargeText(widget.supplierPart.pack_quantity)
: null,
),
);
@ -245,8 +242,10 @@ class _SupplierPartDisplayState
if (widget.supplierPart.link.isNotEmpty) {
tiles.add(
ListTile(
title: Text(widget.supplierPart.link),
title: Text(L10().link),
subtitle: Text(widget.supplierPart.link),
leading: Icon(TablerIcons.link, color: COLOR_ACTION),
trailing: LinkIcon(external: true),
onTap: () async {
var uri = Uri.tryParse(widget.supplierPart.link);
if (uri != null && await canLaunchUrl(uri)) {
@ -260,7 +259,8 @@ class _SupplierPartDisplayState
if (widget.supplierPart.note.isNotEmpty) {
tiles.add(
ListTile(
title: Text(widget.supplierPart.note),
title: Text(L10().notes),
subtitle: Text(widget.supplierPart.note),
leading: Icon(TablerIcons.pencil),
),
);

View File

@ -8,7 +8,6 @@ import "package:inventree/inventree/model.dart";
import "package:inventree/widget/paginator.dart";
import "package:inventree/widget/refreshable_state.dart";
import "package:inventree/widget/company/supplier_part_detail.dart";
/*
* Widget for displaying a list of Supplier Part instances
@ -93,12 +92,7 @@ class _PaginatedSupplierPartListState
leading: InvenTreeAPI().getThumbnail(supplierPart.supplierImage),
trailing: InvenTreeAPI().getThumbnail(supplierPart.partImage),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SupplierPartDetailWidget(supplierPart),
),
);
supplierPart.goToDetailPage(context);
},
);
}