click_text_field 0.0.8 copy "click_text_field: ^0.0.8" to clipboard
click_text_field: ^0.0.8 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.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:click_text_field/click_text_field.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
     return MaterialApp(
      title: 'click_text_field',
      theme: ThemeData(
        brightness: Brightness.dark
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);


  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  /// ClickTextEditingController
  final ClickTextEditingController textEditingController = ClickTextEditingController();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('click_text_field'),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            ClickTextField(
                controller: textEditingController,
                regExp: RegExp(r'people a|people b|people c'),
                clickTextStyle: TextStyle(
                  background: Paint()
                    ..style = PaintingStyle.stroke
                    ..strokeWidth = 2
                    ..color = Colors.cyanAccent,
                ),
                onTapText: (clickCallBack) => {
                  debugPrint('U click the highlight text $clickCallBack'),
                }
            ),
            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'),
                }
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
0
pub points
21%
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