diff --git a/lib/pages/list/task_edit.dart b/lib/pages/list/task_edit.dart index 14ba703..4c07e5c 100644 --- a/lib/pages/list/task_edit.dart +++ b/lib/pages/list/task_edit.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_typeahead/flutter_typeahead.dart'; - import 'package:vikunja_app/components/datetimePicker.dart'; import 'package:vikunja_app/components/label.dart'; import 'package:vikunja_app/global.dart'; @@ -240,13 +239,10 @@ class _TaskEditPageState extends State { }).toList()), TypeAheadFormField( textFieldConfiguration: TextFieldConfiguration( - controller: _typeAheadController, - decoration: InputDecoration( - labelText: 'City' - ) - ), + //controller: _typeAheadController, + decoration: InputDecoration(labelText: 'City')), suggestionsCallback: (pattern) { - return CitiesService.getSuggestions(pattern); + return _searchLabel(pattern); }, itemBuilder: (context, suggestion) { return ListTile( @@ -322,12 +318,13 @@ class _TaskEditPageState extends State { }); } - _removeLabel(Label label) { - - } + _removeLabel(Label label) {} _searchLabel(String query) { - VikunjaGlobal.of(context) + return VikunjaGlobal.of(context) + .labelService + .getAll(query: query) + .then((labels) => labels.map((label) => label.title).toList()); } // FIXME: Move the following two functions to an extra class or type.