smart_content_viewer library

Smart Content Viewer

A Flutter widget for rendering HTML content with embedded LaTeX formulas, math equations, function graphs, and statistical charts. No WebView required.

Features

  • Native LaTeX rendering using flutter_math_fork
  • Inline ($...$) and block ($$...$$) formula support
  • Function graph visualization with multi-curve support
  • Statistical charts (bar, pie, line, histogram)
  • HTML content parsing with LaTeX extraction
  • No WebView required

Usage

import 'package:smart_content_viewer/smart_content_viewer.dart';

// Display math content
MathContentViewer(
  htmlContent: 'The formula is \$E = mc^2\$',
  minHeight: 200,
)

// Check if content has math formulas
if (hasMathFormulas(content)) {
  // Show preview button
}

// Display a function graph
FunctionGraphViewer(
  function: 'x^2',
  xMin: -5,
  xMax: 5,
  yMin: -10,
  yMax: 10,
)

// Display a statistical chart
StatisticalChartViewer(
  chartType: ChartType.bar,
  data: 'A:10,B:20,C:15',
)

Classes

BenzenePainter
Noyau benzénique
ChartDataItem
Élément de données pour les graphiques
ChemistryDiagramViewer
Visualiseur de diagrammes chimiques
CircuitDiagramPainter
Peintre pour circuit électrique
CrystalStructurePainter
Structure cristalline
CurveDefinition
Définition d'une courbe individuelle
EnergyDiagramPainter
Peintre pour diagramme énergétique
ForcesDiagramPainter
Peintre pour diagramme des forces (bloc sur pente)
FunctionGraphViewer
Visualiseur de fonctions mathématiques avec repère orthonormé Supporte une ou plusieurs courbes
GraphDefinition
Définition d'un graphique de fonction (supporte multi-courbes)
GraphPainter
Peintre personnalisé pour le graphique
LegendItem
LensDiagramPainter
Peintre pour lentille optique
LewisStructurePainter
Structure de Lewis
MathContentViewer
Visualiseur de contenu HTML avec support natif pour les formules LaTeX Sans WebView - utilise flutter_math_fork pour le rendu natif
MathExpressionParser
Parser d'expressions mathématiques robuste Supporte: +, -, *, /, ^, (), fonctions imbriquées
MoleculePainter
Peintre pour molécules simples
MultiCurveGraphPainter
Peintre pour graphiques multi-courbes
OrbitalPainter
Orbitales moléculaires
OrganicChainPainter
Chaîne carbonée
PendulumDiagramPainter
Peintre pour pendule
PhysicsDiagramViewer
Visualiseur de diagrammes physiques
ProjectileDiagramPainter
Peintre pour projectile
ReactionPainter
Schéma réactionnel
SpringDiagramPainter
Peintre pour ressort
StatisticalChartViewer
Visualiseur de graphiques statistiques (barres, lignes, camemberts)
VectorDiagramPainter
Peintre pour vecteurs

Enums

ChartType
Types de graphiques statistiques supportés
ChemistryDiagramType
Types de diagrammes chimiques
PhysicsDiagramType
Types de diagrammes physiques

Constants

supportedLatexCommands → const List<String>
Liste des commandes LaTeX supportées

Functions

cleanLatex(String latex) → String
Nettoie le contenu LaTeX des délimiteurs
extractGraphsFromContent(String content) → List<GraphDefinition>
Fonction utilitaire pour détecter et extraire les graphiques du contenu Supporte: graph: f(x)=x^2 et graph: f(x)=x^2, g(x)=sin(x), x=-5..5
hasGraphs(String content) → bool
Détecte si le contenu contient des graphiques de fonctions
hasMathFormulas(String content) → bool
Fonction utilitaire pour détecter les formules mathématiques
isLatexCommandSupported(String command) → bool
Vérifie si une commande LaTeX est supportée