### Implementation of createState Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Html/createState.html This is an example of implementing the createState method within a widget's implementation. ```dart @override State createState() => _HtmlState(); ``` -------------------------------- ### Add Audio Support via flutter_html_audio Source: https://pub.dev/documentation/flutter_html/latest/index.html Install the audio extension package and register the AudioHtmlExtension to enable rendering of HTML audio elements. ```bash flutter pub add flutter_html_audio ``` ```dart import 'package:flutter_html_audio/flutter_html_audio'; Widget html = Html( data: myHtml, extensions: [ AudioHtmlExtension(), ], ); ``` -------------------------------- ### Get htmlPadding Property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/PaddingsFromEdgeInsetsDirectional/htmlPadding.html Returns an HtmlPaddings object configured with the specified top, bottom, inline start, and inline end padding values. This is used to apply custom spacing around HTML content. ```dart HtmlPaddings get htmlPadding { return HtmlPaddings( top: HtmlPadding(top), bottom: HtmlPadding(bottom), inlineStart: HtmlPadding(start), inlineEnd: HtmlPadding(end), ); } ``` -------------------------------- ### void setupParentData(RenderBox child) Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/setupParentData.html This method is used to set up the parent data for a child before it is added to the parent's child list. ```APIDOC ## void setupParentData(RenderBox child) ### Description Override to setup parent data correctly for your children. You can call this function to set up the parent data for a child before the child is added to the parent's child list. ### Parameters #### Path Parameters - **child** (RenderBox) - Required - The child render object to configure. ### Implementation ```dart @override void setupParentData(RenderBox child) { if (child.parentData is! CSSBoxParentData) { child.parentData = CSSBoxParentData(); } } ``` ``` -------------------------------- ### prepare method Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/OnImageTapExtension/prepare.html The `prepare` method takes an `ExtensionContext` and a list of `StyledElement` children to construct a new `StyledElement`. ```APIDOC ## prepare method ### Description Converts parsed HTML to a StyledElement. ### Method ```dart @override StyledElement prepare(ExtensionContext context, List children) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **StyledElement** (StyledElement) - The prepared StyledElement. #### Response Example ```dart @override StyledElement prepare(ExtensionContext context, List children) { return ImageTapExtensionElement( node: html.Element.tag("img-tap"), style: Style(), children: [ super.prepare(context, children), ], name: "img-tap", elementId: context.id, elementClasses: context.classes.toList(), ); } ``` ``` -------------------------------- ### GET textDirection Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/textDirection.html Retrieves the current TextDirection value. ```APIDOC ## GET textDirection ### Description Returns the current TextDirection value. ### Method GET ### Response - **textDirection** (TextDirection) - The current text direction setting. ``` -------------------------------- ### Implement prepareFromExtension Method Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlParser/prepareFromExtension.html This method iterates through extensions and built-ins to prepare an HTML node. If no match is found, it returns an EmptyContentElement. Use this when custom HTML parsing logic is required. ```dart StyledElement prepareFromExtension( ExtensionContext extensionContext, List children, { Set extensionsToIgnore = const {}, }) { // Loop through every extension and see if it can handle this node for (final extension in extensions) { if (!extensionsToIgnore.contains(extension) && extension.matches(extensionContext)) { return extension.prepare(extensionContext, children); } } // Loop through built in elements and see if they can handle this node. for (final builtIn in builtIns) { if (!extensionsToIgnore.contains(builtIn) && builtIn.matches(extensionContext)) { return builtIn.prepare(extensionContext, children); } } // If no extension or built-in matches, then return an empty content element. return EmptyContentElement(node: extensionContext.node); } ``` -------------------------------- ### GET borderSize Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/borderSize.html Retrieves the current border size. ```APIDOC ## GET borderSize ### Description Returns the current Size object associated with the border. ### Response - **Size** (object) - The current border size. ``` -------------------------------- ### GET attributes Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ExtensionContext/attributes.html Retrieves the attributes of a node as a LinkedHashMap. ```APIDOC ## GET attributes ### Description Returns a linked hash map representing the attributes of the node, or an empty map if it has no attributes. ### Response - **attributes** (LinkedHashMap) - A map containing the node's attributes. ``` -------------------------------- ### Content Implementation Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Content/Content.html Shows the implementation details of the Content constructor, including the initialization of private members. ```APIDOC ## Content Implementation ### Description This section details the implementation of the `Content` constructor, showing how internal properties like `_normal` and `display` are initialized. ### Method Constructor Implementation ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get height property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/height.html Retrieves the current height value. ```dart Height get height => _height; ``` -------------------------------- ### Html.fromDom Constructor Implementation Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Html/Html.fromDom.html Shows the implementation of the Html.fromDom constructor, including initialization of properties and assertions. ```dart Html.fromDom({ super.key, GlobalKey? anchorKey, required dom.Document? document, this.onLinkTap, this.onAnchorTap, this.extensions = const [], this.onCssParseError, this.shrinkWrap = false, this.doNotRenderTheseTags, this.onlyRenderTheseTags, this.style = const {}, }) : data = null, assert(document != null), documentElement = document!.documentElement, _anchorKey = anchorKey ?? GlobalKey(); ``` -------------------------------- ### GET /display Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/display.html Retrieves the current display property value. ```APIDOC ## GET /display ### Description Returns the current value of the display property. ### Method GET ### Endpoint /display ``` -------------------------------- ### OnImageTapExtension Constructor Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/OnImageTapExtension-class.html Initializes the OnImageTapExtension with a required tap handler. ```APIDOC ## Constructor: OnImageTapExtension ### Description Creates an instance of OnImageTapExtension to handle image tap interactions. ### Parameters - **onImageTap** (OnTap) - Required - The callback function triggered when an image is tapped. ``` -------------------------------- ### prepare method Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/TagWrapExtension/prepare.html Converts parsed HTML to a StyledElement using the provided extension context and children. ```APIDOC ## prepare(ExtensionContext context, List children) ### Description Converts parsed HTML to a StyledElement. This method is an override that wraps the result of the parser's prepareFromExtension call. ### Parameters - **context** (ExtensionContext) - Required - The context of the extension being processed. - **children** (List) - Required - A list of child elements to be processed. ### Implementation ```dart @override StyledElement prepare( ExtensionContext context, List children) { return WrapperElement( child: context.parser.prepareFromExtension( context, children, extensionsToIgnore: {this}, ), ); } ``` ``` -------------------------------- ### Get display property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/display.html Retrieves the current display value. ```dart Display get display => _display; ``` -------------------------------- ### prepareFromExtension Method Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlParser/prepareFromExtension.html Prepares an HTML node using available HtmlExtensions or built-in elements. If no match is found, it returns an EmptyContentElement. ```APIDOC ## prepareFromExtension Method ### Description Prepares the html node using one of the built-ins or HtmlExtensions available. If none of the extensions matches, returns an EmptyContentElement. ### Method ```dart StyledElement prepareFromExtension( ExtensionContext extensionContext, List children, { Set extensionsToIgnore = const {}, } ) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **StyledElement** - The prepared styled element or an EmptyContentElement if no match is found. #### Response Example ```json { "example": "StyledElement or EmptyContentElement" } ``` ### Implementation Details Iterates through available `extensions` and `builtIns` to find a matching element that can prepare the `extensionContext`. If a match is found, it returns the prepared element. Otherwise, it returns an `EmptyContentElement`. ```dart StyledElement prepareFromExtension( ExtensionContext extensionContext, List children, { Set extensionsToIgnore = const {}, }) { // Loop through every extension and see if it can handle this node for (final extension in extensions) { if (!extensionsToIgnore.contains(extension) && extension.matches(extensionContext)) { return extension.prepare(extensionContext, children); } } // Loop through built in elements and see if they can handle this node. for (final builtIn in builtIns) { if (!extensionsToIgnore.contains(builtIn) && builtIn.matches(extensionContext)) { return builtIn.prepare(extensionContext, children); } } // If no extension or built-in matches, then return an empty content element. return EmptyContentElement(node: extensionContext.node); } ``` ``` -------------------------------- ### GET isNormal Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Content/isNormal.html Retrieves the boolean value of the isNormal property. ```APIDOC ## GET isNormal ### Description Returns the current state of the _normal property as a boolean value. ### Method GET ### Response #### Success Response (200) - **isNormal** (bool) - The current state of the property. ``` -------------------------------- ### GET shrinkWrap Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/shrinkWrap.html Retrieves the current boolean value of the shrinkWrap property. ```APIDOC ## GET shrinkWrap ### Description Returns the current state of the shrinkWrap property. ### Method GET ### Endpoint shrinkWrap ### Response - **value** (bool) - The current shrinkWrap setting. ``` -------------------------------- ### Margins.all Implementation Details Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Margins/Margins.all.html This section shows the internal implementation of the Margins.all constructor, illustrating how it assigns values to each margin side. ```APIDOC ## Margins.all Implementation ### Description Shows the internal implementation of the `Margins.all` constructor, detailing how it initializes the margin properties. ### Method Constructor Implementation ### Endpoint N/A (Constructor) ### Parameters None (This section describes the implementation, not direct parameters for usage). ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example ```dart // Internal implementation detail: Margins.all(double value, [Unit? unit]) : left = Margin(value, unit), right = Margin(value, unit), inlineEnd = null, inlineStart = null, top = Margin(value, unit), bottom = Margin(value, unit), blockEnd = null, blockStart = null; ``` ``` -------------------------------- ### prepare method Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlExtension/prepare.html Converts parsed HTML into a StyledElement object for rendering. ```APIDOC ## prepare(ExtensionContext context, List children) ### Description Converts parsed HTML to a StyledElement. This method maps the node, classes, ID, and children from the provided context into a new StyledElement instance. ### Parameters - **context** (ExtensionContext) - Required - The context containing the node, classes, ID, and element name. - **children** (List) - Required - The list of child elements to be attached to the StyledElement. ### Returns - **StyledElement** - A new instance representing the processed HTML element. ``` -------------------------------- ### GET id property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ExtensionContext/id.html Retrieves the id attribute of the current element. ```APIDOC ## GET id ### Description Returns the id of the element. If the node is not an html Element or the id is not present, it returns an empty string. ### Method GET ### Endpoint /id ### Response #### Success Response (200) - **id** (String) - The identifier of the element or an empty string. ``` -------------------------------- ### BlockStart Property Implementation Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Margins/blockStart.html Shows the declaration of the blockStart property. ```APIDOC ## BlockStart Property ### Description Represents the starting margin of a block element. ### Implementation ```dart final Margin? blockStart; ``` ``` -------------------------------- ### GET /WhiteSpace/values Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/WhiteSpace/values-constant.html Retrieves the constant list of all values defined in the WhiteSpace enum. ```APIDOC ## GET /WhiteSpace/values ### Description Returns a constant List of the values in the WhiteSpace enum, ordered by their declaration. ### Method GET ### Endpoint /WhiteSpace/values ### Response #### Success Response (200) - **values** (List) - A constant list of all enum members. ``` -------------------------------- ### Style Constructor Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Style/Style.html Initializes a new Style object with optional CSS-like styling properties. ```APIDOC ## Style Constructor ### Description Creates a new Style instance to define visual properties for HTML elements. ### Parameters #### Request Body - **backgroundColor** (Color) - Optional - Background color of the element. - **color** (Color) - Optional - Text color of the element. - **fontSize** (FontSize) - Optional - Size of the font. - **fontWeight** (FontWeight) - Optional - Weight of the font. - **padding** (HtmlPaddings) - Optional - Padding around the element. - **margin** (Margins) - Optional - Margin around the element. - **textAlign** (TextAlign) - Optional - Alignment of the text. - **verticalAlign** (VerticalAlign) - Optional - Vertical alignment (defaults to baseline). - **textTransform** (TextTransform) - Optional - Text transformation (defaults to none). ``` -------------------------------- ### GET /Unit/values Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Unit/values-constant.html Retrieves the constant list of all values defined in the Unit enum. ```APIDOC ## GET /Unit/values ### Description Returns a constant List of the values in the Unit enum, ordered by their declaration. ### Method GET ### Endpoint /Unit/values ### Response #### Success Response (200) - **values** (List) - A constant list of all enum members in order of declaration. ``` -------------------------------- ### Width Class Constructors Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Width-class.html Details on how to instantiate the Width class. ```APIDOC ## Width Constructors ### Description Constructors for creating a Width object with specific values or automatic sizing. ### Constructors - **Width(double value, [Unit unit = Unit.px])** - Creates a Width instance with a specific value and unit (defaults to px). - **Width.auto()** - Creates a Width instance set to auto. ``` -------------------------------- ### GET element Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/StyledElement/element.html Retrieves the underlying DOM element if the current node is an element. ```APIDOC ## GET element ### Description Returns the current node as a dom.Element if it is an instance of dom.Element, otherwise returns null. ### Method GET ### Endpoint element ### Response - **element** (dom.Element?) - The underlying DOM element or null if the node is not an element. ``` -------------------------------- ### Height Property Getter Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/height.html This section describes how to get the current height value. ```APIDOC ## Height Property Getter ### Description Retrieves the current height value. ### Method GET ### Endpoint N/A (Class property) ### Parameters None ### Request Example None ### Response #### Success Response (200) - **height** (Height) - The current height value. #### Response Example ```dart Height currentHeight = _height; ``` ``` -------------------------------- ### Html Widget Constructors Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Html-class.html This section details the different ways to create an Html widget instance. ```APIDOC ## Html Constructors ### Html ```dart Html({ Key? key, GlobalKey>? anchorKey, required String? data, OnTap? onLinkTap, OnTap? onAnchorTap, List extensions = const [], OnCssParseError? onCssParseError, bool shrinkWrap = false, Set? onlyRenderTheseTags, Set? doNotRenderTheseTags, Map style = const {}, }) ``` **Description**: The `Html` widget takes HTML as input and displays a RichText tree of the parsed HTML content. ### Html.fromDom ```dart Html.fromDom({ Key? key, GlobalKey>? anchorKey, required Document? document, OnTap? onLinkTap, OnTap? onAnchorTap, List extensions = const [], OnCssParseError? onCssParseError, bool shrinkWrap = false, Set? doNotRenderTheseTags, Set? onlyRenderTheseTags, Map style = const {}, }) ``` ### Html.fromElement ```dart Html.fromElement({ Key? key, GlobalKey>? anchorKey, required Element? documentElement, OnTap? onLinkTap, OnTap? onAnchorTap, List extensions = const [], OnCssParseError? onCssParseError, bool shrinkWrap = false, Set? doNotRenderTheseTags, Set? onlyRenderTheseTags, Map style = const {}, }) ``` ``` -------------------------------- ### Get childIsReplaced property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/childIsReplaced.html Retrieves the current boolean state of the child replacement. ```dart bool get childIsReplaced => _childIsReplaced; ``` -------------------------------- ### HtmlPadding Constructors Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlPadding-class.html Provides information on how to create instances of the HtmlPadding class. ```APIDOC ## HtmlPadding Constructors ### HtmlPadding(double value, [Unit? unit = Unit.px]) Creates a new HtmlPadding instance with a specified value and unit. ### HtmlPadding.zero() Creates a new HtmlPadding instance with a value of zero. ``` -------------------------------- ### GET supportedTags Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ImageExtension/supportedTags.html Retrieves the set of additional tags supported by the HtmlParser extension. ```APIDOC ## GET supportedTags ### Description Tells the HtmlParser what additional tags to add to the default supported tag list. Extension creators should override this with any additional tags that should be visible to the end user. ### Implementation ```dart @override Set get supportedTags => { "img", }; ``` ``` -------------------------------- ### Initialize ImageExtension Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ImageExtension/ImageExtension.html Configures image handling behavior for assets, data URIs, and network sources. Requires a builder or child widget to define the rendering logic. ```dart ImageExtension({ super.assetBundle, super.assetPackage, super.assetSchema = "asset:", super.dataEncoding, super.fileExtensions, super.mimeTypes, super.networkDomains, super.networkHeaders, super.networkSchemas = const {"http", "https"}, super.handleAssetImages = true, super.handleDataImages = true, super.handleNetworkImages = true, Widget? child, Widget Function(ExtensionContext)? builder, }) { if (child != null) { this.builder = (_) => WidgetSpan(child: child); } else { this.builder = (context) => WidgetSpan(child: builder!.call(context)); } } ``` -------------------------------- ### Initialize HtmlPadding.zero Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlPadding/HtmlPadding.zero.html Creates an instance of HtmlPadding with zero pixel values. ```dart HtmlPadding.zero() ``` ```dart HtmlPadding.zero() : super(0, Unit.px); ``` -------------------------------- ### GET isBlock property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Display/isBlock.html Evaluates whether the displayOutside property is equal to DisplayOutside.block. ```APIDOC ## GET isBlock ### Description Evaluates to true if displayOutside is equal to DisplayOutside.block. ### Method GET ### Endpoint isBlock ### Response #### Success Response (200) - **isBlock** (bool) - Returns true if the display style is block, otherwise false. ``` -------------------------------- ### Content Constructor Implementation Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Content/Content.html This snippet shows the implementation of the Content constructor, initializing properties like _normal and display. ```dart const Content(this.replacementContent) : _normal = false, display = true; ``` -------------------------------- ### Get TextDirection Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/textDirection.html Retrieves the current text direction. This getter is part of the layout properties. ```dart TextDirection get textDirection => _textDirection; ``` -------------------------------- ### GET zero property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlPaddings/zero.html Retrieves an instance of HtmlPaddings where all padding values are set to zero. ```APIDOC ## GET zero ### Description Returns an instance of HtmlPaddings initialized with all padding values set to 0. This is functionally equivalent to EdgeInsets.zero. ### Implementation static HtmlPaddings get zero => HtmlPaddings.all(0); ``` -------------------------------- ### matches method Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/TagWrapExtension/matches.html Determines if the extension should execute based on the current step in the ExtensionContext. ```APIDOC ## matches(ExtensionContext context) ### Description This method is called to test whether or not this extension needs to do any work in this context. By default, it returns true if supportedTags contains the element's name. ### Parameters #### Path Parameters - **context** (ExtensionContext) - Required - The context in which the extension is being evaluated. ### Implementation ```dart @override bool matches(ExtensionContext context) { switch (context.currentStep) { case CurrentStep.preparing: return super.matches(context); case CurrentStep.preStyling: case CurrentStep.preProcessing: return false; case CurrentStep.building: return context.styledElement is WrapperElement; } } ``` ``` -------------------------------- ### HtmlPaddings.all Constructor Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlPaddings/HtmlPaddings.all.html Creates an instance of HtmlPaddings where all sides (left, right, top, bottom) are set to the same value and unit. ```APIDOC ## HtmlPaddings.all ### Description Creates an instance of HtmlPaddings where all sides (left, right, top, bottom) are set to the same value and unit. This is analogous to EdgeInsets.all. ### Parameters - **value** (double) - Required - The padding value to apply to all sides. - **unit** (Unit?) - Optional - The unit of measurement for the padding value. ``` -------------------------------- ### GET innerHtml Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ExtensionContext/innerHtml.html Retrieves the HTML string contained within the element or its text content. ```APIDOC ## GET innerHtml ### Description Returns the HTML within this element. If the node is not an html.Element, it returns the node's text content or an empty string if no text exists. ### Method GET ### Response - **innerHtml** (String) - The HTML content of the element or the text content of the node. ``` -------------------------------- ### GET elementChildren Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ExtensionContext/elementChildren.html Retrieves the list of child Elements associated with the current HTML node. ```APIDOC ## GET elementChildren ### Description Returns the list of child Elements on this html Node, or an empty list if there are no children. ### Implementation ```dart List get elementChildren { return node.children; } ``` ``` -------------------------------- ### HtmlPadding inlineStart Property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlPaddings/inlineStart.html Details the implementation and usage of the 'inlineStart' property within the HtmlPadding class for Flutter HTML rendering. ```APIDOC ## HtmlPadding inlineStart Property ### Description The `inlineStart` property is a nullable `HtmlPadding` object that defines the padding applied to the start of an inline HTML element. ### Implementation ```dart final HtmlPadding? inlineStart; ``` ### Usage This property is typically used to customize the visual spacing of inline HTML content within a Flutter application. It allows for fine-grained control over the padding applied to the left side of inline elements, respecting the text direction. ### Parameters This property does not take direct parameters but is assigned an `HtmlPadding` object which itself may have properties defining the padding values. ``` -------------------------------- ### HtmlParser Constructor Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlParser/HtmlParser.html Initializes a new instance of the HtmlParser with required configuration parameters. ```APIDOC ## CONSTRUCTOR HtmlParser ### Description Initializes the HtmlParser widget with specific HTML data, styling rules, and event handlers for links and anchors. ### Parameters - **key** (Key) - Required - The widget key. - **htmlData** (Element) - Required - The HTML element data to parse. - **onLinkTap** (OnTap) - Required - Callback for link tap events. - **onAnchorTap** (OnTap) - Required - Callback for anchor tap events. - **onCssParseError** (OnCssParseError) - Required - Callback for CSS parsing errors. - **shrinkWrap** (bool) - Required - Whether the parser should shrink-wrap its content. - **style** (Map) - Required - Mapping of CSS selectors to Style objects. - **extensions** (List) - Required - List of extensions for custom tag rendering. - **doNotRenderTheseTags** (Set) - Required - Set of tags to exclude from rendering. - **onlyRenderTheseTags** (Set) - Required - Set of tags to exclusively render. - **root** (Html) - Optional - The root HTML object. ``` -------------------------------- ### CssBoxWidget Implementation Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/CssBoxWidget/CssBoxWidget.html Shows the implementation details of the CssBoxWidget constructor. ```APIDOC ## CssBoxWidget Implementation ### Description This section details the implementation of the CssBoxWidget constructor, showing how parameters are assigned. ### Method Constructor ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart const CssBoxWidget({ super.key, required this.child, required this.style, this.textDirection, this.childIsReplaced = false, this.shrinkWrap = false, this.top = false, }); ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Get paddingSize Property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/paddingSize.html Retrieves the current padding size of the widget. This getter returns a Size object. ```dart Size get paddingSize => _paddingSize; ``` -------------------------------- ### Get Margins in Flutter Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/margins.html Retrieves the current margins. This getter is part of a class that manages layout properties. ```dart Margins get margins => _margins; ``` -------------------------------- ### Initialize ExtensionContext Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ExtensionContext/ExtensionContext.html Constructs a new ExtensionContext object with required parameters for current step, node, and parser. ```dart ExtensionContext({ required this.currentStep, required this.node, required this.parser, this.styledElement, this.buildContext, BuildChildrenCallback? buildChildrenCallback, }) : _callbackToBuildChildren = buildChildrenCallback; ``` -------------------------------- ### RenderBox Methods Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox-class.html A collection of methods for managing children, computing layouts, and debugging RenderBox objects. ```APIDOC ## Methods ### add(RenderBox child) - **Description**: Append child to the end of this render object's child list. ### addAll(List? children) - **Description**: Add all the children to the end of this render object's child list. ### adoptChild(RenderObject child) - **Description**: Called by subclasses when they decide a render object is a child. ### computeDryLayout(BoxConstraints constraints) - **Description**: Computes the value returned by getDryLayout. Do not call this function directly, instead, call getDryLayout. - **Returns**: Size ### computeMaxIntrinsicHeight(double width) - **Description**: Computes the value returned by getMaxIntrinsicHeight. Do not call this function directly, instead, call getMaxIntrinsicHeight. - **Returns**: double ### computeMinIntrinsicWidth(double height) - **Description**: Computes the value returned by getMinIntrinsicWidth. Do not call this function directly, instead, call getMinIntrinsicWidth. - **Returns**: double ``` -------------------------------- ### Implement hashCode in Dart Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlPadding/hashCode.html Example implementation of the hashCode getter using Object.hash to combine object fields. ```dart @override int get hashCode => Object.hash(value, unit); ``` -------------------------------- ### ImageElement Constructor Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ImageElement-class.html Details for initializing an ImageElement instance. ```APIDOC ## Constructor: ImageElement ### Description Creates an instance of ImageElement to display an image within the styled document structure. ### Parameters - **name** (String) - Required - The name of the element. - **children** (List) - Required - The child elements. - **style** (Style) - Required - The style configuration for the element. - **node** (Node) - Required - The underlying DOM node. - **elementId** (String) - Required - The unique identifier for the element. - **src** (String) - Required - The source URL of the image. - **alt** (String?) - Required - The alternative text for the image. - **width** (Width?) - Required - The width of the image. - **height** (Height?) - Required - The height of the image. ``` -------------------------------- ### Get Width Property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/width.html Retrieves the current width value. This getter is used to access the internal width state. ```dart Width get width => _width; ``` -------------------------------- ### Implement beforeStyle Method Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlExtension/beforeStyle.html This is the default implementation of the beforeStyle method. It takes an ExtensionContext and performs no action, serving as a placeholder for custom logic. ```dart void beforeStyle(ExtensionContext context) {} ``` -------------------------------- ### GET horizontal property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Margins/horizontal.html Retrieves the total horizontal margin value based on the sum of left/inlineStart and right/inlineEnd properties. ```APIDOC ## GET horizontal ### Description Returns the total margin in the horizontal direction by calculating the sum of the left (or inlineStart) and right (or inlineEnd) margins. ### Method GET ### Endpoint horizontal ### Response #### Success Response (200) - **value** (double) - The calculated total horizontal margin. ``` -------------------------------- ### HtmlPaddings.all Constructor Implementation Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlPaddings/HtmlPaddings.all.html Initializes all sides of the padding with the same value and unit, while setting block and inline properties to null. ```dart HtmlPaddings.all(double value, [Unit? unit]) : left = HtmlPadding(value, unit), right = HtmlPadding(value, unit), inlineEnd = null, inlineStart = null, top = HtmlPadding(value, unit), bottom = HtmlPadding(value, unit), blockEnd = null, blockStart = null; ``` -------------------------------- ### Operator == Method Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/AnchorKey/operator_equals.html Explains the `operator ==` method, its purpose, requirements for overriding, and provides an example implementation. ```APIDOC ## operator == Method ### Description The equality operator (`==`) determines if two objects are considered equal. The default behavior is to check for object identity. This method can be overridden to define a custom equality relation. ### Requirements for Overriding When overriding the `operator ==`, the implementation must satisfy the properties of an equivalence relation: * **Total**: Must return a boolean for all inputs and never throw. * **Reflexive**: `o == o` must always be true. * **Symmetric**: If `o1 == o2` is true, then `o2 == o1` must also be true. * **Transitive**: If `o1 == o2` and `o2 == o3` are true, then `o1 == o3` must be true. Additionally, the equality comparison should remain consistent over time unless the objects themselves are modified. ### Consistency with hashCode If a subclass overrides the equality operator, it is crucial to also override the `hashCode` method to ensure consistency between equality and hashing. ### Implementation Example ```dart @override bool operator ==(Object other) => identical(this, other) || other is AnchorKey && runtimeType == other.runtimeType && parentKey == other.parentKey && id == other.id; ``` This example demonstrates the implementation of `operator ==` for an `AnchorKey` class, checking for object identity, type compatibility, and equality of `parentKey` and `id` fields. ``` -------------------------------- ### LineHeight Class Overview Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/LineHeight-class.html Provides an overview of the LineHeight class, its constructors, properties, and methods. ```APIDOC ## LineHeight Class ### Description Represents a line height value, which can be defined using various units like pixels, em, rem, percent, or as a unitless number. ### Constructors - **LineHeight(double? size, {String units = ""})** - Creates a LineHeight object with a given size and units. - **LineHeight.em(double em)** - Factory constructor to create a LineHeight object with 'em' units. - **LineHeight.number(double num)** - Factory constructor to create a LineHeight object with a unitless number. - **LineHeight.percent(double percent)** - Factory constructor to create a LineHeight object with '%' units. - **LineHeight.rem(double rem)** - Factory constructor to create a LineHeight object with 'rem' units. ### Properties - **size** (double?) - The numerical value of the line height. - **units** (String) - The unit of the line height (e.g., "px", "em", "rem", "%"). ### Methods - **noSuchMethod(Invocation invocation) → dynamic** - Invoked when a nonexistent method or property is accessed. (Inherited) - **toString() → String** - Returns a string representation of the object. (Inherited) ### Operators - **operator ==(Object other) → bool** - Checks for equality with another object. (Inherited) ### Constants - **normal** (const LineHeight) - A predefined constant for a normal line height. ``` -------------------------------- ### Get borderSize Property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/borderSize.html Retrieves the current border size. This getter is used to access the value of the _borderSize private variable. ```dart Size get borderSize => _borderSize; ``` -------------------------------- ### GET style property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ExtensionContext/style.html Retrieves the Style object associated with the StyledElement. Note that this property is only guaranteed to be non-null after the preparation step. ```APIDOC ## GET style ### Description Retrieves a reference to the Style object on the StyledElement representation of the node. ### Method GET ### Endpoint style ### Response - **style** (Style?) - A reference to the Style object. Guaranteed to be non-null only after the preparing step. ``` -------------------------------- ### WrapperElement Class Overview Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/WrapperElement-class.html Provides a structured overview of the WrapperElement class, detailing its inheritance, constructors, properties, and methods. ```APIDOC ## WrapperElement Class ### Description Represents a wrapper element in the HTML rendering process, inheriting from StyledElement. ### Inheritance * Object * StyledElement * WrapperElement ### Constructors #### WrapperElement ```dart WrapperElement({required StyledElement child}) ``` Creates a new WrapperElement with a specified child StyledElement. ### Properties #### attributes - **attributes** (Map) - Read-only. Returns the attributes of the element. #### children - **children** (List) - Getter/Setter. Returns or sets the children of the element. #### counters - **counters** (ListQueue) - Read-only. Returns the counters associated with the element. #### element - **element** (Element?) - Read-only. Returns the underlying DOM element if available. #### elementClasses - **elementClasses** (List) - Read-only. Returns the CSS classes applied to the element. #### elementId - **elementId** (String) - Read-only. Returns the ID of the element. #### hashCode - **hashCode** (int) - Read-only. Returns the hash code of the object. #### name - **name** (String) - Read-only. Returns the tag name of the element. #### node - **node** (Node) - Read-only. Returns the DOM node associated with the element. #### runtimeType - **runtimeType** (Type) - Read-only. Returns the runtime type of the object. #### style - **style** (Style) - Getter/Setter. Returns or sets the style of the element. ### Methods #### matches ```dart matches(Element element, String selector) ``` Checks if the given element matches the specified selector. Inherited from StyledElement. #### matchesSelector ```dart matchesSelector(String selector) ``` Checks if the element matches the specified selector. Inherited from StyledElement. #### noSuchMethod ```dart noSuchMethod(Invocation invocation) ``` Invoked when a nonexistent method or property is accessed. Inherited from Object. #### toString ```dart toString() ``` Returns a string representation of this object. Inherited from Object. ### Operators #### operator == ```dart operator ==(Object other) ``` The equality operator. Inherited from Object. ``` -------------------------------- ### Html.fromElement Constructor Implementation Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Html/Html.fromElement.html The implementation of the Html.fromElement constructor, showing the initialization of the documentElement and associated configuration parameters. ```dart Html.fromElement({ super.key, GlobalKey? anchorKey, required this.documentElement, this.onLinkTap, this.onAnchorTap, this.extensions = const [], this.onCssParseError, this.shrinkWrap = false, this.doNotRenderTheseTags, this.onlyRenderTheseTags, this.style = const {}, }) : data = null, assert(documentElement != null), _anchorKey = anchorKey ?? GlobalKey(); ``` -------------------------------- ### Get StyledElement Children Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ExtensionContext/styledElementChildren.html Returns the children of the StyledElement, cast to a List. This property is only guaranteed to be non-null after the preparing step. ```dart List get styledElementChildren { return styledElement!.children; } ``` -------------------------------- ### Implement prepare method for StyledElement Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/TagWrapExtension/prepare.html Use this method to define how an extension converts parsed HTML into a StyledElement. It requires an ExtensionContext and a list of child elements. ```dart @override StyledElement prepare( ExtensionContext context, List children) { return WrapperElement( child: context.parser.prepareFromExtension( context, children, extensionsToIgnore: {this}, ), ); } ``` -------------------------------- ### Get id property of an HTML element Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ExtensionContext/id.html Returns the id of the element, or an empty string if it is not present or this Node is not an html Element. ```dart String get id { if (node is html.Element) { return (node as html.Element).id; } return ''; } ``` -------------------------------- ### Get HTML Attributes in Flutter Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/StyledElement/attributes.html Accesses the `attributes` property of a node to retrieve a map of its HTML attributes. Ensure the node has attributes to access. ```dart Map get attributes => node.attributes.map((key, value) { return MapEntry(key.toString(), value); }); ``` -------------------------------- ### ParentKey Property Implementation Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/AnchorKey/parentKey.html Demonstrates the declaration and initialization of the final parentKey property. ```APIDOC ## ParentKey Property ### Description Represents a key that identifies the parent element. ### Implementation ```dart final Key parentKey; ``` ``` -------------------------------- ### Initialize HtmlExtension Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlExtension/HtmlExtension.html Use the constant constructor to instantiate the HtmlExtension class. ```dart const HtmlExtension(); ``` -------------------------------- ### Initialize ListStyleImage with URI Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ListStyleImage/ListStyleImage.html Use this constructor to create a ListStyleImage instance by providing the URI text for the image. ```dart const ListStyleImage(this.uriText); ``` -------------------------------- ### htmlPadding Property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/PaddingsFromEdgeInsetsDirectional/htmlPadding.html Provides access to the HtmlPaddings object, which allows for the configuration of top, bottom, inline start, and inline end padding for HTML elements. ```APIDOC ## htmlPadding Property ### Description Retrieves the HTML padding configuration. ### Method GET ### Endpoint `/websites/pub_dev_flutter_html/htmlPadding` ### Implementation Details This property returns an `HtmlPaddings` object, which is constructed using individual padding values (top, bottom, start, end). Each individual padding value is wrapped in an `HtmlPadding` object. ```dart HtmlPaddings get htmlPadding { return HtmlPaddings( top: HtmlPadding(top), bottom: HtmlPadding(bottom), inlineStart: HtmlPadding(start), inlineEnd: HtmlPadding(end), ); } ``` ### Response Example ```json { "top": {"value": 10}, "bottom": {"value": 10}, "inlineStart": {"value": 10}, "inlineEnd": {"value": 10} } ``` ``` -------------------------------- ### Html.fromDom Constructor Parameters Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Html/Html.fromDom.html Defines the parameters available for the Html.fromDom constructor, including optional and required arguments for customization. ```dart Html.fromDom({ 1. Key? key, 2. GlobalKey>? anchorKey, 3. required Document? document, 4. OnTap? onLinkTap, 5. OnTap? onAnchorTap, 6. List extensions = const [], 7. OnCssParseError? onCssParseError, 8. bool shrinkWrap = false, 9. Set? doNotRenderTheseTags, 10. Set? onlyRenderTheseTags, 11. Map style = const {}, }) ``` -------------------------------- ### Check if display is block Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/Display/isBlock.html Use this getter to determine if an element is set to display as a block. No specific setup is required beyond having the displayOutside property available. ```dart bool get isBlock { return displayOutside == DisplayOutside.block; } ``` -------------------------------- ### Get innerHtml of an Element Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ExtensionContext/innerHtml.html Retrieves the HTML content of an element. Returns an empty string if the element has no HTML content. For non-Element nodes, it returns the text content. ```dart String get innerHtml { if (node is html.Element) { return (node as html.Element).innerHtml; } return node.text ?? ""; } ``` -------------------------------- ### Define HtmlPadding inlineStart property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlPaddings/inlineStart.html Declaration of the inlineStart property within the HtmlPadding class. ```dart final HtmlPadding? inlineStart; ``` -------------------------------- ### Get Node Attributes Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ExtensionContext/attributes.html Returns a linked hash map representing the attributes of the node. Returns an empty map if the node has no attributes. The keys are converted to strings. ```dart LinkedHashMap get attributes { return LinkedHashMap.from(node.attributes.map((key, value) { // Key is either a String or html.AttributeName return MapEntry(key.toString(), value); })); } ``` -------------------------------- ### ListStyleImage Class Overview Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ListStyleImage-class.html Provides details on the ListStyleImage class, including its constructors, properties, and methods. ```APIDOC ## ListStyleImage Class ### Description Represents an image used within a list item's style. ### Constructors #### ListStyleImage(String uriText) Creates a new ListStyleImage instance. ### Properties - **hashCode** (int) - The hash code for this object. - **runtimeType** (Type) - A representation of the runtime type of the object. - **uriText** (String) - The text representation of the image URI. ### Methods - **noSuchMethod(Invocation invocation)** (dynamic) - Invoked when a nonexistent method or property is accessed. - **toString()** (String) - Returns a string representation of this object. ### Operators - **operator ==(Object other)** (bool) - Checks for equality with another object. ``` -------------------------------- ### HtmlParser Constructor Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/HtmlParser-class.html Initializes the HtmlParser widget with necessary configuration for rendering HTML data. ```APIDOC ## Constructor: HtmlParser ### Description Creates a new instance of the HtmlParser widget to process and display HTML content. ### Parameters - **key** (Key?) - Optional - Controls how one widget replaces another widget in the tree. - **htmlData** (Element) - Required - The parsed HTML DOM element to render. - **onLinkTap** (OnTap?) - Required - Callback triggered when a link is tapped. - **onAnchorTap** (OnTap?) - Required - Callback triggered when an anchor is tapped. - **onCssParseError** (OnCssParseError?) - Required - Callback for handling CSS parsing errors. - **shrinkWrap** (bool) - Required - Whether the widget should shrink-wrap its content. - **style** (Map) - Required - CSS styles to apply to the HTML elements. - **extensions** (List) - Required - Custom extensions for rendering specific tags. - **doNotRenderTheseTags** (Set?) - Required - Tags to exclude from rendering. - **onlyRenderTheseTags** (Set?) - Required - Tags to exclusively render. - **root** (Html?) - Optional - The root HTML context. ``` -------------------------------- ### Get shrinkWrap Property Value Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/shrinkWrap.html Retrieves the current boolean value of the shrinkWrap property. This is typically used to check if the widget is currently set to shrink wrap its content. ```dart bool get shrinkWrap => _shrinkWrap; ``` -------------------------------- ### Implement setupParentData for RenderBox Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/setupParentData.html Override this method to ensure child render objects have the appropriate CSSBoxParentData assigned. ```dart @override void setupParentData(RenderBox child) { if (child.parentData is! CSSBoxParentData) { child.parentData = CSSBoxParentData(); } } ``` -------------------------------- ### Implement computeDryBaseline in Flutter RenderBox Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox/computeDryBaseline.html This is an example implementation of the computeDryBaseline method. It returns null, indicating no baseline can be computed under the given constraints. This method is intended for overriding and should not be called directly. ```dart @override double? computeDryBaseline( covariant BoxConstraints constraints, TextBaseline baseline) { return null; } ``` -------------------------------- ### Get htmlPadding Property Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/PaddingsFromEdgeInsets/htmlPadding.html Retrieves the HtmlPaddings object, which encapsulates the padding values for top, bottom, left, and right. This getter is useful for accessing and applying custom padding to HTML elements. ```dart HtmlPaddings get htmlPadding { return HtmlPaddings( top: HtmlPadding(top), bottom: HtmlPadding(bottom), left: HtmlPadding(left), right: HtmlPadding(right), ); } ``` -------------------------------- ### Static Methods and Operators Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/RenderCSSBox-class.html Utility methods and equality operators for RenderObject. ```APIDOC ## operator == ### Description The equality operator. ## getIntrinsicDimension ### Description Static method to calculate intrinsic dimensions. ### Parameters #### Request Body - **firstChild** (RenderBox) - Required - The first child to consider. - **mainChildSizeGetter** (Function) - Required - Callback to get the size of a child. - **marginSpaceNeeded** (double) - Required - The margin space required. ``` -------------------------------- ### Get Child Elements of an HTML Node Source: https://pub.dev/documentation/flutter_html/latest/flutter_html/ExtensionContext/elementChildren.html This getter returns the list of child Elements of an HTML Node. If the node has no children, an empty list is returned. This is part of the implementation for accessing child nodes. ```dart List get elementChildren { return node.children; } ```