santa112358 / hashtagable Goto Github PK
View Code? Open in Web Editor NEWWidgets and functions to implement hashTag decorated text.
Home Page: https://pub.dev/packages/hashtagable
License: MIT License
Widgets and functions to implement hashTag decorated text.
Home Page: https://pub.dev/packages/hashtagable
License: MIT License
Latest stable Provider is 6.x.
Because hashtagable 2.0.2+1 depends on provider ^5.0.0 and no versions of hashtagable match >2.0.2+1 <3.0.0, hashtagable ^2.0.2+1 requires provider ^5.0.0.
So, because my_app depends on both provider ^6.0.0 and hashtagable ^2.0.2+1, version solving failed.
Running "flutter pub get" in my-app...
pub get failed (1; So, because my_app depends on both provider ^6.0.0 and hashtagable ^2.0.2+1, version solving failed.)
Hello,
First off, this package is awesome and has helped us a lot so thank you for creating it.
I am needing to have a different style for @-strings than for #-strings. Is this currently possible? I only see the one decoartedStyle
field. Just wanted to see if I was missing something.
Need to update readme, especially its gif video and image
Hey, @santa112358 I have a new feature request want to discuss with you.
Recently I have faced a scenario where I want to fix the number of hashtags that are entered by the user. After a given number of limitations, the hashtag field cannot be allowed to enter more hashtags.
I am attaching the screenshot too for more clarification. Thanks!
@SchnMar @matheusperez
I decided to show contributors with github account in the bottom of read me from v1.0.1. Let me know if you don't want me to do that. I will hide your name from readme.
I will close this issue one week later.
hi,
Function extractHashTags should accept a decorateAtSign params.
Thx,
Nelson
This issue similar to #35.
hashtagable: 2.0.1
HashTagTextField(
controller: state.controller,
focusNode: state.focusNode,
keyboardType: TextInputType.multiline,
maxLines: null,
decoration: InputDecoration(
hintText: 'Add a comment',
isCollapsed: true,
contentPadding: EdgeInsets.symmetric(horizontal: 8, vertical: 9),
),
decoratedStyle: Theme.of(context).textTheme.bodyText1.apply(color: Theme.of(context).primaryColor),
basicStyle: Theme.of(context).textTheme.bodyText1.apply(color: Colors.black),
decorateAtSign: true,
onDetectionTyped: (str) {
print(str);
},
),
it prints:
I/flutter (19414): @ja
I/flutter (19414): @jan
I/flutter (19414): @jane
I/flutter (19414): @j
I/flutter (19414): @jo
I/flutter (19414): @joh
I/flutter (19414): @john
I/flutter (19414): #h
I/flutter (19414): #hi
I/flutter (19414): #hik
I/flutter (19414): #hiki
I/flutter (19414): #hikin
I/flutter (19414): #hiking
hello!
thanks for that awesome lib. Would it be possible to add support for Norwegian Bokmål and Nynorsk? It's a requirement for project I work on to have those two supported. Thanks in advance!
https://en.wikipedia.org/wiki/Nynorsk
https://en.wikipedia.org/wiki/Bokm%C3%A5l
Hi! Thanks for the wonderful library - is it possible to show auto-complete suggestions just below the HashTagEditableText
I tried adding Overlay
but there seems to be some issue with Opacity - was wondering if the feature is in-built
Thanks
These methods are not called for HashTagEditableText.
This is not possible to use:
style: GoogleFonts.roboto( fontSize: 12, fontWeight: FontWeight.w200, ),
I get with error when trying to run an app with HashTagable:
** BUILD FAILED **
Xcode's output:
↳
../sdk/.pub-cache/hosted/pub.dartlang.org/hashtagable-2.0.1/lib/widgets/hashtag_text_field.dart:1422:20: Error: The getter 'scrollShortcutOverrides' isn't defined for the class '_HashTagTextFieldState'.
- '_HashTagTextFieldState' is from 'package:hashtagable/widgets/hashtag_text_field.dart' ('../sdk/.pub-cache/hosted/pub.dartlang.org/hashtagable-2.0.1/lib/widgets/hashtag_text_field.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'scrollShortcutOverrides'.
shortcuts: scrollShortcutOverrides,
^^^^^^^^^^^^^^^^^^^^^^^
../sdk/.pub-cache/hosted/pub.dartlang.org/hashtagable-2.0.1/lib/widgets/hashtag_editable_text.dart:218:45: Error: Required named parameter 'context' must be provided.
return widget.controller.buildTextSpan(
Hello @santa112358,
another feature idea would be that people can select a hashtag from a list of values, so already used hashtags can be reused. On top of that, the list could be filtered when a user enters values after the # sign.
Thank you
hi @santa112358, I think if this can handle links that start with http or https so that it can be clicked by the user it will be better than just displaying http or https like regular text.
Please add the Hungarian letters too:
á,é,í,ó,ö,ő,ú,ű
Only these are not supported now: ű, ő
Hi all,
Plugin is awesome !
For my use case, i need to decorate @ and +
So i have to tweak plugin code:
final hashTagAtSignRegExp = RegExp(
"(?!\\n)(?:^|\\s)([+@]([$hashTagContentLetters]+))",
multiLine: true,
);
It will be awesome to have a decorateYourSign => '+@' who decorate + and @
Thank you,
Nelson
I would like to copy text like RichText.
While using this package I found a weird behavior when returning a hashtag from the onTap
HashTagText(
text: userText, // Ex: This is my first time using a #hashtag
onTap: (hashtag) => Search.value(hashtag),
overflow: TextOverflow.ellipsis,
maxLines: 3,
),
If I tap on the hashtag I retrieve " #hashtag" with an empty space at the beggining (this doesn't happen if it's the first word).
If I use the method extractHashTags(userText)
I get a list with the hashtags trimmed (I read the code at the end you use trim with every value). This gives some weird behavior when trying to save the list from extractHashTags
and then finding the value selected by the onTap because the empty space at the beggining (using equality or saving the hashtags in a SQL or NoSQL db), I know I could do it myself onTap: (hashtag) => Search.value(hashtag.trim())
but it would be better for the package to return the same type in every method, which I believe doing the trimming could be a time saver to avoid different results
I was trying to paste some text but onLongPress does nothing. This would be a really convenient feature to have.
Necessary to close suggestion list opened by onDetectionTyped
Upgrade from 0.0.4 to 0.1.1
flutter: The following assertion was thrown building HashTagText(dirty):
flutter: 'package:flutter/src/widgets/basic.dart': Failed assertion: line 5076 pos 15: 'textAlign != null':
flutter: is not true.
flutter:
flutter: The relevant error-causing widget was:
flutter: HashTagText file:///Users/FareedR/Sites/lambung-flutter/lib/timeline/timeline.dart:413:35
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2 new RichText (package:flutter/src/widgets/basic.dart:5076:15)
flutter: #3 HashTagText.build (package:hashtagable/hashtag_text.dart:43:12)
flutter: #4 StatelessElement.build (package:flutter/src/widgets/framework.dart:4576:28)
flutter: #5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4502:15)
flutter: #6 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
flutter: #7 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
flutter: #8 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
flutter: #9 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
flutter: #10 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5947:32)
flutter: #11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
flutter: #12 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5947:32)
flutter: ... Normal element mounting (33 frames)
flutter: #45 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
flutter: #46 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
flutter: #47 SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1162:36)
flutter: #48 SliverMultiBoxAdaptorElement.createChild. (package:flutter/src/widgets/sliver.dart:1147:20)
flutter: #49 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2607:19)
flutter: #50 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1140:11)
flutter: #51 RenderSliverMultiBoxAdaptor._createOrObtainChild. (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:354:23)
flutter: #52 RenderObject.invokeLayoutCallback. (package:flutter/src/rendering/object.dart:1866:58)
flutter: #53 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:918:15)
flutter: #54 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1866:13)
flutter: #55 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:343:5)
flutter: #56 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:427:5)
flutter: #57 RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:79:12)
flutter: #58 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #59 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:135:11)
flutter: #60 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:375:11)
flutter: #61 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #62 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:452:13)
flutter: #63 RenderShrinkWrappingViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1783:12)
flutter: #64 RenderShrinkWrappingViewport.performLayout (package:flutter/src/rendering/viewport.dart:1741:20)
flutter: #65 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #66 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #67 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #68 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #69 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #70 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #71 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #72 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #73 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #74 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #75 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #76 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #77 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #78 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:746:15)
flutter: #79 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #80 _RenderSingleChildViewport.performLayout (package:flutter/src/widgets/single_child_scroll_view.dart:512:13)
flutter: #81 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #82 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #83 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #84 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #85 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #86 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #87 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #88 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #89 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #90 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #91 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #92 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #93 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #94 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:11)
flutter: #95 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:484:7)
flutter: #96 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
flutter: #97 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:399:14)
flutter: #98 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #99 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #100 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #101 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
flutter: #102 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1248:11)
flutter: #103 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #104 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:11)
flutter: #105 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:484:7)
flutter: #106 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
flutter: #107 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:399:14)
flutter: #108 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1630:7)
flutter: #109 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:887:18)
flutter: #110 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:402:19)
flutter: #111 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:884:13)
flutter: #112 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5)
flutter: #113 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)
flutter: #114 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1052:9)
flutter: #115 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:968:5)
flutter: #119 _invoke (dart:ui/hooks.dart:261:10)
flutter: #120 _drawFrame (dart:ui/hooks.dart:219:3)
flutter: (elided 5 frames from class _AssertionError and dart:async)
Row( children: <Widget>[ Padding( padding: EdgeInsets.symmetric( horizontal: 20.0, vertical: 2), child: Text( activePost.user.username, style: TextStyle(fontSize: 16), )), HashTagText( text: activePost.description, basicStyle: TextStyle( fontSize: 14, color: Colors.red), decoratedStyle: TextStyle( fontSize: 14, color: Colors.black), ) )
Hey,
it would be nice to have the same function available which is used to extract hash tags in the package so some additional logic can be implemented in regard of the hashtags.
Thank you!
This is the error message on running
`Running Gradle task 'assembleDebug'...
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/hashtagable-2.0.2+1/lib/widgets/hashtag_editable_text.dart:219:9: Error: No named parameter with the name 'context'.
context: context,
^^^^^^^
FAILURE: Build failed with an exception.
Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 19s
Exception: Gradle task assembleDebug failed with exit code 1`
This is flutter doctor
`[√] Flutter (Channel stable, 2.0.4, on Microsoft Windows [Version 10.0.19043.1110], locale en-IN)
• Flutter version 2.0.4 at C:\flutter
• Framework revision b1395592de (4 months ago), 2021-04-01 14:25:01 -0700
• Engine revision 2dce47073a
• Dart version 2.12.2
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:/Users/ritwik reddy/AppData/Local/Android/Sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = C:/Users/ritwik reddy/AppData/Local/Android/Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.57.1)
• VS Code at C:\Users\ritwik reddy\AppData\Local\Programs\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (3 available)
• SM G615FU (mobile) • 4200345e061f45bb • android-arm • Android 8.1.0 (API 27)
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.107
• Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.67
• No issues found!`
Not support Arabic language please support Arabic language which is rtl language thanks
Hello. I would like to detect hashtags that follow without spaces.
for example, if the text is '#hash#tag#search' I would like to extract #hash, #tag, #search. Not just #hash.
so I want to delete this part of your regular expression
(?:^|\s)
Is there any way to do that?
I have some unit tests that tap on the text field and enter text into the text field. These passed when I was using a TextField
widget and the find.byKey
finder. I tried using the find.byWidget(HashTagTextField()
but that didn't work either.
Does anyone know if there is something else needed to find this widget with the flutter test package?
The only error I get is that there is no element found.
Hello
I'm using Flutter Web and using the hashtagable field as follows:
child: HashTagTextField( decoratedStyle: TextStyle(color: blue), decorateAtSign: true, autofocus: true, minLines: 5, maxLines: 7, controller: _content, )
When typing text without any hashtags or @ signs in the field behaves as normal. However as soon as I add a hashtag or @ sign the cursor jumps to the beginning of the text and stays there no matter where I click in the textfield.
Thank you for any help
Trudi
How to display default value in HashTagTextField?
I really need this please..
Is there any way to get list of tags ? Our system requires those tags which needs to be displayed in a separate view.
Now hashtagable has some requests about text detection. They can be solved by fixing the regular expression inside hashtagable, but it causes another problems for other people who were ok with the previous version's regExp.
The method I did when "decorateAtSign" feature implemented avoids the problem, which is adding the boolean argument to detect @
, but it just gets complicated if there are many arguments like "decorate${something}".
I think using regular expression from argument is a better solution for this problem. Developers can use the regular expression set in the package, or their own one.
If this feature is implemented, the name of the package "hashtagable" is no longer suitable for the content. There is a possibility of publishing new package for this change.
Hi,
I have used this library and I would like to thank you for your effort to make my life easier 👍.
I have used this on the place of ReadMoreText widget (another library for reading more and less function) and after using HashTagText all the text is being displayed. It's not a bug actually but a feature request.
Thank You,
Ashish
Thanks for this package, it is amazing.
I was trying to figure out if there was an option to set initial value for the HashTagTextField but it looks like there is not option for that as there is for TextFormField. This is a pity, probably easy to add as a feature, very desirable in my opinion. So as the validator, it would also be great to have it as an argument.
Can we also use it in Cupertino App? I get a lot of Material Errors, when using it in a Cupertino App...
Android and iOS folders are missing.
thanks, bro for great work! hope you to add At @ mentions detectable and links detectable
v. 1.0.1
Adding special characters (!?. etc) should not break the hashtag, however it is currently removing the characters from display.
For example. The text "#hello!" shows up as "#hello" where it should show up as "#hello!" with the exclamation mark using the basicStyle option.
Like äöüß.
Hello @santa112358,
it would be great if hashtagable detects @ symbols too. I want to use the library in a social media like app.
Thank you!
Is there any way we can add borders? Like borders and radius on all sides?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.