flutter_bbcode 1.1.2 icon indicating copy to clipboard operation
flutter_bbcode: ^1.1.2 copied to clipboard

A package to display BBCode text in Flutter apps. Manage your own tags or use those of others.

PubDev

A simple display for BBCode in Flutter. Supports custom tags and styles.

Features #

  • Render BBCode into human readable text.
  • Support for custom tags

Preview #

Preview 1 Preview 2

Getting started #

  1. Install the package using the instruction on the installation page.

Usage #

A fully working example can be found on Github.

After installing the package displaying BBCode is rather straighforward. When using this code note that you will be using ALL available BBCode parsers.

Widget parsedBBCode = BBCodeText(data: _yourString);

The default style currently used is TextStyle(color: Colors.black, fontSize: 14). This can be overwritten using the defaultStyle parameter.

In order to make the package versatile as possible it's possible to define your own tags, or overwrite existing ones. To supply your own tag parsers use the optional tagParsers argument.

Additional information #

Currently support tags by default #

  • [B] - Bold text
  • [I] - Italic text
  • [U] - Underlined text
  • [S] - Strikethrough text
  • [COLOR=#HEX] - Coloured text based on HEX
  • [H1] - Header text, supported up till [H6]
  • [URL=https://google.com] - Supported with or without text. Can also be used to surrouned an URL to make it clickable. Default action is a log message. Opening a webbrowser or any other actions need to be implemented by the developer.
  • [IMG=src] - Display an image from the internet.
  • [QUOTE=Marten] - Used to wrap text in a quote block.
  • [SPOILER=Name] - Used to create a clickable spoiler tag.

Creating your own tags #

You can create your own tags by either extending the StyleTag, WrappedStyleTag or AdvancedTag classes. The last one takes care of all BBCode it self. This can be useful in certain situations, but the StyleTag should be sufficient for most style changes. The WrappedStyleTag can be used to wrap a style around the tag. An example of a tag that implements this is the [quote] tag.

Contribute to the project #

Feel free to create issues and pull-requests on Github. I will take a look at them as soon as possible.

1
likes
120
pub points
41%
popularity

Publisher

verified publisher iconmstruijk.nl

A package to display BBCode text in Flutter apps. Manage your own tags or use those of others.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Icon for licenses.BSD-3-Clause (LICENSE)

Dependencies

bbob_dart, flutter

More

Packages that depend on flutter_bbcode