From 4decd1787585f16ef448a3f18b5acec89a40919c Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Sun, 12 Apr 2020 11:50:32 +0200 Subject: [PATCH] Add comment field to recording --- lib/database.moor | 3 ++- lib/editors/recording.dart | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/database.moor b/lib/database.moor index 690b44f..c53833a 100644 --- a/lib/database.moor +++ b/lib/database.moor @@ -32,7 +32,8 @@ CREATE TABLE ensembles ( CREATE TABLE recordings ( id INTEGER NOT NULL PRIMARY KEY, - work INTEGER REFERENCES works(id) + work INTEGER REFERENCES works(id), + comment TEXT NOT NULL ); CREATE TABLE performances ( diff --git a/lib/editors/recording.dart b/lib/editors/recording.dart index 8ff27cc..430a7dd 100644 --- a/lib/editors/recording.dart +++ b/lib/editors/recording.dart @@ -18,6 +18,8 @@ class RecordingEditor extends StatefulWidget { } class _RecordingEditorState extends State { + final commentController = TextEditingController(); + Work work; List performances = []; @@ -59,6 +61,7 @@ class _RecordingEditorState extends State { final recording = Recording( id: widget.recording?.id ?? generateId(), work: work.id, + comment: commentController.text, ); await backend.db.updateRecording(recording, performances); @@ -79,6 +82,20 @@ class _RecordingEditorState extends State { subtitle: Text('Select work'), onTap: selectWork, ), + Padding( + padding: const EdgeInsets.only( + left: 16.0, + right: 16.0, + top: 0.0, + bottom: 16.0, + ), + child: TextField( + controller: commentController, + decoration: InputDecoration( + labelText: 'Comment', + ), + ), + ), ListTile( title: Text('Performers'), trailing: IconButton(