-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev-note-recent-anime'
- Loading branch information
Showing
30 changed files
with
491 additions
and
128 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import 'package:flutter_test_future/models/anime.dart'; | ||
import 'package:flutter_test_future/models/enum/note_type.dart'; | ||
import 'package:flutter_test_future/utils/sqlite_util.dart'; | ||
|
||
class EpisodeNoteDao { | ||
/// 获取最近创建笔记的动漫 | ||
static getAnimesRecentlyCreateNote({NoteType? noteType}) async { | ||
String whereSql = ''; | ||
switch (noteType) { | ||
case NoteType.episode: | ||
whereSql = 'where episode_number > 0'; | ||
break; | ||
case NoteType.rate: | ||
whereSql = 'where episode_number = 0'; | ||
break; | ||
default: | ||
} | ||
|
||
final rows = await SqliteUtil.database.rawQuery(''' | ||
select distinct episode_note.anime_id from episode_note | ||
$whereSql | ||
order by episode_note.note_id desc | ||
'''); | ||
List<Anime> animes = []; | ||
|
||
for (final row in rows) { | ||
int? animeId = row['anime_id'] as int?; | ||
if (animeId == null) continue; | ||
|
||
final anime = await SqliteUtil.getAnimeByAnimeId(animeId); | ||
if (anime.isCollected()) { | ||
animes.add(anime); | ||
} | ||
} | ||
|
||
return animes; | ||
} | ||
} |
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,11 @@ | ||
class AnimeEpisodeInfo { | ||
int totalCnt; // 总集数 | ||
int startNumber; // 起始集 | ||
bool calNumberFromOne; // 是否从1开始计算 | ||
|
||
AnimeEpisodeInfo({ | ||
this.totalCnt = 0, | ||
this.startNumber = 1, | ||
this.calNumberFromOne = false, | ||
}); | ||
} |
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,7 @@ | ||
enum NoteType { | ||
episode('笔记'), | ||
rate('评价'); | ||
|
||
final String title; | ||
const NoteType(this.title); | ||
} |
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,14 +1,17 @@ | ||
class NoteFilter { | ||
int? animeId; | ||
String animeNameKeyword; | ||
String noteContentKeyword; | ||
|
||
NoteFilter({this.animeNameKeyword = "", this.noteContentKeyword = ""}); | ||
NoteFilter( | ||
{this.animeNameKeyword = "", this.noteContentKeyword = "", this.animeId}); | ||
|
||
bool hasFilter() => | ||
animeNameKeyword.isNotEmpty || noteContentKeyword.isNotEmpty; | ||
|
||
String get valueKeyStr => toString(); | ||
|
||
@override | ||
String toString() { | ||
return "NoteFilter[animeNameKeyword=$animeNameKeyword, noteContentKeyword=$noteContentKeyword]"; | ||
} | ||
String toString() => | ||
'NoteFilter(animeId: $animeId, animeNameKeyword: $animeNameKeyword, noteContentKeyword: $noteContentKeyword)'; | ||
} |
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
Oops, something went wrong.