simpleTextWidgetEntry top-level property

WidgetEntry simpleTextWidgetEntry
final

Implementation

final WidgetEntry simpleTextWidgetEntry = WidgetEntry( // Use 'final' for consistency
  // The builder function that creates an instance of the _SimpleTextDisplayWidget.
  // It extracts the necessary parameters from the JSON map.
  // The sendCommand callback is available but not used by this specific widget.
  builder: (BuildContext context, Map<String, dynamic> params, SendCommandCallback sendCommand) {
    // Extract text content from the JSON. Provide a default value if missing.
    final String text = params['text'] ?? 'No text provided';

    // Return an instance of your widget, passing the extracted parameters.
    // The sendCommand callback is not passed to _SimpleTextDisplayWidget
    // because it doesn't need it, but it's available if the widget's
    // functionality were expanded later.
    return _SimpleTextDisplayWidget(text: text);
  },
  // Metadata describing the data_display widget.
  metadata: EmbeddedWidgetMetadata(
    description: 'Displays simple text data provided in the parameters.',
    parameterSchema: {
      'text': 'string (required) - The text content to display.'
    },
  ),
);