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 fill-rule="evenodd" clip-rule="evenodd" d="M25 10.1707C25.4922 10.3446 25.9254 10.6434 26.2616 11.0288L34.2521 9.0312C34.2677 9.02721 34.2834 9.02359 34.2992 9.02035C34.5282 8.97326 34.7564 9.00886 34.9515 9.10771C34.9972 9.13084 35.0411 9.15744 35.0827 9.18725C35.1936 9.26671 35.2887 9.369 35.3601 9.48939L40.0543 17H42V17.0029C41.9998 17.6925 41.9178 18.3617 41.7637 19C40.9312 22.4505 37.9947 25 34.5 25C31.0053 25 28.0689 22.4505 27.2363 19C27.0821 18.3608 27 17.6906 27 17L28.474 17L32.1789 11.6111L26.9986 12.9061C26.9995 12.9373 27 12.9686 27 13C27 14.3062 26.1652 15.4175 25 15.8293V38H28V40H34V42H14V40H20V38H23V15.8293C22.3419 15.5967 21.7891 15.1409 21.4327 14.5529L15.587 16.1118L20.185 23.2178H21.1199L21.1199 23.2207C21.1196 23.9102 21.0376 24.5794 20.8836 25.2178C20.051 28.6682 17.1146 31.2178 13.6199 31.2178C10.1252 31.2178 7.18874 28.6682 6.35616 25.2178C6.20191 24.5785 6.11987 23.9084 6.11987 23.2178L7.32813 23.2178L13.1831 14.9233C13.3181 14.732 13.5161 14.5941 13.7424 14.5338L21.0277 12.591C21.1811 11.4656 21.9586 10.5388 23 10.1707V6H25V10.1707ZM37.6958 17L34.4602 11.8231L30.901 17.0001L37.6958 17ZM17.8028 23.2178L13.964 17.2851L9.77619 23.2178L17.8028 23.2178ZM39.6903 19C38.9209 21.3852 36.8163 23 34.5 23C32.1838 23 30.0792 21.3852 29.3097 19.0001L39.6903 19ZM18.8102 25.2178C18.0407 27.603 15.9361 29.2178 13.6199 29.2178C11.3037 29.2178 9.19907 27.603 8.42957 25.2178L18.8102 25.2178ZM24 14C24.5523 14 25 13.5523 25 13C25 12.4477 24.5523 12 24 12C23.4477 12 23 12.4477 23 13C23 13.5523 23.4477 14 24 14Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);