mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-12 10:15:32 +00:00
UX Overhaul (#300)
* 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
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_speed_dial/flutter_speed_dial.dart";
|
||||
import "package:font_awesome_flutter/font_awesome_flutter.dart";
|
||||
|
||||
import "package:inventree/api.dart";
|
||||
@ -35,39 +36,64 @@ class _SupplierPartDisplayState extends RefreshableState<SupplierPartDetailWidge
|
||||
_SupplierPartDisplayState();
|
||||
|
||||
@override
|
||||
String getAppBarTitle(BuildContext context) => L10().supplierPart;
|
||||
|
||||
@override
|
||||
List<Widget> getAppBarActions(BuildContext context) {
|
||||
List<Widget> actions = [];
|
||||
|
||||
actions.add(
|
||||
IconButton(
|
||||
icon: FaIcon(FontAwesomeIcons.penToSquare),
|
||||
tooltip: L10().edit,
|
||||
onPressed: () {
|
||||
editSupplierPart(context);
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
return actions;
|
||||
}
|
||||
String getAppBarTitle() => L10().supplierPart;
|
||||
|
||||
/*
|
||||
* Launch a form to edit the current SupplierPart instance
|
||||
*/
|
||||
Future<void> editSupplierPart(BuildContext context) async {
|
||||
widget.supplierPart.editForm(
|
||||
context,
|
||||
L10().supplierPartEdit,
|
||||
onSuccess: (data) async {
|
||||
refresh(context);
|
||||
showSnackIcon(L10().supplierPartUpdated, success: true);
|
||||
}
|
||||
context,
|
||||
L10().supplierPartEdit,
|
||||
onSuccess: (data) async {
|
||||
refresh(context);
|
||||
showSnackIcon(L10().supplierPartUpdated, success: true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<SpeedDialChild> barcodeButtons(BuildContext context) {
|
||||
List<SpeedDialChild> actions = [];
|
||||
|
||||
if (api.checkPermission("purchase_order", "change") ||
|
||||
api.checkPermission("sales_order", "change") ||
|
||||
api.checkPermission("return_order", "change")) {
|
||||
|
||||
actions.add(
|
||||
customBarcodeAction(
|
||||
context, this,
|
||||
widget.supplierPart.customBarcode,
|
||||
"supplierpart",
|
||||
widget.supplierPart.pk
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
@override
|
||||
List<Widget> appBarActions(BuildContext context) {
|
||||
List<Widget> actions = [];
|
||||
|
||||
if (api.checkPermission("purchase_order", "change") ||
|
||||
api.checkPermission("sales_order", "change") ||
|
||||
api.checkPermission("return_order", "change")) {
|
||||
actions.add(
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit_square),
|
||||
tooltip: L10().edit,
|
||||
onPressed: () {
|
||||
editSupplierPart(context);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> request(BuildContext context) async {
|
||||
final bool result = widget.supplierPart.pk > 0 && await widget.supplierPart.reload();
|
||||
@ -179,60 +205,14 @@ class _SupplierPartDisplayState extends RefreshableState<SupplierPartDetailWidge
|
||||
return tiles;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a list of actions which can be performed for this SupplierPart
|
||||
*/
|
||||
List<Widget> actionTiles(BuildContext context) {
|
||||
List<Widget> tiles = [];
|
||||
|
||||
tiles.add(
|
||||
customBarcodeActionTile(context, this, widget.supplierPart.customBarcode, "supplierpart", widget.supplierPart.pk)
|
||||
);
|
||||
|
||||
return tiles;
|
||||
}
|
||||
|
||||
Widget getSelectedWidget(int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return ListView(
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: detailTiles(context),
|
||||
).toList()
|
||||
);
|
||||
case 1:
|
||||
return ListView(
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: actionTiles(context)
|
||||
).toList()
|
||||
);
|
||||
default:
|
||||
return ListView();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget getBody(BuildContext context) {
|
||||
return getSelectedWidget(tabIndex);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget getBottomNavBar(BuildContext context) {
|
||||
return BottomNavigationBar(
|
||||
currentIndex: tabIndex,
|
||||
onTap: onTabSelectionChanged,
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
icon: FaIcon(FontAwesomeIcons.circleInfo),
|
||||
label: L10().details,
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: FaIcon(FontAwesomeIcons.wrench),
|
||||
label: L10().actions
|
||||
)
|
||||
]
|
||||
return ListView(
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: detailTiles(context),
|
||||
).toList()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user