tagflow 1.0.0-alpha.1 copy "tagflow: ^1.0.0-alpha.1" to clipboard
tagflow: ^1.0.0-alpha.1 copied to clipboard

Native rich content runtime for Flutter apps, with HTML support through a first-party adapter.

pub package codecov style: very good analysis

⚠️ Alpha prerelease: 1.0.0-alpha.1 is the first native rich content runtime line. APIs may change before the stable 1.0.0 release.

🌊 tagflow #

Tagflow is a native rich content runtime for Flutter apps. It renders semantic TagflowDocument content with Flutter widgets and keeps HTML support through the first-party TagflowHtmlAdapter.

✨ Features #

  • Render native TagflowDocument content with Flutter widgets
  • Parse HTML through the first-party TagflowHtmlAdapter
  • Apply explicit TagflowContentPolicy rules to adapter input
  • Override semantic node rendering through TagflowComponentRegistry
  • Configure runtime behavior with TagflowViewOptions
  • Keep parser and converter compatibility through package:tagflow/legacy.dart

Feature Highlights #

HTML Adapter #

import 'package:flutter/widgets.dart';
import 'package:tagflow/tagflow.dart';

class ArticleBody extends StatelessWidget {
  const ArticleBody({required this.html, super.key});

  final String html;

  @override
  Widget build(BuildContext context) {
    return Tagflow.html(
      html: html,
      viewOptions: TagflowViewOptions(
        selectable: const TagflowSelectableOptions(enabled: true),
        linkTapCallback: (url, attributes) {
          // Open the URL with your app's navigation layer.
        },
      ),
    );
  }
}

Use the adapter directly when you want to parse once, inspect, cache, or apply stricter HTML policy before rendering:

const adapter = TagflowHtmlAdapter(
  policy: TagflowContentPolicy(
    allowRemoteImages: false,
    allowedSchemes: {'https', 'mailto'},
  ),
);

final document = adapter.parse(htmlContent);

Tagflow.document(document);

Native Documents #

import 'package:tagflow/tagflow.dart';

final document = TagflowDocument(
  id: 'article-42',
  children: [
    TagflowDocumentNode.heading(
      id: 'article-42.title',
      level: 1,
      children: [
        TagflowDocumentNode.text(
          id: 'article-42.title.text',
          text: 'Native rich content',
        ),
      ],
    ),
    TagflowDocumentNode.paragraph(
      id: 'article-42.intro',
      children: [
        TagflowDocumentNode.text(
          id: 'article-42.intro.text',
          text: 'HTML is an adapter, not the runtime model.',
        ),
      ],
    ),
  ],
);

Tagflow.document(document);

Semantic Renderer Overrides #

final registry = TagflowComponentRegistry(
  overrides: {
    TagflowNodeKind.paragraph: (context, node) {
      return Padding(
        padding: const EdgeInsets.only(bottom: 12),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: context.renderChildren(node),
        ),
      );
    },
  },
);

Tagflow.document(document, registry: registry);

Compatibility Imports #

Parser, converter, selector, and legacy node APIs are still available during the alpha transition from the compatibility barrel:

import 'package:tagflow/legacy.dart';

Use it for existing TagflowParser, ElementConverter, TagflowNode, or selector-based custom converter integrations. New runtime code should prefer package:tagflow/tagflow.dart, Tagflow.document(...), Tagflow.html(...), TagflowHtmlAdapter, and TagflowComponentRegistry.

Theming #

Tagflow.html(
  html: articleContent,
  theme: TagflowTheme.fromTheme(
    Theme.of(context),
    headingConfig: const TagflowHeadingConfig(
      baseSize: 16,
      scales: [2.5, 2, 1.75, 1.5, 1.25, 1],
    ),
  ),
);

Installation #

Add tagflow to your pubspec.yaml:

dependencies:
  tagflow: ^1.0.0-alpha.1

Supported Features #

  • Native semantic document rendering
  • HTML adapter support for headings, paragraphs, emphasis, links, code, blockquotes, lists, images, and tables
  • Content policy filtering for unsafe tags, URL schemes, and unsupported input
  • Runtime view options for links, selection, image behavior, caching, and render errors
  • HTML comment render boundaries for adapter input
  • Legacy parser and converter compatibility for alpha migration

Theme System #

Tagflow's theme system integrates with Flutter's Material Design while providing customization hooks for supported rich content:

  • Material integration with app colors and typography
  • Styles for supported semantic nodes, HTML tags, and classes
  • Responsive units such as rem, em, percentages, viewport width, and viewport height where supported
  • Color parsing and named color support

Theme Configuration #

TagflowTheme.fromTheme(
  Theme.of(context),
  spacingConfig: const TagflowSpacingConfig(baseSize: 16, scale: 1.2),
);

Documentation #

Visit our documentation for detailed guides and examples.

For the v1 alpha migration direction, see docs/migration/2026-06-11-tagflow-v1-alpha-migration.md.

Contributing #

Contributions are welcome! Please read our contributing guidelines before submitting pull requests.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

4
likes
0
points
456
downloads

Publisher

verified publisherjha.sh

Weekly Downloads

Native rich content runtime for Flutter apps, with HTML support through a first-party adapter.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, equatable, flutter, html, meta

More

Packages that depend on tagflow