{"id":32298053,"url":"https://github.com/mchtsen/ai_profanity_textfield","last_synced_at":"2026-05-09T16:18:26.431Z","repository":{"id":246938710,"uuid":"824695818","full_name":"MCHTSEN/ai_profanity_textfield","owner":"MCHTSEN","description":"pub.dev package that provide an ai profanity checker","archived":false,"fork":false,"pushed_at":"2024-10-30T12:14:30.000Z","size":307,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T04:51:42.046Z","etag":null,"topics":["ai","flutter","profanity","textfield-validation"],"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/MCHTSEN.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-05T17:58:48.000Z","updated_at":"2025-03-22T14:56:29.000Z","dependencies_parsed_at":"2025-10-23T04:51:44.420Z","dependency_job_id":null,"html_url":"https://github.com/MCHTSEN/ai_profanity_textfield","commit_stats":null,"previous_names":["mchtsen/ai_profanity_textfield"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/MCHTSEN/ai_profanity_textfield","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCHTSEN%2Fai_profanity_textfield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCHTSEN%2Fai_profanity_textfield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCHTSEN%2Fai_profanity_textfield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCHTSEN%2Fai_profanity_textfield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MCHTSEN","download_url":"https://codeload.github.com/MCHTSEN/ai_profanity_textfield/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MCHTSEN%2Fai_profanity_textfield/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280563530,"owners_count":26351731,"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","status":"online","status_checked_at":"2025-10-23T02:00:06.710Z","response_time":142,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ai","flutter","profanity","textfield-validation"],"created_at":"2025-10-23T04:51:39.755Z","updated_at":"2025-10-23T04:51:44.637Z","avatar_url":"https://github.com/MCHTSEN.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Profanity TextField 🛡️\n\nA smart, AI-powered Flutter text field widget that filters profanity in real-time using Gemini API! Keep your app's content clean and friendly in any language! ✨\n\n![ai_profanity](https://github.com/user-attachments/assets/31bb2eb8-ad95-4af6-b483-6307f9a18375)\n\n\n\n## Features 🌟\n\n- 🌍 Multilingual profanity detection for ALL languages\n- 🤖 AI-powered profanity detection using Gemini\n- ✅ Custom validators support\n- ⚡ Real-time validation while typing\n- 🎨 Fully customizable appearance\n- 🔄 Loading indicators and validation states\n- ❌ Custom error messages\n- ✅ Success indicators\n- 🕒 Debounce support for optimal performance\n\n\n\n## Language Support 🌐\n\nThanks to Gemini's powerful AI capabilities, our widget can detect profanity in:\n- English 🇺🇸\n- Spanish 🇪🇸\n- French 🇫🇷\n- German 🇩🇪\n- Turkish 🇹🇷\n- Chinese 🇨🇳\n- Japanese 🇯🇵\n- Korean 🇰🇷\n- Arabic 🇸🇦\n- Russian 🇷🇺\n- ...and many more! \n\nThe AI model understands context and cultural nuances in each language, ensuring accurate profanity detection worldwide! 🌎\n\n\n## Getting Started 🚀\n\n### Installation\n\nAdd this to your `pubspec.yaml`:\n\n```yaml\ndependencies:\n  ai_profanity_textfield: ^1.0.0\n```\n### Get Your API Key\n\n1. Visit [Google AI Studio](https://makersuite.google.com/app/apikey)\n2. Sign in with your Google account\n3. Click \"Create API Key\"\n4. Copy your API key\n\n### Quick Start 🏃\n\n```dart\nProfanityTextFormField(\n  geminiService: geminiService, // Your Gemini service instance\n  decoration: InputDecoration(\n    hintText: 'Enter text here...',\n  ),\n  onProfanityDetected: (text) {\n    print('Profanity detected in: $text');\n  },\n)\n```\n\n## Custom Validators ✨\n\nAdd your own validation rules alongside AI profanity detection!\n\n```dart\nProfanityTextFormField(\n  geminiService: geminiService,\n  checkWhileTyping: true,\n  debounceDuration: const Duration(milliseconds: 500),\n  validators: [\n    (value) =\u003e value.isEmpty ? 'Required field' : null,\n    (value) =\u003e value.length \u003c 3 ? 'Too short' : null,\n    (value) =\u003e !value.contains('@') ? 'Must contain @' : null,\n  ],\n  onProfanityDetected: (text) =\u003e print('Profanity detected!'),\n  onCleanText: (text) =\u003e print('Text is clean and valid'),\n  decoration: InputDecoration(\n    hintText: 'Type something...',\n    fillColor: Colors.white,\n    border: OutlineInputBorder(\n      borderRadius: BorderRadius.circular(18),\n    ),\n  ),\n  showValidIcon: true,\n  profanityMessage: 'Oops! Let\\'s keep it friendly 😊',\n  validationMessageDuration: const Duration(seconds: 3),\n)\n```\n\n\n### Validation Process 🔄\n\n1. Custom validators run first in the order they are defined\n2. If all custom validations pass, AI profanity check runs\n3. Text is considered valid only when both custom validations and profanity check pass\n\n### Multilingual Example 🌐\n\n```dart\nProfanityTextFormField(\n  geminiService: geminiService,\n  decoration: InputDecoration(\n    hintText: '여기에 텍스트를 입력하세요...', // Korean\n    // or '在此输入文字...' // Chinese\n    // or 'Écrivez ici...' // French\n    // etc.\n  ),\n  profanityMessage: 'Lütfen nazik olalım! 😊', // Turkish\n  validators: [\n    // Custom validators work with any language!\n    (value) {\n      if (value.length \u003c 5) {\n        return '最小5文字必要です'; // Japanese error message\n      }\n      return null;\n    },\n  ],\n)\n```\n\n## Advanced Features 🔧\n\n### Real-time Validation ⚡\n\nThe widget validates text as users type, with a customizable debounce duration:\n\n```dart\nProfanityTextFormField(\n  geminiService: geminiService,\n  checkWhileTyping: true,\n  debounceDuration: Duration(milliseconds: 500),\n  validators: [\n    // Custom validators run in real-time too!\n    (value) =\u003e value.length \u003c 3 ? 'Too short!' : null,\n  ],\n  onCleanText: (text) {\n    print('Text is clean and valid: $text');\n  },\n)\n```\n\n### Custom Styling 🎨\n\nMake it match your app's theme:\n\n```dart\nProfanityTextFormField(\n  geminiService: geminiService,\n  successDecoration: InputDecoration(\n    fillColor: Colors.green,\n    border: OutlineInputBorder(\n      borderRadius: BorderRadius.circular(18),\n    ),\n  ),\n  profanityDecoration: InputDecoration(\n    fillColor: Colors.red,\n    border: OutlineInputBorder(\n      borderRadius: BorderRadius.circular(18),\n    ),\n  ),\n  progressIndicatorColor: Colors.blue,\n  progressIndicatorSize: 20,\n)\n```\n\n\n### Validation States 🚦\n\nThe widget provides different states with customizable appearances:\n- ⏳ Loading\n- ✅ Valid (all custom validators and profanity check passed)\n- ❌ Invalid\n- 🆕 Initial\n\n### Error Handling 🚫\n\nCustom error messages and handlers in any language:\n\n```dart\nProfanityTextFormField(\n  geminiService: geminiService,\n  profanityMessage: 'Please keep it friendly! 😊',\n  validators: [\n    (value) =\u003e value.isEmpty ? 'Field cannot be empty!' : null,\n  ],\n  onError: (error) {\n    print('Error occurred: $error');\n  },\n  clearOnProfanity: true,\n)\n```\n\n\n\n## Properties 📋\n\n| Property | Type | Description |\n|----------|------|-------------|\n| `geminiService` | `GeminiService` | Required. Your Gemini API service instance |\n| `validators` | `List\u003cFormFieldValidator\u003cString\u003e\u003e?` | Custom validation rules |\n| `checkWhileTyping` | `bool` | Enable/disable real-time validation |\n| `debounceDuration` | `Duration` | Delay before validation triggers |\n| `onProfanityDetected` | `Function(String)?` | Callback when profanity is found |\n| `onCleanText` | `Function(String)?` | Callback when text is clean and valid |\n| `clearOnProfanity` | `bool` | Clear field when profanity detected |\n| `showValidIcon` | `bool` | Show/hide validation icons |\n| `profanityMessage` | `String` | Custom error message (supports all languages) |\n\n\n\n\n## Examples 📝\n\n### Username Field\n\n```dart\nProfanityTextFormField(\n  geminiService: geminiService,\n  decoration: InputDecoration(\n    labelText: 'Username',\n    prefixIcon: Icon(Icons.person),\n  ),\n  validators: [\n    (value) =\u003e value.length \u003c 3 ? 'Username too short' : null,\n    (value) =\u003e value.contains(' ') ? 'No spaces allowed' : null,\n  ],\n)\n```\n\n### Comment Field\n\n```dart\nProfanityTextFormField(\n  geminiService: geminiService,\n  decoration: InputDecoration(\n    labelText: 'Comment',\n    hintText: 'Share your thoughts...',\n  ),\n  maxLines: 3,\n  clearOnProfanity: true,\n  profanityMessage: 'Please keep comments friendly!',\n)\n```\n\n### Search Field\n\n```dart\nProfanityTextFormField(\n  geminiService: geminiService,\n  decoration: InputDecoration(\n    labelText: 'Search',\n    prefixIcon: Icon(Icons.search),\n    border: OutlineInputBorder(\n      borderRadius: BorderRadius.circular(30),\n    ),\n  ),\n  debounceDuration: Duration(milliseconds: 300),\n)\n```\n\n## Contributing 🤝\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License 📄\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## Support 💪\n\nIf you like this package, please give it a ⭐️ on [GitHub](https://github.com/yourusername/ai_profanity_textfield)!\n\nFor bugs or feature requests, please [create an issue](https://github.com/yourusername/ai_profanity_textfield/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmchtsen%2Fai_profanity_textfield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmchtsen%2Fai_profanity_textfield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmchtsen%2Fai_profanity_textfield/lists"}