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
74 lines
1.6 KiB
Dart
74 lines
1.6 KiB
Dart
import "package:flutter/material.dart";
|
|
import "package:font_awesome_flutter/font_awesome_flutter.dart";
|
|
import "package:inventree/api.dart";
|
|
import "package:inventree/inventree/part.dart";
|
|
import "package:inventree/widget/refreshable_state.dart";
|
|
import "package:flutter_markdown/flutter_markdown.dart";
|
|
import "package:inventree/l10.dart";
|
|
|
|
|
|
class PartNotesWidget extends StatefulWidget {
|
|
|
|
const PartNotesWidget(this.part, {Key? key}) : super(key: key);
|
|
|
|
final InvenTreePart part;
|
|
|
|
@override
|
|
_PartNotesState createState() => _PartNotesState(part);
|
|
}
|
|
|
|
|
|
class _PartNotesState extends RefreshableState<PartNotesWidget> {
|
|
|
|
_PartNotesState(this.part);
|
|
|
|
final InvenTreePart part;
|
|
|
|
@override
|
|
Future<void> request(BuildContext context) async {
|
|
await part.reload();
|
|
}
|
|
|
|
@override
|
|
String getAppBarTitle() => L10().partNotes;
|
|
|
|
@override
|
|
List<Widget> appBarActions(BuildContext context) {
|
|
|
|
List<Widget> actions = [];
|
|
|
|
if (InvenTreeAPI().checkPermission("part", "change")) {
|
|
actions.add(
|
|
IconButton(
|
|
icon: FaIcon(FontAwesomeIcons.penToSquare),
|
|
tooltip: L10().edit,
|
|
onPressed: () {
|
|
part.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: part.notes,
|
|
);
|
|
}
|
|
|
|
} |