shAdow-XJY / click_text_field

flutter pub pac, a textfield which is able to be click hightlight text.

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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
  • suggestClickTextField (!!!Beta)

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'),
        }
    )
use suggestClickTextField (!!Beta)
    SuggestClickTextField(
      controller: ClickTextEditingController(),
      regExp: RegExp(r'people a|people b|people c|embed c|building d|人物一'),
      textStyle: const TextStyle(
        color: Colors.deepPurple
      ),
      clickTextStyle: TextStyle(
        background: Paint()
          ..style = PaintingStyle.stroke
          ..strokeWidth = 2
          ..color = Colors.cyanAccent,
      ),
      onTapText: (clickCallBack) => {
        debugPrint('U click the highlight text $clickCallBack'),
      }
    ),

Warning

When running in different SDK version, it maybe reports a error:

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

delete the check code or change use new SDK version to avoid.

if (_semanticsInfo!.any((InlineSpanSemanticsInformation info) => info.recognizer != null) &&
defaultTargetPlatform != TargetPlatform.macOS) {
// the next code to delete
// assert(readOnly && !obscureText);

link

  1. source code: https://github.com/shAdow-XJY/click_text_field

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

About

flutter pub pac, a textfield which is able to be click hightlight text.

https://pub.dev/packages/click_text_field

License:Other


Languages

Language:Dart 38.2%Language:C++ 30.5%Language:CMake 25.2%Language:HTML 2.5%Language:C 1.9%Language:Swift 1.6%Language:Kotlin 0.2%Language:Objective-C 0.1%