mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-20 22:16:23 +00:00
.github
android
assets
ios
lib
barcode
generated
inventree
l10n
settings
widget
company
order
part
stock
attachment_widget.dart
back.dart
dialogs.dart
drawer.dart
fields.dart
home.dart
notes_widget.dart
notifications.dart
paginator.dart
progress.dart
refreshable_state.dart
search.dart
snacks.dart
spinner.dart
api.dart
api_form.dart
app_colors.dart
dsn.dart
helpers.dart
l10.dart
labels.dart
main.dart
preferences.dart
user_profile.dart
res
test
.gitignore
.gitmodules
.metadata
BUILDING.md
LICENSE
README.md
analysis_options.yaml
crowdin.yml
find_dart_files.py
l10n.yaml
pubspec.lock
pubspec.yaml
requirements.txt
tasks.py
* Change from fontawesome to tabler icons - Consistent with the frontend * Cleanup conflicts * Use double quotes * remove unused import * Update release notes * Migrate some google icons to tabler icons * Icon update * Properly support display of custom icons * Fix lookup
81 lines
1.7 KiB
Dart
81 lines
1.7 KiB
Dart
import "package:flutter/material.dart";
|
|
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
|
|
import "package:inventree/inventree/model.dart";
|
|
import "package:inventree/widget/refreshable_state.dart";
|
|
import "package:flutter_markdown/flutter_markdown.dart";
|
|
import "package:inventree/l10.dart";
|
|
|
|
|
|
/*
|
|
* A widget for displaying the notes associated with a given model.
|
|
* We need to pass in the following parameters:
|
|
*
|
|
* - Model instance
|
|
* - Title for the app bar
|
|
*/
|
|
class NotesWidget extends StatefulWidget {
|
|
|
|
const NotesWidget(this.model, {Key? key}) : super(key: key);
|
|
|
|
final InvenTreeModel model;
|
|
|
|
@override
|
|
_NotesState createState() => _NotesState();
|
|
}
|
|
|
|
|
|
/*
|
|
* Class representing the state of the NotesWidget
|
|
*/
|
|
class _NotesState extends RefreshableState<NotesWidget> {
|
|
|
|
_NotesState();
|
|
|
|
@override
|
|
Future<void> request(BuildContext context) async {
|
|
await widget.model.reload();
|
|
}
|
|
|
|
@override
|
|
String getAppBarTitle() => L10().editNotes;
|
|
|
|
@override
|
|
List<Widget> appBarActions(BuildContext context) {
|
|
|
|
List<Widget> actions = [];
|
|
|
|
if (widget.model.canEdit) {
|
|
actions.add(
|
|
IconButton(
|
|
icon: Icon(TablerIcons.edit),
|
|
tooltip: L10().edit,
|
|
onPressed: () {
|
|
widget.model.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: widget.model.notes,
|
|
);
|
|
}
|
|
|
|
} |