click_text_field 0.0.7+2 copy "click_text_field: ^0.0.7+2" to clipboard
click_text_field: ^0.0.7+2 copied to clipboard

A flutter TextField which is able to click the highlight text part, by setting the regex. Also a string callBack function can be set.

INTRODUCE #

example A flutter TextField which is able to click the highlight text part.

  • set the regex
  • set the textStyle
  • set a string callBack function

INSTALL #

    dev_dependencies:
        click_text_field: ^last_version

USAGE #

use ClickTextField

    ClickTextField(
        controller: ClickTextEditingController(),
        regExp: RegExp(r'people c'),
        clickTextStyle: TextStyle(
           background: Paint()
                  ..style = PaintingStyle.stroke
                  ..strokeWidth = 2
                  ..color = Colors.cyanAccent,
        ),
        onTapText: (clickCallBack) => {
           debugPrint('U click the highlight text $clickCallBack'),
        }
    )

Mobile Warning #

Constructor Function

const ClickTextField({
      Key? key,
      required this.regExp,
      required this.onTapText,
      required this.controller,
      this.clickTextStyle,
      this.focusNode,
      this.decoration,
      this.enable,
      this.onChanged,
      this.textAlign
 }) : super(key: key);

Mobile Warning #

When running in Mobile, it maybe reports a error:

 rendering/editable.dart': Failed assertion: line 1336 pos 14: 'readOnly && !obscureText': is not true.

I don't have some good idea now, I choose to delete the check code to avoid.

if (_semanticsInfo!.any((InlineSpanSemanticsInformation info) => info.recognizer != null) &&
defaultTargetPlatform != TargetPlatform.macOS) {
// the next code to delete
// assert(readOnly && !obscureText);
  1. source code: https://github.com/shAdow-XJY/click_text_field

  2. pub: https://pub.dev/packages/click_text_field

0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A flutter TextField which is able to click the highlight text part, by setting the regex. Also a string callBack function can be set.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, string_scanner

More

Packages that depend on click_text_field