-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
85 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:lyric/services/cue/from_uuid.dart'; | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
import '../../../data/cue/slide.dart'; | ||
|
||
part 'watch_revived.g.dart'; | ||
|
||
@riverpod | ||
Stream<List<Slide>> watchRevivedSlidesForCueWithUuid(Ref ref, String uuid) async* { | ||
final cue = ref.watch(watchCueWithUuidProvider(uuid)); | ||
|
||
if (cue.hasValue) { | ||
yield await cue.requireValue.getRevivedSlides(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,48 @@ | ||
import 'package:drift/drift.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
import 'package:uuid/v4.dart'; | ||
|
||
import '../../data/cue/cue.dart'; | ||
import '../../data/cue/slide.dart'; | ||
import '../../data/database.dart'; | ||
|
||
part 'write_cue.g.dart'; | ||
|
||
@riverpod | ||
Future insertNewCue(Ref ref, NewCue newCue) async { | ||
// we ignore generated id | ||
await db.into(db.cues).insert(Cue.newCueToCompanion(newCue)); | ||
Future insertNewCue(Ref ref, {required String title, String? description}) async { | ||
await db.into(db.cues).insert( | ||
CuesCompanion( | ||
id: Value.absent(), | ||
uuid: Value(UuidV4().generate()), | ||
title: Value(title), | ||
description: description != null ? Value(description) : Value.absent(), | ||
cueVersion: Value(currentCueVersion), | ||
content: Value([]), | ||
), | ||
); | ||
} | ||
|
||
@riverpod | ||
Future updateCueMetadataFor(Ref ref, int id, {String? title, String? description}) async { | ||
await (db.update(db.cues)..where((c) => c.id.equals(id))).write( | ||
CuesCompanion( | ||
title: Value.absentIfNull(title), | ||
description: Value.absentIfNull(description), | ||
), | ||
); | ||
} | ||
|
||
@riverpod | ||
Future updateSlidesOfCue(Ref ref, Cue cue) async { | ||
//cue.updateContentJson(); | ||
|
||
throw UnimplementedError(); | ||
} | ||
|
||
/* | ||
@riverpod | ||
Future updateCueWith(Ref ref, int id, CuesCompanion data) async { | ||
await (db.update(db.cues)..where((e) => e.id.equals(id))).write(data); | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters