2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 02:05:29 +00:00

Enable multi-line text editing for API forms

- User can edit part notes
- User can edit stock item notes
This commit is contained in:
Oliver
2021-07-28 16:19:42 +10:00
parent b8379e05db
commit d6a2a41ab2
10 changed files with 129 additions and 82 deletions

View File

@ -22,8 +22,6 @@ import 'package:inventree/widget/snacks.dart';
*/
class APIFormField {
final _controller = TextEditingController();
// Constructor
APIFormField(this.name, this.data);
@ -47,6 +45,8 @@ class APIFormField {
// Is this field read only?
bool get readOnly => (data['read_only'] ?? false) as bool;
bool get multiline => (data['multiline'] ?? false) as bool;
// Get the "value" as a string (look for "default" if not available)
dynamic get value => (data['value'] ?? data['default']);
@ -341,6 +341,8 @@ class APIFormField {
helperStyle: _helperStyle(),
hintText: placeholderText,
),
maxLines: multiline ? null : 1,
expands: false,
initialValue: value ?? '',
onSaved: (val) {
data["value"] = val;