CssBorderRadiusHtmlExtension class
Adds runtime support for native CSS border-radius via a wrapper + clipping.
Renders the CSS border-radius properties, which flutter_html 3.0.0
drops from an inline style without an error or a warning.
Reads border-radius, the four physical corner properties and the logical
corner properties (border-start-start-radius and so on, treated as
left-to-right), including the elliptical horizontal / vertical form. A
matching element is wrapped in a clipped, rounded container; border,
border-width and border-color from the same element are re-applied
around the clip and margin* is moved outside it.
Register this extension after any extension that expands utility classes
into inline styles. Both act at CurrentStep.preStyling and flutter_html
visits them in registration order, so listed first this one reads a
style="" the other has not written to yet and cannot extract the
element's border and margin. The radius still clips either way; the
border then renders square around the rounded clip.
With wrapIfHasAnyClass at its default true, every element that carries a
class is wrapped up front and the radius is read at the building step, after
the class has been expanded. An element with no class and no
border-radius* in its final inline style gets no widget.
Only the inline style="" is read. This does not make flutter_html parse
border-radius from <style> blocks or stylesheets.
Constructors
-
CssBorderRadiusHtmlExtension({bool wrapIfHasAnyClass = true, Iterable<
String> extraTags = const {}, double? rootFontSize}) -
const
Properties
-
extraTags
→ Iterable<
String> -
Declares extra tags this extension claims. It has no effect.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- rootFontSize → double?
-
The
rembasis, in logical pixels.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
supportedTags
→ Set<
String> -
Tells the
HtmlParserwhat additional tags to add to the default supported tag list (the extension's user can still override this by setting an explicit tagList on the Html widget).no setter - wrapIfHasAnyClass → bool
-
Wrap any element that carries a class, before knowing whether it will end
up with a radius.
final
Methods
-
beforeProcessing(
ExtensionContext context) → void - Called after styling, but before extra elements/whitespace has been removed, margins collapsed, list characters processed, or relative values calculated. Default behavior: do nothing;
-
beforeStyle(
ExtensionContext context) → void - Called before styles are applied to the tree. Default behavior: do nothing;
-
build(
ExtensionContext context) → InlineSpan -
The final step in the chain. Converts the StyledElement tree, with its
attached
Styleelements, into anInlineSpantree that includes Widget/TextSpans that can be rendered in a RichText widget. -
matches(
ExtensionContext context) → bool - This method is called to test whether or not this extension needs to do any work in this context.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDispose(
) → void - Called when the Html widget is being destroyed. This would be a very good place to dispose() any controllers or free any resources that the extension uses. Default behavior: do nothing.
-
prepare(
ExtensionContext context, List< StyledElement> children) → StyledElement - Converts parsed HTML to a StyledElement.
-
toString(
) → String -
A string representation of this object.
inherited
-
wrapWithRadiusPreserveBorder(
{required Widget child, required BorderRadius radius, Border? border, double borderInset = 0}) → Widget
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited