Coder Social home page Coder Social logo

santa112358 / detectable_text_field Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 39.0 442 KB

TextField and Text widget with detection features. You can detect hashtags, at sign, or anything you want.

Home Page: https://pub.dev/packages/detectable_text_field

License: MIT License

Dart 49.14% Kotlin 0.13% Swift 1.87% Objective-C 0.04% HTML 1.99% CMake 20.31% C++ 24.97% C 1.54%
textfield twitter

detectable_text_field's Introduction

Hi there πŸ‘‹

Flutter developer based in Tokyo and undergraduate at Waseda University.

I'm so happy that many developers are using my packages.

If you have any requests or problems, please do not hesitate to open an issue or pull request.

I'll do my best to keep the packages updated, but please understand that my responses and updates may be delayed due to my other commitments.

Thank you.

detectable_text_field's People

Contributors

add00w avatar allcontributors[bot] avatar debuggerx01 avatar drown52tt avatar esteveaguilera avatar furukaze-akane avatar jtmuller5 avatar mattygilo avatar pareshoct7 avatar rlee1990 avatar santa112358 avatar xuxiaowei13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

detectable_text_field's Issues

Add the ability to reduce the RegExp matching

Currently, when a RegExp is passed into the detectable text field, it is used to discover all matches within the text.

final tags = detectionRegExp.allMatches(copiedText).toList();

detector.dart

However, I want to only match the first regexp within the text to highlight only the first mention of a @username. Is it possible to add a boolean to the detector to conditionally match the first or all matches to the RegExp.

final bool matchFirst;
...
final tags = matchFirst ? [detectionRegExp.firstMatch(copiedText)]
      : detectionRegExp.allMatches(copiedText).toList();

Language support

Can we see which languages the package supports? There is a problem with Turkish characters. Is there flexibility in the code for this?

Make DetectableText selectable

Currently it is not possible to let the user select text with the DetectableText Widget. This feature would be very welcome. Similar to SelectableText.

Not working in cupertino framework

Thank you for your library, but it don't work with cupertino.

The following assertion was thrown building DetectableTextField(keyboardType: TextInputType(name: TextInputType.multiline, signed: null, decimal: null), autofocus: true, maxLines: null, textAlignVertical: TextAlignVertical(y: -1.0), dirty, dependencies: [MediaQuery, UnmanagedRestorationScope], state: _DetectableTextFieldState#4285c):
No Material widget found.

Error showing Snackbar onDetectionTyped

Hello,

I got an exception when trying to show snackbar onDetectionTyped

`W/IInputConnectionWrapper( 7059): endBatchEdit on inactive InputConnection

════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Scrollable(axisDirection: down, physics: null, restorationId: "editable", dirty, dependencies: [_LocalizationsScope-[GlobalKey#f8757], UnmanagedRestorationScope, _InheritedTheme, ScrollConfiguration, MediaQuery, _EffectiveTickerMode], state: ScrollableState#7dfb1(position: ScrollPositionWithSingleContext#3cec7(offset: 0.0, range: 0.0..0.0, viewport: 19.0, ScrollableState, ClampingScrollPhysics -> RangeMaintainingScrollPhysics, IdleScrollActivity#deee0, ScrollDirection.idle), effective physics: ClampingScrollPhysics -> RangeMaintainingScrollPhysics)):
setState() or markNeedsBuild() called during build.

This ScaffoldMessenger widget cannot be marked as needing to build because the framework is already in the process of building widgets. A widget can be marked as needing to be built during the build phase only if one of its ancestors is currently building. This exception is allowed because the framework builds parent widgets before children, which means a dirty descendant will always be built. Otherwise, the framework might not visit this widget during this build phase.
The widget on which setState() or markNeedsBuild() was called was: ScaffoldMessenger
dependencies: [MediaQuery]
state: ScaffoldMessengerState#449d8(tickers: tracking 1 ticker)
The widget which was currently being built when the offending call was made was: Scrollable
axisDirection: down
`

Am I doing something wrong?

Thank you

Detects the empty space in front of the hashtag.

In DetectableTextField, there is a phenomenon of detecting #efg when d is onTap when text is abcd #efghi.
Why did you include not only the onTap of the #efg part but also the space space in front of it in the onTap?
Is there any way to solve this problem?

Emoji is not detected

When i the text having emoji (πŸ˜€ ) it show question mark instead fo emoji

DetectableText(
      detectionRegExp: RegExp(
        "(?!\\n)(?:^|\\s)([#@]([$detectionContentLetters]+))|",
        multiLine: true,
      ),
      onTap: (tappedText) async {
        if (tappedText.startsWith('#')) {  
        } else if (tappedText.startsWith('@')) {
        } else if (tappedText.startsWith('http')) {}
      },
      text: '$comment  πŸ˜€',
      basicStyle: font3.copyWith(
          fontSize: fontSize, color: Theme.of(context).colorScheme.onSurface),
      detectedStyle: font3.copyWith(
          fontSize: fontSize + 1,
          fontWeight: FontWeight.w300,
          color: Theme.of(context).colorScheme.onError),
    )

Thank you for time

symbol detection

hi , im using hashtag by default and get some error as below
AΜ‰nh chuΜ£p MaΜ€n hiΜ€nh 2021-09-30 lúc 4 01 32 CH
could u help me to fix this .

Text auto correct selection color stays black in iOS

In android, it works fine but in iOS device, the suggestion selected color turns black and the text color is also black so, makes text invisible to the user. Also, I have to keep auto correct on so, can't set it false.
IMG_0112

Error: TapUpDetails not match corresponding type TapDragUpDetails

Hi,

I am getting following error, appreciate help.
Error (Xcode): ../../.pub-cache/hosted/pub.dev/detectable_text_field-2.0.4/lib/widgets/detectable_text_field.dart:88:35: Error: The parameter 'details' of the method '_TextFieldSelectionGestureDetectorBuilder.onSingleTapUp' has type 'TapUpDetails', which does not match the corresponding type, 'TapDragUpDetails', in the overridden method, 'TextSelectionGestureDetectorBuilder.onSingleTapUp'.

Error on latest Flutter 2.2.0

I get the following error on Flutter 2.2.0:

./sdk/.pub-cache/hosted/pub.dartlang.org/detectable_text_field-2.0.1/lib/widgets/detectable_text_field.dart:1421:20: Error: The getter 'scrollShortcutOverrides' isn't defined for the class '_DetectableTextFieldState'.
 - '_DetectableTextFieldState' is from 'package:detectable_text_field/widgets/detectable_text_field.dart' ('../sdk/.pub-cache/hosted/pub.dartlang.org/detectable_text_field-2.0.1/lib/widgets/detectable_text_field.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'scrollShortcutOverrides'.

        shortcuts: scrollShortcutOverrides,
                   ^^^^^^^^^^^^^^^^^^^^^^^

issue

../../flutter/.pub-cache/hosted/pub.dartlang.org/detectable_text_field-2.0.2/lib/widgets/detectable_editable_text.dart:219:9: Error: No named parameter with the name 'context'.
context: context,
^^^^^^^

Doesn't detect consecutive hashtags

extractDetections() does not detect consecutive hashtags when the following character string exists.

final value = """
#example1
#example2 #example3
#example4#example5
""";
extractDetections(value, hashTagRegExp);
/// β†’["#example1", "exmaple2", "exmaple3", "exmaple4"]
/// "example5" is not detected

Doesn't recognize single letter domains

Assignment

It currently does not recognize single domains as links.

  • Example "x.com"

Cause

Because line 32 specifies to recognize domains between 2 and 256 characters.

30 const urlRegexContent = "((http|https)://)?(www.)?" +
31    "[-a-zA-Z0-9@:%._\\+~#?&//=]" +
32    "{2,256}\\.[a-z]" +
33    "{2,6}\\b([-a-zA-Z0-9@:%" +
34    "._\\+~#?&//=]*)";

Amendment

32    "{1,256}\\.[a-z]" +

New Feature Request

Adding a way to detect when say something like a url was removed or started to be removed.

Hashtag with emoji issue

When input hashtag with emoji like #πŸ˜ƒ, hashtag still be detectable, but content is empty. it will be great if we can rid of "#" if emoji input right behind.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.