{"id":23828651,"url":"https://github.com/elrizwiraswara/regexed_text","last_synced_at":"2025-06-15T17:07:31.334Z","repository":{"id":238900519,"uuid":"797906469","full_name":"elrizwiraswara/regexed_text","owner":"elrizwiraswara","description":"This package extends the Text widget to provide additional functionality for highlighting text that matches a given list of RegExp patterns.","archived":false,"fork":false,"pushed_at":"2024-10-19T15:22:14.000Z","size":81,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T23:33:37.297Z","etag":null,"topics":["highlight","link","regular-expression","text","text-style"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elrizwiraswara.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-05-08T18:02:03.000Z","updated_at":"2024-12-24T11:21:37.000Z","dependencies_parsed_at":"2024-05-11T00:29:18.339Z","dependency_job_id":"7f6a5fdc-b39a-4b36-82ef-e5ad1ae7580e","html_url":"https://github.com/elrizwiraswara/regexed_text","commit_stats":null,"previous_names":["elrizwiraswara/regexed_text"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/elrizwiraswara/regexed_text","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elrizwiraswara%2Fregexed_text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elrizwiraswara%2Fregexed_text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elrizwiraswara%2Fregexed_text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elrizwiraswara%2Fregexed_text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elrizwiraswara","download_url":"https://codeload.github.com/elrizwiraswara/regexed_text/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elrizwiraswara%2Fregexed_text/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260015811,"owners_count":22946316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["highlight","link","regular-expression","text","text-style"],"created_at":"2025-01-02T13:31:08.848Z","updated_at":"2025-06-15T17:07:31.316Z","avatar_url":"https://github.com/elrizwiraswara.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"## RegexedText\n\nThis package extends the Text widget to provide additional functionality for highlighting text that matches a given list of RegExp patterns.\n\n### Key Features\n\n- Highlight parts of the text that match certain patterns. Each pattern can have its own unique style.\n- Handle taps on a part of the text that matches a pattern.\n- Extend the functionality of the Flutter `Text` widget.\n\n## Installation\n\nAdd the following to your `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  regexed_text: ^0.0.7\n```\n\nThen run `flutter pub get` to install the package.\n\n## Usage\n### Basic Usage\n\n![screenshoot](https://raw.githubusercontent.com/elrizwiraswara/regexed_text/main/example/screenshoot.png)\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:regexed_text/regexed_text.dart';\n\nconst longTextExample = \"\"\"\nHello @johnDoe, I found this interesting website that you might like: https://www.example.com. It has a lot of useful resources. Also, check out www.another-example.com for more related content. By the way, I came across @janeDoe profile, and it seems she has similar interests. You can connect with her. Lastly, don't forget to visit example.com for the latest updates.\n\nYou can reach out to me at john.doe@example.com. I'm always open to discussing new ideas. Also, did you check out the latest trend on social media? The hashtag #example is trending right now!\n\nBy the way, I found this phone number +1-123-456-7890 in my old contacts. I think it belongs to our mutual friend. And, don't forget our meeting on 12/31/2022. Looking forward to it!\n\"\"\";\n\nvoid main() {\n  runApp(const MainApp());\n}\n\nclass MainApp extends StatelessWidget {\n  const MainApp({super.key});\n\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      home: Scaffold(\n        appBar: AppBar(\n          title: const Text('RegexedText example'),\n        ),\n        body: Padding(\n          padding: const EdgeInsets.all(18),\n          child: RegexedText(\n            longTextExample,\n            patterns: [\n              usernamePattern,\n              urlPattern,\n              emailPattern,\n              hashtagPattern,\n              phoneNumberPattern,\n              datePattern,\n            ],\n            normalStyle: const TextStyle(color: Colors.black),\n            regexedStyle: (pattern) {\n              if (pattern == usernamePattern) {\n                return const TextStyle(\n                  color: Colors.red,\n                  fontWeight: FontWeight.w600,\n                );\n              }\n\n              if (pattern == hashtagPattern) {\n                return const TextStyle(\n                  color: Colors.blue,\n                  fontWeight: FontWeight.w600,\n                );\n              }\n\n              if (pattern == datePattern) {\n                return const TextStyle(\n                  color: Colors.black,\n                  fontWeight: FontWeight.w600,\n                );\n              }\n\n              return const TextStyle(\n                color: Colors.blue,\n                decoration: TextDecoration.underline,\n              );\n            },\n            onTap: (text, pattern) {\n              print(text);\n              print(pattern);\n\n              if (pattern == urlPattern) {\n                // Launch [text] with url_launcher or something\n              }\n            },\n          ),\n        ),\n      ),\n    );\n  }\n}\n```\n\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/elrizwiraswara/regexed_text?tab=MIT-1-ov-file) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felrizwiraswara%2Fregexed_text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felrizwiraswara%2Fregexed_text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felrizwiraswara%2Fregexed_text/lists"}