Skip to content

Commit 8b7e6a2

Browse files
committed
upgraded typeahead controller to fix bug introduced with new flutter version, upgraded to flutter version
1 parent ccef93c commit 8b7e6a2

File tree

6 files changed

+108
-80
lines changed

6 files changed

+108
-80
lines changed

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ android {
4141

4242
defaultConfig {
4343
applicationId "io.vikunja.app"
44-
minSdkVersion 19
44+
minSdkVersion 21
4545
targetSdkVersion 33
4646
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
4747
versionCode flutterVersionCode.toInteger()

android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
FlutterApplication and put your custom class here. -->
1717
<application
1818
android:label="Vikunja"
19+
android:name="${applicationName}"
1920
android:icon="@mipmap/ic_launcher"
2021
android:usesCleartextTraffic="true">
2122
<activity

lib/pages/list/task_edit.dart

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,22 +323,28 @@ class _TaskEditPageState extends State<TaskEditPage> {
323323
left: 2.0 + (IconTheme.of(context).size??0))),
324324
Container(
325325
width: MediaQuery.of(context).size.width - 80 - ((IconTheme.of(context).size ?? 0) * 2),
326-
child: TypeAheadFormField(
327-
textFieldConfiguration: TextFieldConfiguration(
326+
child: TypeAheadField(
327+
builder: (builder, controller, focusnode) {
328+
return TextFormField(
328329
controller: _labelTypeAheadController,
330+
focusNode: focusnode,
329331
decoration: InputDecoration(
330-
labelText: 'Add a new label')),
332+
labelText: 'Add a new label',
333+
border: InputBorder.none,
334+
),
335+
);
336+
},
331337
suggestionsCallback: (pattern) =>
332338
_searchLabel(pattern),
333339
itemBuilder: (context, suggestion) {
334340
return new ListTile(
335341
title: Text(suggestion.toString()));
336342
},
337-
transitionBuilder:
338-
(context, suggestionsBox, controller) {
339-
return suggestionsBox;
340-
},
341-
onSuggestionSelected: (suggestion) {
343+
//transitionBuilder:
344+
// (context, suggestionsBox, controller) {
345+
// return suggestionsBox;
346+
//},
347+
onSelected: (suggestion) {
342348
_addLabel(suggestion.toString());
343349
},
344350
),

lib/pages/user/login.dart

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class _LoginPageState extends State<LoginPage> {
3131
final _usernameController = TextEditingController();
3232
final _passwordController = TextEditingController();
3333

34-
final _serverSuggestionController = SuggestionsBoxController();
34+
final _serverSuggestionController = SuggestionsController();
3535

3636

3737
@override
@@ -89,25 +89,38 @@ class _LoginPageState extends State<LoginPage> {
8989
padding: vStandardVerticalPadding,
9090
child: Row(children: [
9191
Expanded(
92-
child: TypeAheadFormField(
93-
suggestionsBoxController: _serverSuggestionController,
94-
getImmediateSuggestions: true,
95-
enabled: !_loading,
96-
validator: (address) {
97-
return (isUrl(address) ||
92+
child: TypeAheadField(
93+
//suggestionsBoxController: _serverSuggestionController,
94+
//getImmediateSuggestions: true,
95+
//enabled: !_loading,
96+
controller: _serverController,
97+
builder: (context, controller, focusnode) {
98+
return TextFormField(
99+
controller: controller,
100+
focusNode: focusnode,
101+
enabled: !_loading,
102+
validator: (address) {
103+
return (isUrl(address) ||
98104
address != null ||
99105
address!.isEmpty)
100106
? null
101-
: 'Invalid URL';
107+
: 'Invalid URL';
108+
},
109+
decoration: new InputDecoration(
110+
border: OutlineInputBorder(),
111+
labelText: 'Server Address'),
112+
);
102113
},
114+
/*
103115
textFieldConfiguration: TextFieldConfiguration(
104116
controller: _serverController,
105117
decoration: new InputDecoration(
106118
border: OutlineInputBorder(),
107119
labelText: 'Server Address'),
108-
),
109-
onSuggestionSelected: (suggestion) {
120+
),*/
121+
onSelected: (suggestion) {
110122
_serverController.text = suggestion;
123+
setState(() => _serverController.text = suggestion);
111124
},
112125
itemBuilder: (BuildContext context, Object? itemData) {
113126
return Card(
@@ -121,7 +134,7 @@ class _LoginPageState extends State<LoginPage> {
121134
IconButton(onPressed: () {
122135
setState(() {
123136
pastServers.remove(itemData.toString());
124-
_serverSuggestionController.suggestionsBox?.close();
137+
//_serverSuggestionController.suggestionsBox?.close();
125138
VikunjaGlobal.of(context).settingsManager.setPastServers(pastServers);
126139

127140
});

0 commit comments

Comments
 (0)