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="M43.999 26.4989C43.999 25.6705 43.3274 24.9989 42.499 24.9989H26.999V22.9989L39.499 22.9989C40.3274 22.9989 40.999 22.3274 40.999 21.4989C40.999 20.6705 40.3274 19.9989 39.499 19.9989L23.9136 19.9989C22.0092 19.9989 21.1825 17.5894 22.6857 16.4202L26.7826 13.2337C27.5728 12.6191 27.5623 11.4214 26.7614 10.8207C26.2653 10.4486 25.5926 10.4157 25.0625 10.7376L13.6717 17.6282L12.5 15.9999L24.0243 9.02818C25.2528 8.28213 26.8116 8.35836 27.9614 9.22074C29.8173 10.6126 29.8416 13.3882 28.0105 14.8124L23.9136 17.9989L39.499 17.9989C41.432 17.9989 42.999 19.5659 42.999 21.4989C42.999 22.0372 42.8775 22.547 42.6605 23.0026C44.5185 23.0869 45.999 24.62 45.999 26.4989C45.999 28.3778 44.5185 29.9109 42.6605 29.9953C42.8775 30.4508 42.999 30.9607 42.999 31.4989C42.999 33.4319 41.432 34.9989 39.499 34.9989H36.6622C36.8782 35.4536 36.999 35.9621 36.999 36.4989C36.999 38.4319 35.432 39.9989 33.499 39.9989H13.8131L16.5 37.9999L33.499 37.9989C34.3274 37.9989 34.999 37.3274 34.999 36.4989C34.999 35.6705 34.3274 34.9989 33.499 34.9989H24.8814V32.9989H39.499C40.3274 32.9989 40.999 32.3274 40.999 31.4989C40.999 30.6705 40.3274 29.9989 39.499 29.9989H26.999V27.9989H42.499C43.3274 27.9989 43.999 27.3274 43.999 26.4989Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.56666 16.9999C9.56666 17.8227 9.48631 18.6001 9.34183 19.3464C8.81354 22.0754 7.42785 24.3888 5.97806 26.9895C4.30135 29.9972 4.98402 32.7102 6.49472 35.2433C7.05639 36.185 7.73253 37.1019 8.44442 37.9999C8.44442 37.7944 8.44412 37.5971 8.44384 37.4072C8.44218 36.3177 8.4409 35.4751 8.49882 34.7652C8.666 32.7163 9.32637 31.7735 11.8944 29.1939C13.0657 31.2909 12.7726 33.4622 12.3416 35.6679C12.2988 35.8871 12.2546 36.1066 12.2104 36.3264C12.0984 36.8825 11.9861 37.4406 11.8944 37.9999C12.3631 37.7735 12.8269 37.5628 13.2818 37.3562C13.5534 37.2327 13.8219 37.1107 14.0864 36.9877C16.1803 36.0138 18.022 34.9758 19.1915 32.6498C20.5715 29.9053 19.9626 27.7365 19.0142 25.1129C18.6929 24.2241 18.3326 23.2831 17.9975 22.2499C17.5903 23.7499 16.8314 25.1135 16.3385 26.0681C15.3567 22.2663 12.557 19.4812 9.56666 16.9999Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);