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="M17 18C18.1046 18 19 17.1046 19 16C19 14.8954 18.1046 14 17 14C15.8954 14 15 14.8954 15 16C15 17.1046 15.8954 18 17 18Z" fill="black"/>
<path d="M25.0695 16.1067C25.0705 17.2702 24.1281 18.2142 22.9645 18.2151C21.801 18.2161 20.857 17.2737 20.8561 16.1101C20.8551 14.9466 21.7976 14.0026 22.9611 14.0017C24.1246 14.0007 25.0686 14.9432 25.0695 16.1067Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4615 21.8347C14 21.8347 12.6154 21.3825 12.6154 19.3476C12.6154 18.5425 12.3625 18.1622 12.0569 17.7024C11.59 17.0001 11 16.1125 11 13.243C11 3.58566 29 3.58566 29 13.243C29 16.1125 28.41 17.0001 27.9431 17.7024C27.6375 18.1622 27.3846 18.5425 27.3846 19.3476C27.3846 21.3825 25.5769 21.8347 25.5385 21.8347C25.5 21.8347 24.9231 23.1912 24.9231 24.0956C24.9231 25 22.3077 25 20 25C17.6923 25 15.0769 25 15.0769 24.0956C15.0769 23.1912 14.9231 21.8347 14.4615 21.8347ZM14.6874 19.8307C14.6898 19.8363 14.6922 19.8414 14.6944 19.8459C15.7743 19.9517 16.3246 20.7757 16.4964 21.0817C16.7214 21.4825 16.8347 21.9096 16.8986 22.21C16.947 22.438 16.9837 22.6761 17.0107 22.9125C17.7989 22.9971 18.8542 23 20 23C21.1836 23 22.2706 22.9969 23.0664 22.9038C23.1431 22.5546 23.2377 22.2402 23.3169 21.9999C23.4077 21.7243 23.5021 21.4764 23.5828 21.2847C23.6217 21.1923 23.6662 21.092 23.7126 20.9993C23.7324 20.9598 23.7731 20.8801 23.8285 20.7913C23.8512 20.755 23.9154 20.6532 24.0136 20.5384C24.0596 20.4847 24.1647 20.3664 24.3236 20.2452C24.3971 20.1892 24.6558 19.9932 25.0558 19.8937L25.0621 19.891C25.1078 19.8716 25.1685 19.8392 25.2224 19.7958C25.2721 19.7559 25.3039 19.7168 25.3254 19.6752C25.3431 19.641 25.3846 19.548 25.3846 19.3476C25.3846 17.8638 26.0422 16.9175 26.3528 16.4705C26.4041 16.3966 26.446 16.3364 26.4738 16.2896C26.6474 15.9981 27 15.3589 27 13.243C27 11.5415 26.2439 10.3101 25.0239 9.4374C23.7446 8.52225 21.9261 8 20 8C18.0739 8 16.2554 8.52225 14.9761 9.4374C13.7561 10.3101 13 11.5415 13 13.243C13 15.3589 13.3526 15.9981 13.5262 16.2896C13.554 16.3364 13.5959 16.3966 13.6472 16.4705C13.9578 16.9175 14.6154 17.8638 14.6154 19.3476C14.6154 19.6272 14.6623 19.7707 14.6849 19.8248C14.6857 19.8268 14.6865 19.8288 14.6874 19.8307Z" fill="black"/>
<path d="M18.9251 31.6207C20.1554 31.2147 21.5241 31 22.9198 31C24.3154 31 25.6842 31.2148 26.9146 31.6207L30.5867 32.8317C32.9233 33.6019 35.4878 33.9996 38.08 34H39.3663L36.2927 37.0748C35.9023 37.4654 35.9024 38.0986 36.293 38.489C36.6836 38.8795 37.3168 38.8793 37.7073 38.4887L42.4873 33.7067C42.8776 33.3162 42.8776 32.6833 42.4873 32.2928L37.7073 27.5108C37.3168 27.1202 36.6836 27.1201 36.293 27.5105C35.9024 27.901 35.9023 28.5341 36.2927 28.9247L39.3667 32H38.08C35.6874 31.9996 33.3353 31.6318 31.2128 30.9323L27.541 29.7213C26.0963 29.2447 24.5151 29 22.9198 29C21.3246 29 19.743 29.2448 18.2985 29.7213L14.6268 30.9283C12.5754 31.6044 10.3096 31.9706 8 31.9947V6H6V41C6 41.5523 6.44772 42 7 42H42V40H8V33.9948C10.5101 33.9707 12.9886 33.574 15.2528 32.8277L18.9251 31.6207Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);