{"id":19610377,"url":"https://github.com/yungzhu/flutter_rich_input","last_synced_at":"2025-04-27T21:31:39.092Z","repository":{"id":56830076,"uuid":"264396265","full_name":"yungzhu/flutter_rich_input","owner":"yungzhu","description":"Textfield-based rich input box","archived":false,"fork":false,"pushed_at":"2020-07-02T07:54:13.000Z","size":153,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T21:19:59.116Z","etag":null,"topics":["dart","flutter","input","rich","textarea","textfield"],"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/yungzhu.png","metadata":{"files":{"readme":"README-ZH.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}},"created_at":"2020-05-16T08:50:36.000Z","updated_at":"2021-01-19T01:04:32.000Z","dependencies_parsed_at":"2022-09-02T05:51:13.081Z","dependency_job_id":null,"html_url":"https://github.com/yungzhu/flutter_rich_input","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungzhu%2Fflutter_rich_input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungzhu%2Fflutter_rich_input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungzhu%2Fflutter_rich_input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungzhu%2Fflutter_rich_input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yungzhu","download_url":"https://codeload.github.com/yungzhu/flutter_rich_input/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251212024,"owners_count":21553394,"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":["dart","flutter","input","rich","textarea","textfield"],"created_at":"2024-11-11T10:28:54.426Z","updated_at":"2025-04-27T21:31:38.657Z","avatar_url":"https://github.com/yungzhu.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flutter_rich_input 不再维护，使用了更好的方式，新启动了一个新的 rich_input 插件，[点击这里查看](https://pub.dev/packages/rich_input)\n\n这是一个高性能的富媒体输入框，通过原生的 textfield 扩展实现，具有较小的破坏性，同时具有较强的扩展性，实现了@某人，#话题，表情等功能，支持自定义高亮\n\n文档语言: [English](README.md) | [中文简体](README-ZH.md)\n\n## 特色功能\n\n-   用较少的代码，尽量使用原生的 textfield 能力，减少破坏性及后续兼容性\n-   支持@某人 #话题 插入表情等\n-   支持自定义高亮效果，甚至实现自己的渲染方式\n-   支持自定义 value 字段，增强富文本的能力\n\n![Demo](demo.jpg)\n\n## 开始入门\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:flutter_rich_input/block/rich_block.dart';\nimport 'package:flutter_rich_input/flutter_rich_input.dart';\n\nvoid main() {\n  runApp(MyApp());\n}\n\nclass MyApp extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      title: 'Flutter Demo',\n      home: MyHomePage(),\n    );\n  }\n}\n\nclass MyHomePage extends StatefulWidget {\n  @override\n  _MyHomePageState createState() =\u003e _MyHomePageState();\n}\n\nclass _MyHomePageState extends State\u003cMyHomePage\u003e {\n  RichInput _richInput;\n  FocusNode _focusNode;\n\n  @override\n  void initState() {\n    _focusNode = FocusNode();\n    _richInput = RichInput();\n    // refresh text and value\n    _richInput.controller.addListener(() {\n      setState(() {});\n    });\n    _richInput.addText(\"text\");\n    super.initState();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: SafeArea(\n        child: Padding(\n          padding: const EdgeInsets.all(15),\n          child: Column(\n            crossAxisAlignment: CrossAxisAlignment.start,\n            children: \u003cWidget\u003e[\n              _richInput.textField(focusNode: _focusNode),\n              Wrap(\n                spacing: 10,\n                children: [\n                  RaisedButton(\n                    onPressed: () {\n                      _richInput.addText(\"text\");\n                    },\n                    child: const Text(\"Add Text\"),\n                  ),\n                  RaisedButton(\n                    onPressed: () {\n                      _richInput.addText(\"😁\");\n                    },\n                    child: const Text(\"Add 😁\"),\n                  ),\n                  RaisedButton(\n                    onPressed: () {\n                      _richInput.addText(\"👍\");\n                    },\n                    child: const Text(\"Add 👍\"),\n                  ),\n                  RaisedButton(\n                    onPressed: () {\n                      final at = RichBlock(text: \" @abc \", value: \" @123456 \");\n                      _richInput.addBlock(at);\n                    },\n                    child: const Text(\"Add @    \"),\n                  ),\n                  RaisedButton(\n                    onPressed: () {\n                      final at = RichBlock(\n                        text: \" #subject \",\n                        value: \" #888999 \",\n                        style: const TextStyle(\n                          color: Colors.red,\n                          fontWeight: FontWeight.bold,\n                        ),\n                      );\n                      _richInput.addBlock(at);\n                    },\n                    child: const Text(\"Add #\"),\n                  ),\n                  RaisedButton(\n                    onPressed: () {\n                      _richInput.clear();\n                    },\n                    child: const Text(\"Clear\"),\n                  ),\n                  RaisedButton(\n                    onPressed: () {\n                      _focusNode.unfocus();\n                    },\n                    child: const Text(\"unfocus\"),\n                  )\n                ],\n              ),\n              const SizedBox(height: 10),\n              Text(\"Text:${_richInput.text}\"),\n              const SizedBox(height: 10),\n              Text(\"Value:${_richInput.value}\"),\n            ],\n          ),\n        ),\n      ),\n    );\n  }\n}\n```\n\n\u003e 主要通过 RichInput 提供额外的 api，通过 RichInput.textfield 提供和原生 textfield 一致化的接口\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyungzhu%2Fflutter_rich_input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyungzhu%2Fflutter_rich_input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyungzhu%2Fflutter_rich_input/lists"}