mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01:00
Recording editor: Initialize from recording
This commit is contained in:
parent
be06eabdd7
commit
97c4359ad9
1 changed files with 13 additions and 5 deletions
|
|
@ -11,10 +11,13 @@ import '../selectors/work.dart';
|
||||||
/// If the user has finished editing, the result will be returned using the
|
/// If the user has finished editing, the result will be returned using the
|
||||||
/// navigator as a [RecordingSelectorResult] object.
|
/// navigator as a [RecordingSelectorResult] object.
|
||||||
class RecordingEditor extends StatefulWidget {
|
class RecordingEditor extends StatefulWidget {
|
||||||
final Recording recording;
|
/// The recording to edit.
|
||||||
|
///
|
||||||
|
/// If this is null, a new recording will be created.
|
||||||
|
final RecordingInfo recordingInfo;
|
||||||
|
|
||||||
RecordingEditor({
|
RecordingEditor({
|
||||||
this.recording,
|
this.recordingInfo,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -31,8 +34,13 @@ class _RecordingEditorState extends State<RecordingEditor> {
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
if (widget.recording != null) {
|
if (widget.recordingInfo != null) {
|
||||||
// TODO: Initialize.
|
final backend = Backend.of(context);
|
||||||
|
|
||||||
|
() async {
|
||||||
|
workInfo = await backend.db.getWork(widget.recordingInfo.recording.id);
|
||||||
|
performanceInfos = List.from(widget.recordingInfo.performances);
|
||||||
|
}();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,7 +108,7 @@ class _RecordingEditorState extends State<RecordingEditor> {
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final recordingInfo = RecordingInfo(
|
final recordingInfo = RecordingInfo(
|
||||||
recording: Recording(
|
recording: Recording(
|
||||||
id: widget.recording?.id ?? generateId(),
|
id: widget?.recordingInfo?.recording?.id ?? generateId(),
|
||||||
work: workInfo.work.id,
|
work: workInfo.work.id,
|
||||||
comment: commentController.text,
|
comment: commentController.text,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue