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="M25.3038 23.3228C26.2953 22.2005 27.7693 21.8828 28.5963 22.6133C29.4232 23.3438 29.2898 24.8458 28.2984 25.9681C27.6496 26.7025 26.7942 27.0924 26.0486 27.0695L26.0462 27.0736C25.8393 27.4208 25.7437 27.8365 25.6616 28.2497L25.6527 28.2948C25.5778 28.675 25.4728 29.1794 24.9805 29.6894C24.4761 30.2118 23.5489 30.3964 22.5819 30.5613C21.941 30.6705 21.609 30.7742 21.4472 30.8421C21.3138 30.898 21.1836 31.1932 21.0048 31.5984C20.7129 32.2602 20.2915 33.2153 19.5159 33.8996C19.4056 32.9067 19.7182 31.1782 19.8953 30.245C20.0199 29.9324 20.2322 29.6836 20.5013 29.4917C20.9742 29.1544 21.6758 28.9603 22.5819 28.8059C23.416 28.6637 23.6403 28.485 23.6956 28.4277C23.743 28.3786 23.7823 28.318 23.8704 27.8746L23.8796 27.8278C23.9598 27.4224 24.0783 26.8225 24.4658 26.1723C24.4979 26.1184 24.5316 26.0646 24.5669 26.0109C24.2976 25.2269 24.5578 24.1674 25.3038 23.3228Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24 38C29.5228 38 34 33.5228 34 28C34 22.4772 29.5228 18 24 18C18.4772 18 14 22.4772 14 28C14 33.5228 18.4772 38 24 38ZM30.3199 32.9056C31.3729 31.551 32 29.8487 32 28C32 23.5817 28.4183 20 24 20C22.1513 20 20.449 20.6271 19.0944 21.6801L23.2071 25.7929L21.7929 27.2071L17.6801 23.0944C16.6271 24.449 16 26.1513 16 28C16 32.4183 19.5817 36 24 36C25.8487 36 27.551 35.3729 28.9056 34.3199L25.7929 31.2071L27.2071 29.7929L30.3199 32.9056Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.2656 5.47416C16.5019 5.77566 16 6.51335 16 7.33446V12H17.5962L18.8056 13.5845L13.4436 15.3408C11.3893 16.0137 10 17.9306 10 20.0924V38.9999C10 41.7614 12.2386 43.9999 15 43.9999H33C35.7614 43.9999 38 41.7614 38 38.9999V20.0924C38 17.9306 36.6107 16.0137 34.5564 15.3408L29.1944 13.5845L30.4038 12H32V7.33446C32 6.51335 31.4981 5.77566 30.7344 5.47416L27.7078 4.2794C27.2401 4.09479 26.7418 4 26.2391 4H21.7609C21.2582 4 20.7599 4.09479 20.2922 4.2794L17.2656 5.47416ZM29.8942 10C29.9046 9.99984 29.915 9.99984 29.9255 10H30V7.33446L26.9734 6.1397C26.7396 6.04739 26.4905 6 26.2391 6H21.7609C21.5095 6 21.2604 6.04739 21.0266 6.1397L18 7.33446V10H18.0745C18.0778 9.99995 18.0811 9.99991 18.0843 9.9999C18.0915 9.99985 18.0987 9.99989 18.1058 10H29.8942ZM20.3954 12.3711L20.1122 12H27.8878L27.6046 12.3711C26.7693 13.4654 27.2636 15.0567 28.5718 15.4852L33.9338 17.2414C35.1664 17.6452 36 18.7954 36 20.0924V38.9999C36 40.6568 34.6569 41.9999 33 41.9999H15C13.3431 41.9999 12 40.6568 12 38.9999V20.0924C12 18.7954 12.8336 17.6452 14.0662 17.2414L19.4282 15.4852C20.7364 15.0567 21.2307 13.4654 20.3954 12.3711Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);