Package provides light widgets [for Linkify, Clean] and extensions for strings that contain bad words/URLs/links/emails/phone numbers

Overview

string_contains

pub package pub points popularity likes

Package provides light widgets [for Linkify, Clean] and extensions for strings that contain bad words/urls/links/emails/phone numbers/#hashtags/@mentions and others.

Installing

1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  string_contains: 0.0.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

3. Import it

Now in your Flutter code, you can use:

import 'package:string_contains/string_contains.dart';

Getting Started

Import the library.

import 'package:string_contains/string_contains.dart';

Example

import 'package:string_contains/string_contains.dart';
 'I am CEO, Bitch'.containsBadWords(); // returns true

 'I am CEO, Bitch'.cleanBadWords() // returns 'I am CEO, B***t'.

 'I am CEO, Bitch'.cleanBadWords(keepFirstLastLetters: false) // returns 'I am CEO, *****'.

 'I am CEO, Bitch'.cleanBadWords(obscuringCharacter: '@') // returns 'I am CEO, B@@@h'.

 'I am CEO, Bitch'.getBadWords() // returns ['Bitch']

 'Please visit our website : https://betterx.io/'.containsUrl() // returns true

 'Please visit our website : https://betterx.io/'.getUrls() // returns ['https://betterx.io/']

 "BetterX.io : Let's build something Better, User-centered & beautiful together\n for more info contact us at : [email protected]".containsEmail() // returns true

 "BetterX.io : Let's build something Better, User-centered & beautiful together\n for more info contact us at : [email protected]".getEmails() // returns ['betterx.io']

 "BetterX.io : Let's build something Better, User-centered & beautiful together\n for more info contact us at : [email protected]".hideEmails() // returns "BetterX.io : Let's build something Better, User-centered & beautiful together\n for more info contact us at : in**@betterx.io
"hi there, i love flutter.".containsWords(["hi", "there","flutter" ]) // returns true
"i love Flutter.".containsWords(["hi", "there","flutter"], caseSensitive: true) // returns false
"hi there, i love flutter.".cleanWords(["hi", "there","flutter" ]) // returns "**, t***e, i love F*****r."
"i love Flutter.".cleanWords(["hi", "there","flutter"], caseSensitive: true) // returns "i love Flutter."
"i love Flutter.".cleanWords(["hi", "there","flutter"], obscuringCharacter: '#') // returns "i love F#####r."
"i love Flutter.".cleanWords(["hi", "there","flutter"], keepFirstLastLetters: false) // returns "i love *******."

StringContainsWidget highlights the url, email, phone number, hashtag, mention and highLightWords. it provides onTap callback for each element of type StringContainsElementType. StringContainsWidget is a widget that displays a string that contains a certain StringContainsElementTypes.

  StringContainsWidget(
                source:
                    'I am CEO, Bitch Please visit our website : https://betterx.io/. Please visit our website : https://betterx.io/ and you can search for any thing on google : google.com, I love Dart : https://dart.dev/, you can practice on : https://dartpad.dev/. Flutter uses Dart, you can create your own app with Flutter : https://flutter.dev/, this is a good example of Flutter : https://flutter.dev/docs/get-started/. BetterX.io : Let's build something Better, User-centered & beautiful together for more info contact us at : info@betterx.io. My Personal Email : ravikumar2710999@gmail.com. A fake email : gedoye9446@roxoas.com. My Phone Number : +91-9000000001. I love Dart and Flutter I love #dart and #flutter. @flutter is #awesome',
                onTap: (url) {
                  print('element is a ${url.value} and type of ${url.type}');
                  if (url.type == StringContainsElementType.words) {
                    ScaffoldMessenger.of(context).showSnackBar(
                      SnackBar(
                        content: Text(
                          '${url.value} is awesome!!',
                        ),
                        duration: const Duration(seconds: 2),
                        dismissDirection: DismissDirection.horizontal,
                      ),
                    );
                  }
                },
                highLightWords: const [
                  'Flutter',
                  'Dart',
                ],
                highlightWordsStyle: const TextStyle(
                  color: Colors.red,
                ),
                types: const [
                  StringContainsElementType.email,
                  StringContainsElementType.url,
                  StringContainsElementType.phoneNumber,
                  StringContainsElementType.hashtag,
                  StringContainsElementType.mention,
                  StringContainsElementType.words,
                ],
),

CleanWidget it used to clean up bad-words/hide emails/hide phoneNumbers/partially or fully hide extra words from the source string. return a clean Text widget.

CleanWidget(
            source:
                      'I am CEO, Bitch Please visit our website : https://betterx.io/. Please visit our website : https://betterx.io/ and you can search for any thing on google : google.com, I love Dart : https://dart.dev/, you can practice on : https://dartpad.dev/. Flutter uses Dart, you can create your own app with Flutter : https://flutter.dev/, this is a good example of Flutter : https://flutter.dev/docs/get-started/. BetterX.io : Let's build something Better, User-centered & beautiful together for more info contact us at : info@betterx.io. My Personal Email : ravikumar2710999@gmail.com. A fake email : gedoye9446@roxoas.com. My Phone Number : +91-9000000001 I love Dart and Flutter I love #dart and #flutter. @flutter is #awesome',
                  style: Theme.of(context).textTheme.headline6?.copyWith(
                        color: Theme.of(context).primaryColorDark,
                ),
),

