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
77 lines
1.7 KiB
Dart
77 lines
1.7 KiB
Dart
|
|
import "package:flutter/material.dart";
|
|
import "package:font_awesome_flutter/font_awesome_flutter.dart";
|
|
import "package:inventree/inventree/stock.dart";
|
|
import "package:inventree/widget/refreshable_state.dart";
|
|
import "package:flutter_markdown/flutter_markdown.dart";
|
|
import "package:inventree/l10.dart";
|
|
|
|
import "package:inventree/api.dart";
|
|
|
|
|
|
class StockNotesWidget extends StatefulWidget {
|
|
|
|
const StockNotesWidget(this.item, {Key? key}) : super(key: key);
|
|
|
|
final InvenTreeStockItem item;
|
|
|
|
@override
|
|
_StockNotesState createState() => _StockNotesState(item);
|
|
}
|
|
|
|
|
|
class _StockNotesState extends RefreshableState<StockNotesWidget> {
|
|
|
|
_StockNotesState(this.item);
|
|
|
|
final InvenTreeStockItem item;
|
|
|
|
@override
|
|
String getAppBarTitle() => L10().stockItemNotes;
|
|
|
|
@override
|
|
Future<void> request(BuildContext context) async {
|
|
if (item.pk > 0) {
|
|
await item.reload();
|
|
}
|
|
}
|
|
|
|
@override
|
|
List<Widget> appBarActions(BuildContext context) {
|
|
List<Widget> actions = [];
|
|
|
|
if (InvenTreeAPI().checkPermission("stock", "change")) {
|
|
actions.add(
|
|
IconButton(
|
|
icon: FaIcon(FontAwesomeIcons.penToSquare),
|
|
tooltip: L10().edit,
|
|
onPressed: () {
|
|
item.editForm(
|
|
context,
|
|
L10().editNotes,
|
|
fields: {
|
|
"notes": {
|
|
"multiline": true,
|
|
}
|
|
},
|
|
onSuccess: (data) async {
|
|
refresh(context);
|
|
}
|
|
);
|
|
}
|
|
)
|
|
);
|
|
}
|
|
|
|
return actions;
|
|
}
|
|
|
|
@override
|
|
Widget getBody(BuildContext context) {
|
|
return Markdown(
|
|
selectable: false,
|
|
data: item.notes,
|
|
);
|
|
}
|
|
|
|
} |