Skip to content

Commit

Permalink
fixed old method call for getting labels
Browse files Browse the repository at this point in the history
fixed wrong datetime stamp for labels
  • Loading branch information
Benimautner committed May 23, 2022
1 parent 7449b97 commit 6a2e41b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/api/labels.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class LabelAPIService extends APIService implements LabelService {
String params =
query == '' ? null : '?s=' + Uri.encodeQueryComponent(query);
return client.get('/labels$params').then(
(label) => convertList(label, (result) => Label.fromJson(result)));
(response) => convertList(response.body, (result) => Label.fromJson(result)));
}

@override
Expand Down
4 changes: 2 additions & 2 deletions lib/models/label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Label {
'hex_color':
color?.value?.toRadixString(16)?.padLeft(8, '0')?.substring(2),
'created_by': createdBy?.toJSON(),
'updated': updated?.millisecondsSinceEpoch,
'created': created?.millisecondsSinceEpoch,
'updated': updated?.toUtc()?.toIso8601String(),
'created': created?.toUtc()?.toIso8601String(),
};
}
12 changes: 6 additions & 6 deletions lib/pages/list/task_edit.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:vikunja_app/components/datetimePicker.dart';
Expand Down Expand Up @@ -258,13 +260,9 @@ class _TaskEditPageState extends State<TaskEditPage> {
controller: _labelTypeAheadController,
decoration:
InputDecoration(labelText: 'Add a new label')),
suggestionsCallback: (pattern) {
return _searchLabel(pattern);
},
suggestionsCallback: (pattern) => _searchLabel(pattern),
itemBuilder: (context, suggestion) {
return ListTile(
title: Text(suggestion),
);
return Text(suggestion);
},
transitionBuilder: (context, suggestionsBox, controller) {
return suggestionsBox;
Expand Down Expand Up @@ -366,6 +364,7 @@ class _TaskEditPageState extends State<TaskEditPage> {
.labelService
.getAll(query: query)
.then((labels) {
log("searched");
// Only show those labels which aren't already added to the task
labels.removeWhere((labelToRemove) => _labels.contains(labelToRemove));
_suggestedLabels = labels;
Expand All @@ -386,6 +385,7 @@ class _TaskEditPageState extends State<TaskEditPage> {
if (found) {
_labelTypeAheadController.clear();
}
setState(() {});
}

_createAndAddLabel(String labelTitle) {
Expand Down

0 comments on commit 6a2e41b

Please sign in to comment.