-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autocomplete format tags #396
Conversation
var caretIndex = widget.controller.selection.baseOffset; | ||
String lastLine = text.substring(0, caretIndex).split('\n').last; | ||
RegExp r = RegExp(r'\[\[((?!([\]])).)*$'); | ||
bool showTitleLinks = r.hasMatch(lastLine); | ||
return showTitleLinks; | ||
} | ||
|
||
bool checkIsTagsVisible(String text) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge this function with checkIsTitleLinksVisible
and add a regex parameter as an input. Not sure what time name it tho lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool checkIsSuggestionsVisible(String text, RegExp r)
if (isVisible) { | ||
bool isTitleLinksVisible = checkIsTitleLinksVisible(text); | ||
bool isTagsVisible = checkIsTagsVisible(text); | ||
if (isTitleLinksVisible) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see if it's possible to put everything within this if statement into a function. it looks identical to the if statement below. we want to reuse logic as much as possible so it'll be easier to make changes in the future :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be hard with the titleLinksVisible = true
@@ -109,6 +119,20 @@ class _ContentFieldState extends State<ContentField> { | |||
titleLinksVisible = false; | |||
removeOverlay(); | |||
} | |||
|
|||
if (isTagsVisible) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the identical if statement
@@ -124,14 +148,22 @@ class _ContentFieldState extends State<ContentField> { | |||
} | |||
|
|||
// Helper Functions | |||
bool isTitleLinksVisible(String text) { | |||
bool checkIsTitleLinksVisible(String text) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checkIsSuggestionsVisible
@@ -185,9 +217,55 @@ class _ContentFieldState extends State<ContentField> { | |||
child: ValueListenableBuilder( | |||
valueListenable: titleLinkQuery, | |||
builder: (context, value, child) { | |||
return LinkSuggestions( | |||
return Suggestions( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good on you to rename this ;)
@@ -41,6 +41,12 @@ | |||
<category android:name="android.intent.category.DEFAULT" /> | |||
<data android:mimeType="text/*" /> | |||
</intent-filter> | |||
<!-- "Take a note" command https://developer.android.com/guide/components/intents-common#NewNote --> | |||
<intent-filter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shouldn't be here, the google assistant stuff.
import android.os.Bundle | ||
import io.flutter.embedding.android.FlutterActivity | ||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK | ||
|
||
class MainActivity: FlutterActivity() { | ||
private var savedNote: String? = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shouldn't be here, the google assistant stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump
lib/services/database.dart
Outdated
@@ -112,6 +112,21 @@ class Database { | |||
return linkSet.toList(); | |||
} | |||
|
|||
Future<List<String>> getAllTags() async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol can we make another function Future<List<String>> getAllRegex(Regexp r)
and have these two functions call that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one should be ez to merge the logic tho
|
||
void showTagsOverlay(context, BoxConstraints size) async { | ||
print('e'); | ||
_onLinkSelect(String link) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably rename this to _onTagSelect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again i'd really like it if we could merge the logic but it seems like it might be a lot of work. ill let you decide if it's worth your time
t.substring(0, tagIndex) + '#$tag' + t.substring(caretI, t.length); | ||
widget.controller.selection = TextSelection.fromPosition( | ||
TextPosition(offset: tagIndex + tag.length + 1)); | ||
widget.db.firebase.analytics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this
Closes #396 |
when I type the word out, the autocomplete disappears. Also, I will pick up this ticket. i think it's more worth your time to work on other things Screen.Recording.2022-10-29.at.7.35.12.AM.mov |
d2f1062
to
e3baebf
Compare
I want to create a new widget called |
Closed by #609 |
Closes #138