build method
Describes the part of the user interface represented by this widget.
The framework calls this method when this widget is inserted into the tree in a given BuildContext and when the dependencies of this widget change (e.g., an InheritedWidget referenced by this widget changes). This method can potentially be called in every frame and should not have any side effects beyond building a widget.
The framework replaces the subtree below this widget with the widget returned by this method, either by updating the existing subtree or by removing the subtree and inflating a new subtree, depending on whether the widget returned by this method can update the root of the existing subtree, as determined by calling Widget.canUpdate.
Typically implementations return a newly created constellation of widgets that are configured with information from this widget's constructor and from the given BuildContext.
The given BuildContext contains information about the location in the tree at which this widget is being built. For example, the context provides the set of inherited widgets for this location in the tree. A given widget might be built with multiple different BuildContext arguments over time if the widget is moved around the tree or if the widget is inserted into the tree in multiple places at once.
The implementation of this method must only depend on:
- the fields of the widget, which themselves must not change over time, and
- any ambient state obtained from the
context
using BuildContext.dependOnInheritedWidgetOfExactType.
If a widget's build method is to depend on anything else, use a StatefulWidget instead.
See also:
- StatelessWidget, which contains the discussion on performance considerations.
Implementation
@override
widgets.Widget build(widgets.BuildContext context) => SvgPicture.string(
'''
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M35.4653 12.1208C32.5915 9.74505 28.9668 8.24436 25 8.02729L25 13L23 13L23 8.02729C19.0332 8.24437 15.4086 9.74503 12.5348 12.1207L15.5356 15.1213L14.1214 16.5356L11.065 13.4793C8.36313 16.2691 6.55677 19.9303 6.10881 24H10.0527V26H6C6.00246 30.2022 7.44565 34.0662 9.86416 37.1274L12.7825 34.209L14.1967 35.6232L11.1915 38.6285L11.2103 38.6475L9.78969 40.0553C6.21161 36.4446 4 31.4741 4 25.9892C4 14.949 12.9548 6 24 6C35.0452 6 44 14.949 44 25.9892C44 31.6236 41.6663 36.7148 37.9152 40.3471L36.5239 38.9103L36.5365 38.898L33.0594 35.4209L34.4736 34.0067L37.894 37.427C40.4578 34.3201 41.9975 30.3403 42 26H37.6843V24H41.8912C41.4432 19.9303 39.6369 16.2692 36.9351 13.4794L33.9999 16.4142L32.5858 14.9999L35.4653 12.1208Z" fill="black"/>
<path d="M20.6265 37.7042C20.5982 38.0964 20.714 38.4854 20.9522 38.7983L22.8746 41.0096C24.0001 41.5001 24.5001 41.5001 25.4427 41.0096L27.3651 38.7983C27.6033 38.4854 27.7191 38.0964 27.6908 37.7042L25.3096 23.9021C25.1654 21.9052 23.1404 21.8871 22.9961 23.8839L20.6265 37.7042Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);