Add comment field to recording

This commit is contained in:
Elias Projahn 2020-04-12 11:50:32 +02:00
parent e9f0bd03e7
commit 4decd17875
2 changed files with 19 additions and 1 deletions

View file

@ -32,7 +32,8 @@ CREATE TABLE ensembles (
CREATE TABLE recordings ( CREATE TABLE recordings (
id INTEGER NOT NULL PRIMARY KEY, id INTEGER NOT NULL PRIMARY KEY,
work INTEGER REFERENCES works(id) work INTEGER REFERENCES works(id),
comment TEXT NOT NULL
); );
CREATE TABLE performances ( CREATE TABLE performances (

View file

@ -18,6 +18,8 @@ class RecordingEditor extends StatefulWidget {
} }
class _RecordingEditorState extends State<RecordingEditor> { class _RecordingEditorState extends State<RecordingEditor> {
final commentController = TextEditingController();
Work work; Work work;
List<PerformanceModel> performances = []; List<PerformanceModel> performances = [];
@ -59,6 +61,7 @@ class _RecordingEditorState extends State<RecordingEditor> {
final recording = Recording( final recording = Recording(
id: widget.recording?.id ?? generateId(), id: widget.recording?.id ?? generateId(),
work: work.id, work: work.id,
comment: commentController.text,
); );
await backend.db.updateRecording(recording, performances); await backend.db.updateRecording(recording, performances);
@ -79,6 +82,20 @@ class _RecordingEditorState extends State<RecordingEditor> {
subtitle: Text('Select work'), subtitle: Text('Select work'),
onTap: selectWork, 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( ListTile(
title: Text('Performers'), title: Text('Performers'),
trailing: IconButton( trailing: IconButton(