{"id":19581651,"url":"https://github.com/hathibelagal-dev/css_text_for_flutter","last_synced_at":"2025-04-27T09:33:14.809Z","repository":{"id":54385857,"uuid":"174189241","full_name":"hathibelagal-dev/css_text_for_flutter","owner":"hathibelagal-dev","description":"This Flutter library allows you to use CSS to style your text","archived":false,"fork":false,"pushed_at":"2023-05-26T08:52:54.000Z","size":527,"stargazers_count":53,"open_issues_count":7,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-08-20T21:39:50.806Z","etag":null,"topics":["css","dart","flutter","html"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/css_text","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hathibelagal-dev.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}},"created_at":"2019-03-06T17:23:21.000Z","updated_at":"2023-06-05T15:44:14.000Z","dependencies_parsed_at":"2022-08-13T14:10:14.912Z","dependency_job_id":null,"html_url":"https://github.com/hathibelagal-dev/css_text_for_flutter","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hathibelagal-dev%2Fcss_text_for_flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hathibelagal-dev%2Fcss_text_for_flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hathibelagal-dev%2Fcss_text_for_flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hathibelagal-dev%2Fcss_text_for_flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hathibelagal-dev","download_url":"https://codeload.github.com/hathibelagal-dev/css_text_for_flutter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224068567,"owners_count":17250427,"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":["css","dart","flutter","html"],"created_at":"2024-11-11T07:37:32.086Z","updated_at":"2024-11-11T07:37:33.226Z","avatar_url":"https://github.com/hathibelagal-dev.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSS Text\n\nThis library makes it easy for you to convert HTML and CSS content into `RichText` widgets. It supports most CSS properties that are relevant to text content, except those related to text alignment.\n\nHere's some sample HTML content with inline CSS styles:\n\n```html\n\u003cbody\u003e\n\u003cp style=\"font-size:2.5em;color:darkseagreen\"\u003eThis is a test\u003c/p\u003e\n\u003cp style=\"font-size:1.8em;color:#ff3311\"\u003eSo is this\u003c/p\u003e\n\u003cp style=\"font-size:45px;background:#3311ff;color:yellow\"\u003eAnd this!\u003c/p\u003e\n\u003cbr/\u003e\n\u003cbr/\u003e\n\u003cp style=\"font-size:1.5em\"\u003e\nHello \u003cb style=\"font-style:italic;color:#bb0000;background:#eeff00\"\u003eWorld\u003c/b\u003e!!\n\u003cbr/\u003e\nHow are you \u003cspan style=\"font-family:RobotoBlack;color:#ff0000;\"\u003etoday?\u003c/span\u003e\n\u003cbr/\u003e\n\u003cb\u003eBut\u003c/b\u003e why are you doing \u003ca href=\"https://google.com\"\u003ethis?\u003c/a\u003e\u003cbr/\u003e\n\u003cbr/\u003e\n\u003cspan style=\"text-decoration: underline wavy; font-size:2em\"\u003eCan you tell \u003cdel\u003eme\u003c/del\u003e?\u003c/span\u003e\n\u003cbr/\u003e\nMultiple \u003cspan style=\"font-weight:100\"\u003efont\u003c/span\u003e \n\u003cspan style=\"font-weight:600\"\u003eweights\u003c/span\u003e\u003cbr/\u003e\u003cbr/\u003e\nPlease visit \u003ca style=\"font-weight:bold;\" href=\"https://docs.flutter.io\"\u003eFlutter docs\u003c/a\u003e\n\u003cbr/\u003e\n\u003cbr/\u003e\n\u003cspan style=\"color:#990000ff;background:#4400ff00\"\u003e\nThis text is slightly transparent, and has a slightly transparent background too.\n\u003c/span\u003e\n\u003c/p\u003e\n\u003c/body\u003e\n```\n\nThis library can automatically convert all the HTML content above into a `TextSpan` object or a `RichText` widget. Here's what the rendered HTML will look like:\n\n![](sample.png)\n\n## Getting Started\n\nUsing `css_text` is extremely easy. First import the library in your Dart code:\n\n```\nimport 'package:css_text/css_text.dart';\n```\n\nYou can then create `RichText` widget from any HTML content by calling the `HTML.toTextSpan()` method.\n\n```\nString htmlContent = \"\"\"\n\u003cp style=\"font-size:1.5em;color:#99ff0011\"\u003eHello \u003cb\u003eWorld\u003c/b\u003e\n\"\"\";\n\nvar myRichText = RichText(text: HTML.toTextSpan(context, htmlContent));\n```\n\nAs a shortcut, you can also use the `HTML.toRichText()` method.\n\n```\nmyRichText = HTML.toRichText(context, htmlContent);\n```\n\n## Handling Links\n\nYour HTML content can have links. To handle them, you must use the `linksCallback` optional parameter.\n\n```\nString htmlContent = \"\"\"\u003cspan style=\"font-size:2em\"\u003e\nPlease click \u003ca href=\"https://pub.dartlang.org\"\u003ehere\u003c/a\u003e or \n\u003ca href=\"https://old.reddit.com\"\u003ehere\u003c/a\u003e.\u003cbr/\u003e\n\u003cbr/\u003e\nGo ahead! Try it.\n\u003c/span\u003e\"\"\";\n\nvar myRichText = HTML.toRichText(context, htmlContent, linksCallback: (link) {\n    // You can now use the url_launcher library to open the link.\n    // Or you can handle the link in your app itself. This gives you\n    // complete control over your links.\n    // For now, let's just print it\n    print(link);\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhathibelagal-dev%2Fcss_text_for_flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhathibelagal-dev%2Fcss_text_for_flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhathibelagal-dev%2Fcss_text_for_flutter/lists"}