Skip to content

Commit

Permalink
sort tags by alphabetical order
Browse files Browse the repository at this point in the history
  • Loading branch information
judemont committed Apr 28, 2024
1 parent 4ffe53f commit c53de55
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/screens/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class _HomePageState extends State<HomePage> {

Future<void> loadTags() async {
List<Tag> result = await DatabaseService.getTags();
result.sort((a, b) => (a.name ?? "").compareTo(b.name ?? ""));
setState(() {
tags = result;
});
Expand Down
1 change: 1 addition & 0 deletions lib/screens/recipe_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class _RecipeEditorPageState extends State<RecipeEditorPage> {
DatabaseService.getTags().then((List<Tag> result) {
setState(() {
tags = result;
tags.sort((a, b) => (a.name ?? "").compareTo(b.name ?? ""));
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utilities/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class DatabaseService {
static Future<void> removeTagLink({int? tagId, int? recipeId}) async {
final db = await DatabaseService.initializeDb();
db.delete("TagsLinks",
where: "tagId = ${tagId ?? "*"} AND recipeId = ${recipeId ?? "*"}");
where: "tagId = ${tagId ?? "tagId"} AND recipeId = ${recipeId ?? "*"}");
}

static Future<void> updateRecipe(Recipe recipe) async {
Expand Down

0 comments on commit c53de55

Please sign in to comment.