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="M37 16V18H30V16H37Z" fill="black"/>
<path d="M30 13V15H37V13H30Z" fill="black"/>
<path d="M30 21H37V19H30V21Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.00019 8C6.69091 8 6.38482 8.01274 6.08241 8.03769L5.91797 6.04446C6.27502 6.015 6.63596 6 7.00019 6C14.1799 6 20.0002 11.8203 20.0002 19V20.3021L20.043 20.3524C22.9653 23.7912 24.5135 27.1795 24.5354 30.5221C25.4609 30.6012 26.2316 30.8943 26.8252 31.4286C27.5196 32.0536 27.837 32.8886 27.9839 33.6961C28.1297 34.4983 28.1246 35.3725 28.093 36.1798C28.0812 36.4802 28.0662 36.7666 28.0517 37.0434C28.025 37.5523 28 38.0289 28 38.5C28 38.8934 28.1325 39.0827 28.3171 39.2166C28.5538 39.3884 28.9777 39.5314 29.6273 39.5603C30.92 39.6178 32.67 39.2042 34.2267 38.4941C34.9957 38.1434 35.682 37.7362 36.2157 37.3112C36.7614 36.8768 37.0843 36.4742 37.2225 36.1523C37.34 35.8784 37.3232 35.6852 37.1956 35.4791C37.0306 35.2127 36.6097 34.8236 35.6576 34.421C34.6319 33.9873 33.873 33.4011 33.3444 32.6755C32.8185 31.9536 32.5667 31.1572 32.4536 30.3741C32.3421 29.6018 32.3616 28.8099 32.4006 28.0817C32.4125 27.8584 32.426 27.644 32.4391 27.4358C32.4707 26.9333 32.5 26.467 32.5 26H31V24H26C25.4477 24 25 23.5523 25 23C25 22.4477 25.4477 22 26 22H27V8.5C27 7.11929 29.9101 6 33.5 6C37.0898 6 40 7.11929 40 8.5V22H41C41.5523 22 42 22.4477 42 23C42 23.5523 41.5523 24 41 24H36V26H34.5C34.5 26.534 34.4646 27.0977 34.4315 27.6242C34.4193 27.8185 34.4074 28.0077 34.3977 28.1885C34.36 28.8931 34.3512 29.521 34.4331 30.0883C34.5135 30.6449 34.6767 31.1078 34.9609 31.4979C35.2425 31.8843 35.6888 32.2627 36.4366 32.579C37.5633 33.0554 38.4187 33.6557 38.8958 34.4259C39.4102 35.2564 39.4012 36.1469 39.0604 36.9411C38.7401 37.6872 38.1385 38.3369 37.4615 38.8759C36.7726 39.4244 35.9383 39.9117 35.0567 40.3138C33.3123 41.1094 31.2414 41.6341 29.5385 41.5583C28.6903 41.5206 27.8227 41.329 27.1425 40.8354C26.4101 40.3039 26 39.4969 26 38.5C26 37.9797 26.0297 37.4084 26.0579 36.8646C26.0716 36.6009 26.085 36.3432 26.0945 36.1014C26.1253 35.315 26.1203 34.6267 26.0161 34.0539C25.9129 33.4864 25.7304 33.1339 25.4873 32.9152C25.2912 32.7387 24.9621 32.5651 24.3654 32.5146C23.7962 35.6985 21.8166 38.653 18.6577 41.4097L18.2899 41.7307L17.8105 41.6381L17.8048 41.637L17.7911 41.6343L17.741 41.6243C17.6978 41.6156 17.6352 41.6029 17.5556 41.5862C17.3966 41.5528 17.1692 41.5036 16.8923 41.4397C16.3397 41.312 15.5842 41.1243 14.7775 40.8843C13.9742 40.6453 13.1008 40.3489 12.3196 40.0009C11.5641 39.6642 10.7879 39.2337 10.2718 38.6854C10.2456 38.6576 10.2206 38.6294 10.1968 38.6008L10.0002 38.5165V43H8.00019V37C8.00019 36.6639 8.16907 36.3502 8.4497 36.1652C8.73032 35.9801 9.08514 35.9484 9.39411 36.0809L10.1124 36.3887C10.22 36.1914 10.3447 36.0076 10.4695 35.8407C10.9454 35.204 11.6744 34.4949 12.3838 33.8048C12.4661 33.7248 12.5481 33.645 12.6294 33.5656C13.4498 32.7648 14.2567 31.9541 14.861 31.1322C15.4742 30.2983 15.7809 29.5811 15.7809 28.9688C15.7809 26.9154 16.4634 24.78 17.1054 23.2111C17.431 22.4155 17.7562 21.7416 18.0007 21.2655L18.0245 21.2192C18.0084 21.1476 18.0002 21.0741 18.0002 21V19C18.0002 12.9249 13.0753 8 7.00019 8ZM37.3782 8.59892C37.6731 8.71232 37.8734 8.81908 38 8.90036V22H29V8.90036C29.1266 8.81908 29.3269 8.71232 29.6217 8.59892C30.5158 8.25506 31.8864 8 33.5 8C35.1136 8 36.4842 8.25506 37.3782 8.59892ZM18.9564 23.9686C19.1298 23.545 19.3032 23.1585 19.4621 22.8233C21.756 25.8665 22.6982 28.6542 22.5128 31.2336C22.3118 34.0297 20.7699 36.8012 17.7121 39.5742C17.6038 39.5505 17.4797 39.5227 17.3424 39.491C16.8169 39.3696 16.1036 39.1922 15.3478 38.9673C14.5885 38.7414 13.8055 38.4734 13.1336 38.174C12.5278 37.9041 12.0908 37.6424 11.833 37.4154C11.8708 37.335 11.942 37.2112 12.0713 37.0382C12.4464 36.5366 13.0537 35.9447 13.8007 35.2169L14.0264 34.9968C14.8387 34.2039 15.7583 33.2881 16.4723 32.317C17.1774 31.358 17.7809 30.2158 17.7809 28.9688C17.7809 27.3034 18.3484 25.4543 18.9564 23.9686Z" fill="black"/>
<path d="M14.5 23C15.3284 23 16 22.3284 16 21.5C16 20.6716 15.3284 20 14.5 20C13.6716 20 13 20.6716 13 21.5C13 22.3284 13.6716 23 14.5 23Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);