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="M35 30.5C35 31.8807 33.8807 33 32.5 33C31.1193 33 30 31.8807 30 30.5C30 29.1193 31.1193 28 32.5 28C33.8807 28 35 29.1193 35 30.5ZM33 30.5C33 30.7761 32.7761 31 32.5 31C32.2239 31 32 30.7761 32 30.5C32 30.2239 32.2239 30 32.5 30C32.7761 30 33 30.2239 33 30.5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M23 20.5V6.00013C23 6.00004 23 6 24 6C25 6 25 6.00004 25 6.00013V20.5C25 21.8977 25.5641 22.4421 26.0039 22.6987C26.053 22.7273 26.1024 22.7533 26.1516 22.7769C26.1506 22.6563 26.1492 22.5306 26.1478 22.4003C26.11 18.8716 26.0364 12 31.4753 12C35.6009 12 39.0738 19.9741 40.8098 27.5418C40.9191 27.8051 40.9848 28.0911 40.9977 28.3909C42.2303 34.1737 42.4133 39.531 41.0546 40.6602C37.8615 43.3139 31.4753 41.7217 28.2821 38.5372C25.7041 35.9662 25.9272 29.9586 26.0873 25.646L26.0874 25.6442C26.0971 25.3818 26.1066 25.1257 26.1152 24.8771C25.79 24.7962 25.3959 24.6595 24.9962 24.4263C24.6398 24.2184 24.2975 23.9442 24 23.5918C23.7025 23.9442 23.3602 24.2184 23.0038 24.4263C22.6041 24.6595 22.21 24.7962 21.8848 24.8771C21.8934 25.1263 21.9029 25.383 21.9127 25.646C22.0728 29.9586 22.2959 35.9662 19.7179 38.5372C16.5247 41.7217 10.1385 43.3139 6.94536 40.6602C3.75222 38.0065 9.07413 12 16.5247 12C21.9636 12 21.89 18.8716 21.8522 22.4003L21.8522 22.4018C21.8508 22.5316 21.8494 22.6568 21.8484 22.7769C21.8976 22.7533 21.947 22.7273 21.9961 22.6987C22.4359 22.4421 23 21.8977 23 20.5ZM38.3268 25.8609L38.3654 26.0036C37.0473 26.0735 36 27.1644 36 28.5C36 29.8807 37.1193 31 38.5 31C38.8287 31 39.1426 30.9366 39.4301 30.8212C39.7 32.3867 39.8787 33.8706 39.9562 35.1806C40.035 36.5125 40.0046 37.5936 39.8878 38.3686C39.8294 38.7557 39.7576 39.0098 39.6984 39.1577C39.6923 39.1729 39.6867 39.186 39.6818 39.1972C38.7223 39.9272 37.0841 40.2192 35.0491 39.8246C32.9907 39.4254 30.9725 38.3957 29.6944 37.1211C29.2508 36.6787 28.8538 35.9486 28.5573 34.8599C28.2641 33.7838 28.1071 32.4988 28.0404 31.0985C27.9741 29.7058 27.9995 28.266 28.0443 26.8908C28.0565 26.5144 28.0706 26.1367 28.0844 25.7647L28.0844 25.7636L28.0845 25.7624C28.0961 25.448 28.1077 25.1375 28.1178 24.8353C28.4796 26.0857 29.633 27 31 27C32.6569 27 34 25.6569 34 24C34 22.3431 32.6569 21 31 21C29.6749 21 28.5505 21.8591 28.1533 23.0507C28.1528 22.8215 28.1505 22.5809 28.1482 22.3313V22.3301C28.133 20.6828 28.1141 18.6399 28.559 16.8649C28.8132 15.851 29.1752 15.1334 29.6086 14.6872C29.9842 14.3005 30.5212 14 31.4753 14C31.7935 14 32.2518 14.134 32.8702 14.6538C33.2823 15 33.7155 15.4778 34.1588 16.0877C33.9489 16.0305 33.728 16 33.5 16C32.1193 16 31 17.1193 31 18.5C31 19.8807 32.1193 21 33.5 21C34.6588 21 35.6334 20.2117 35.9168 19.142C36.8439 21.1035 37.6652 23.4338 38.3268 25.8609ZM38.9932 28.5829C38.9667 28.4611 38.9397 28.3391 38.9122 28.2169C38.822 28.0859 38.6711 28 38.5 28C38.2239 28 38 28.2239 38 28.5C38 28.7761 38.2239 29 38.5 29C38.7479 29 38.9537 28.8196 38.9932 28.5829ZM16.5247 14C17.4788 14 18.0158 14.3005 18.3914 14.6872C18.8248 15.1334 19.1868 15.851 19.441 16.8649C19.8859 18.6399 19.867 20.6822 19.8518 22.3296C19.8491 22.6146 19.8466 22.8877 19.8466 23.1456C19.8466 23.9056 19.8804 24.8156 19.9155 25.7624C19.9294 26.1352 19.9434 26.5136 19.9557 26.8908C20.0005 28.266 20.0259 29.7058 19.9596 31.0985C19.8929 32.4988 19.7359 33.7838 19.4427 34.8599C19.1462 35.9486 18.7492 36.6787 18.3056 37.1211C17.0275 38.3957 15.0093 39.4254 12.9509 39.8246C10.9159 40.2192 9.27768 39.9272 8.31823 39.1972C8.31326 39.186 8.3077 39.1729 8.30162 39.1577C8.24241 39.0098 8.17061 38.7557 8.11224 38.3686C7.99539 37.5936 7.965 36.5125 8.0438 35.1806C8.20056 32.5308 8.77147 29.1692 9.67324 25.8609C10.5785 22.5399 11.7827 19.4001 13.1479 17.1386C13.8313 16.0065 14.5049 15.1789 15.1298 14.6538C15.7482 14.134 16.2065 14 16.5247 14ZM33.5 19C33.7761 19 34 18.7761 34 18.5C34 18.2239 33.7761 18 33.5 18C33.2239 18 33 18.2239 33 18.5C33 18.7761 33.2239 19 33.5 19ZM32 24C32 24.5523 31.5523 25 31 25C30.4477 25 30 24.5523 30 24C30 23.4477 30.4477 23 31 23C31.5523 23 32 23.4477 32 24Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);