processText method

List<Widget> processText(
  1. String text,
  2. BuildContext context, {
  3. bool isDarkMode = false,
  4. dynamic onCheckboxChanged(
    1. int,
    2. bool
    )?,
  5. bool enableCheckboxes = true,
})

Process Pendart text into a widget tree

Implementation

List<Widget> processText(String text, BuildContext context,
    {bool isDarkMode = false,
    Function(int, bool)? onCheckboxChanged,
    bool enableCheckboxes = true}) {
  // Use isDarkMode to determine text/background colors and other styling
  final themeColors = isDarkMode ? _DarkThemeColors() : _LightThemeColors();

  // Get token array from the preprocessed text
  String preprocessedText = getPreprocessedText(text);
  List<Token> tokenArray = getTokenArray(preprocessedText);

  // Build widgets from tokens, passing the theme colors
  return _buildWidgetsFromTokens(tokenArray, context,
      enableCheckboxes: enableCheckboxes,
      onCheckboxChanged: onCheckboxChanged,
      themeColors: themeColors);
}