Skip to content

A Flutter package that allows for the extension of TextFields to provide tagging capabilities (e.g @ user mentions and # hashtags).

License

Notifications You must be signed in to change notification settings

Tweetoshi/fluttertagger

This branch is 4 commits ahead of, 34 commits behind Crazelu/fluttertagger:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

bb25159 Β· Jan 26, 2024

History

44 Commits
Dec 27, 2023
Dec 27, 2023
Jan 26, 2024
Oct 1, 2022
Oct 1, 2022
Dec 27, 2023
Oct 1, 2022
Dec 27, 2023
Oct 1, 2022
Dec 27, 2023

Repository files navigation

FlutterTagger

FlutterTagger

likes popularity pub points

FlutterTagger is a Flutter package that allows for the extension of TextFields to provide tagging capabilities. A typical use case is in social apps where user mentions and hashtags features are desired.

Install πŸš€

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  fluttertagger: ^2.0.0

Import the package in your project πŸ“₯

import 'package:fluttertagger/fluttertagger.dart';

Usage πŸ—οΈ

FlutterTagger(
          controller: flutterTaggerController,
          onSearch: (query, triggerCharacter) {
              //perform search
          },
          //characters that can trigger a search and the styles
          //to be applied to their tagged results in the TextField
          triggerCharacterAndStyles: const {
            "@": TextStyle(color: Colors.pinkAccent),
            "#": TextStyle(color: Colors.blueAccent),
          },
          overlay: SearchResultView(),
          builder: (context, containerKey) {
              //return child TextField wrapped with a Container
              //and pass it `containerKey`
              return Container(
                key: containerKey,
                child: TextField(
                    controller: flutterTaggerController,
                    suffix: IconButton(
                      onPressed: () {
                        //get formatted text from controller
                        final text = flutterTaggerController.formattedText;

                        //perform send action...

                        FocusScope.of(context).unfocus();
                        flutterTaggerController.clear();
                      },
                    icon: const Icon(
                      Icons.send,
                      color: Colors.redAccent,
                    ),
                  ),
                ),
              );
          },
        )

Explore detailed example demo here.

Demo πŸ“·

Example demo

Contributions πŸ«±πŸΎβ€πŸ«²πŸΌ

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a feature, please send a pull request.

About

A Flutter package that allows for the extension of TextFields to provide tagging capabilities (e.g @ user mentions and # hashtags).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 61.4%
  • C++ 17.6%
  • CMake 15.0%
  • Ruby 2.2%
  • HTML 1.5%
  • C 1.2%
  • Other 1.1%