Maintainers

You might also like...

Breaking-bad - Used Flutter with BLoC pattern to show some info

Breaking-bad - Used Flutter with BLoC pattern to show some info

📘 Overview Used Flutter with BLoC pattern to show some info. about my favorite

Dec 10, 2022

BreakingBad-App - A description of the Braking Bad series, using flutter bloc

BreakingBad-App - A description of the Braking Bad series, using flutter bloc

breaking_bad The application is a description of the Braking Bad series Using Bl

Jan 9, 2022

Allows send emails from flutter using native platform functionality.

flutter_email_sender Allows send emails from flutter using native platform functionality. In android it opens default mail app via intent. In iOS MFMa

Jan 3, 2023

A routing package that lets you navigate through guarded page stacks and URLs using the Router and Navigator's Pages API, aka "Navigator 2.0".

A routing package that lets you navigate through guarded page stacks and URLs using the Router and Navigator's Pages API, aka

A Flutter package to help you handle your application routing and synchronize it with browser URL. Beamer uses the power of Router and implements all

Jan 7, 2023

A CLI tool and Dart package that can scrape file and directory URLs from h5ai instances.

h5ai scraper A CLI tool and Dart package that can scrape file and directory URLs from h5ai instances. Usage This tool requires the Dart SDK. It can be

Jan 4, 2023

Presentation-Remote-PC - Manage your presentation from your smart phone - Phone Client

Presentation-Remote-PC - Manage your presentation from your smart phone - Phone Client

Presentation-Remote-PC Manage your presentation from your smart phone - Phone Cl

Jan 25, 2022

Material io ext - A collection of extensions for creating widgets following material.io guidelines

material_io_ext It is a collection of extensions for creating widgets following

Jan 28, 2022

Movies4u app UI is simple enough to use and the app is a fun way to get an overview of your movie experience. This repo created with help of awesome UI, material Design and latest feature. this repo contain major feature like : dark theme.

Movies4u app UI is simple enough to use and the app is a fun way to get an overview of your movie experience. This repo created with help of awesome UI, material Design and latest feature. this repo contain major feature like : dark theme.

Moviesfree4U This is simple repository, that help in fetch latest, upcomming movies. Website https://movies4u-ef56f.firebaseapp.com/#/ https://movies4

Dec 10, 2022

This Repository is contain about learn Flutter and Dart [Learn]

Flutter-Dart-Code-Learn-Journey This Repository is contain about learn Flutter and Dart [Learn] Introduction Learn Dart Data Type Control Flow Collect

Jan 11, 2022
Owner
BetterX.io
Let's build Something Better, user-centered & Beautiful together.
BetterX.io
Hassan uni links - A Flutter plugin project to help with App/Deep Links (Android) and Universal Links and Custom URL schemes

Uni Links A Flutter plugin project to help with App/Deep Links (Android) and Uni

Hassan Al-Sabti 0 Feb 12, 2022
Flutter plugin which helps you to find links in String using NSDataDetector and Linkify

Flutter's Native Linkify native_linkify is a Flutter plugin. Use it to find links in plain-text. The plugin uses NSDataDetector for iOS and macOS; Lin

Ilia Beregovskii 3 Nov 29, 2022
Low-level link (text, URLs, emails) parsing library in Dart

linkify Low-level link (text, URLs, emails) parsing library in Dart. Required Dart >=2.12 (has null-safety support). Flutter library. Pub - API Docs -

Charles C 60 Nov 4, 2022
This is a dart package that converts words to numbers. It can be used in Flutter and normal Dart programs

Wordstonumbers.dart Wordstonumbers.dart is a simple dart package that converts a string of simple worded numbers into digits (e.g one hundred -> 100).

Michael Essiet 3 Oct 17, 2022
Easy to use text widget for Flutter apps, which converts inlined urls into working, clickable links

LinkText Easy to use text widget for Flutter apps, which converts inlined URLs into clickable links. Allows custom styling. Usage LinkText widget does

Aleksander Woźniak 20 Nov 4, 2022
Eder Zambrano 0 Feb 13, 2022
Leverages libphonenumber to allow for asynchronous and synchronous formatting of phone numbers in Flutter apps

Leverages libphonenumber to allow for asynchronous and synchronous formatting of phone numbers in Flutter apps. Includes a TextInputFormatter to allow real-time AsYouType formatting.

Bottlepay 43 Nov 2, 2022
This is a tutorial for all widgets in the flutter. It contain code, articles.

Flutter Widgets ❤️ Star ❤️ the repo to support the project or ?? Follow Me.Thanks! Facebook Page Twitter QQ Group Developer Flutter Open NieBin 963828

Flutter开源社区 335 Dec 3, 2022
This application displays the characters of the series Breaking Bad, has been used Cubit state and API .

breaking_bad A new Flutter project using bloc. Getting Started This project is a starting point for bloc state_management. A few resources to get you

null 1 Dec 24, 2021