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="M23.3 15C22.7477 15 22.3 15.4477 22.3 16C22.3 16.4478 22.5943 16.8268 23 16.9542V17.8961C22.3071 18.031 21.6633 18.3036 21.0984 18.6842L20.5142 18.1C20.8976 17.7089 20.8953 17.081 20.5071 16.6929C20.1166 16.3024 19.4834 16.3024 19.0929 16.6929L17.6929 18.0929C17.3024 18.4834 17.3024 19.1166 17.6929 19.5071C18.081 19.8952 18.7089 19.8976 19.1 19.5142L19.6842 20.0984C19.3036 20.6634 19.031 21.3071 18.8961 22H17.9542C17.8268 21.5943 17.4478 21.3 17 21.3C16.4477 21.3 16 21.7477 16 22.3V23.7C16 24.2523 16.4477 24.7 17 24.7C17.4478 24.7 17.8268 24.4057 17.9542 24H18.8961C19.031 24.6929 19.3036 25.3366 19.6842 25.9016L19.0999 26.4858C18.7089 26.1024 18.081 26.1048 17.6929 26.4929C17.3024 26.8834 17.3024 27.5166 17.6929 27.9071L19.0929 29.3071C19.4834 29.6977 20.1166 29.6977 20.5071 29.3071C20.8953 28.919 20.8976 28.2911 20.5142 27.9L21.0984 27.3158C21.6633 27.6964 22.3071 27.969 23 28.1039V29.0458C22.5943 29.1732 22.3 29.5522 22.3 30C22.3 30.5523 22.7477 31 23.3 31H23.9929L24 31L24.0071 31H24.7C25.2523 31 25.7 30.5523 25.7 30C25.7 29.5522 25.4057 29.1732 25 29.0458V28.1039C25.8629 27.9359 26.6494 27.5544 27.3026 27.0168L28.1858 27.9C27.8024 28.2911 27.8047 28.919 28.1929 29.3071C28.5834 29.6977 29.2166 29.6977 29.6071 29.3071L31.0071 27.9071C31.3976 27.5166 31.3976 26.8834 31.0071 26.4929C30.619 26.1048 29.9911 26.1024 29.6001 26.4858L28.5796 25.4653C28.8236 25.013 29.0026 24.5204 29.1039 24H30.0458C30.1732 24.4057 30.5522 24.7 31 24.7C31.5523 24.7 32 24.2523 32 23.7V22.3C32 21.7477 31.5523 21.3 31 21.3C30.5522 21.3 30.1732 21.5943 30.0458 22H29.1039C28.969 21.3071 28.6964 20.6634 28.3158 20.0984L28.9 19.5142C29.2911 19.8976 29.919 19.8952 30.3071 19.5071C30.6976 19.1166 30.6976 18.4834 30.3071 18.0929L28.9071 16.6929C28.5166 16.3024 27.8834 16.3024 27.4929 16.6929C27.1047 17.081 27.1024 17.7089 27.4858 18.1L26.9016 18.6842C26.3367 18.3036 25.6929 18.031 25 17.8961V16.9542C25.4057 16.8268 25.7 16.4478 25.7 16C25.7 15.4477 25.2523 15 24.7 15H23.3ZM24 26.2C22.2327 26.2 20.8 24.7673 20.8 23C20.8 21.2327 22.2327 19.8 24 19.8C25.7673 19.8 27.2 21.2327 27.2 23C27.2 24.7673 25.7673 26.2 24 26.2Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.0586 8.81882C33.6257 6.91845 28.8352 5.95858 24 6.00137C19.1648 5.95858 14.3743 6.91845 9.94142 8.81882L9.92574 8.8257C9.35116 9.08376 8.86205 9.50073 8.51935 10.0289C8.17724 10.5561 7.99628 11.1709 8.00006 11.7993V23.3011C8.00006 26.2585 8.6588 29.7788 10.7625 33.1062C12.8726 36.4437 16.3923 39.5159 21.9897 41.6333C23.2839 42.1222 24.716 42.1223 26.0103 41.6333C31.6073 39.519 35.1262 36.434 37.2362 33.0901C39.3396 29.7569 39.9999 26.2354 39.9999 23.3011V11.7992C40.0037 11.1709 39.8227 10.5561 39.4806 10.0289C39.138 9.50073 38.6488 9.08376 38.0743 8.8257L38.0586 8.81882ZM12.453 32.0374C10.5944 29.0977 10.0001 25.9694 10.0001 23.3011V11.796H9.00009L10 11.7887C9.99832 11.5525 10.0661 11.3194 10.1971 11.1175C10.327 10.9174 10.5141 10.7555 10.7384 10.6532C14.9161 8.86366 19.4321 7.95983 23.9909 8.00137H24.0091C28.5679 7.95983 33.0839 8.86366 37.2616 10.6532C37.4859 10.7554 37.673 10.9174 37.8029 11.1175C37.9339 11.3194 38.0017 11.5525 37.9999 11.7887V23.3011C37.9999 25.9441 37.4049 29.075 35.5448 32.0228C33.6914 34.96 30.5388 37.7847 25.3035 39.7623C24.4649 40.0792 23.5356 40.0792 22.6969 39.7625C17.4574 37.7805 14.3051 34.9669 12.453 32.0374Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);