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="M27.5 10.5C27.5 8.01472 29.5148 6 32 6C34.4853 6 36.5 8.01472 36.5 10.5C36.5 12.0806 35.6852 13.4708 34.4526 14.2735L35.8893 14.0341C36.9145 13.8632 37.9386 14.3445 38.4612 15.2429L41.661 20.7429C42.1809 21.6367 42.097 22.7583 41.4498 23.5648L38.9512 26.6784L38.9724 26.7668C39.3015 28.1389 39.5943 29.5767 39.8544 30.8537C39.8594 30.878 39.8643 30.9023 39.8693 30.9265C39.9038 31.096 39.9377 31.2625 39.9711 31.4255C40.2676 32.8744 40.5066 33.9816 40.7053 34.5452C41.1086 35.6889 40.4417 37.103 39.0857 37.2718C35.1058 37.7675 30.5075 37.7795 26.5308 37.2623C25.2474 37.0953 24.5643 35.7884 24.9208 34.6592C25.0077 34.3839 25.1174 34.0412 25.2418 33.6527C25.6741 32.3027 26.2839 30.3982 26.7326 28.8348L25.8041 27.6617C25.5062 28.3672 24.8893 28.9271 24.0878 29.121C22.7854 29.436 21.5818 29.6862 20.4306 29.8684V33.2596C20.4358 33.2911 20.4404 33.3228 20.4444 33.3547L21.1778 39.1882C21.3463 40.5285 20.4195 41.7602 19.085 41.9697C17.7505 42.1792 16.4909 41.2907 16.2406 39.9632L16.1306 39.3801L16.0207 39.9632C15.7703 41.2907 14.5108 42.1792 13.1762 41.9697C11.8417 41.7602 10.915 40.5285 11.0835 39.1882L11.8168 33.3547C11.8208 33.3228 11.8254 33.2911 11.8306 33.2596V29.8892C10.607 29.7043 9.32848 29.4473 7.93905 29.1273C6.59355 28.8175 5.75399 27.4755 6.06382 26.13C6.37366 24.7845 7.71558 23.945 9.06108 24.2548C10.731 24.6394 12.1382 24.9054 13.4249 25.061C12.5536 24.3272 12 23.2283 12 22C12 19.7909 13.7909 18 16 18C18.2092 18 20 19.7909 20 22C20 23.2396 19.4362 24.3475 18.5509 25.0812C19.8393 24.9316 21.2458 24.6642 22.9123 24.2611C23.0056 24.2386 23.0989 24.2216 23.1919 24.2099C22.9175 23.5497 22.9348 22.7911 23.2643 22.132L25.7366 17.1875C26.2374 16.1859 27.1871 15.4845 28.2917 15.3004L30.9025 14.8652C28.9477 14.3753 27.5 12.6067 27.5 10.5ZM32 8C30.6193 8 29.5 9.11929 29.5 10.5C29.5 11.8807 30.6193 13 32 13C33.3807 13 34.5 11.8807 34.5 10.5C34.5 9.11929 33.3807 8 32 8ZM31.6576 27.3105C31.5707 27.0011 31.4224 26.7035 31.2105 26.4358L30.0215 24.9336L33.0009 23.4439L30.0924 22.4743C29.8883 22.4063 29.7506 22.2153 29.7505 22.0001L29.7503 20.0001C29.7502 19.7239 29.9741 19.5 30.2502 19.5C30.5264 19.5 30.7502 19.7238 30.7503 19.9999L30.7505 21.6396L34.3674 22.8453L34.7383 23.0383C34.9044 23.1248 35.047 23.2576 35.1455 23.4321L34.3505 24.4227C34.0545 24.7915 33.8802 25.2185 33.8221 25.6554L33.6898 25.8138C33.1994 26.4013 32.8573 26.7935 32.5555 27.047C32.2735 27.2839 32.1297 27.3105 32.0407 27.3105H31.6576ZM28.3885 30.3345L28.3537 30.4102C27.9462 31.7661 27.4812 33.2178 27.1385 34.288C27.0171 34.6672 26.9107 34.9993 26.828 35.2613C26.8276 35.2626 26.8272 35.2639 26.8269 35.2651C26.8262 35.2677 26.8257 35.2702 26.8254 35.2724C26.8253 35.2735 26.8252 35.2746 26.8251 35.2756C26.8249 35.2786 26.8249 35.2813 26.8252 35.2837C30.6103 35.7723 35.0119 35.7614 38.8139 35.2902C38.8256 35.268 38.8289 35.2379 38.8192 35.2103C38.5635 34.4853 38.2956 33.214 38.0117 31.8264C37.9735 31.6401 37.9349 31.4504 37.8957 31.2579L37.8936 31.2479C37.7137 30.3648 37.5221 29.424 37.3153 28.4867C37.0404 28.5616 36.7513 28.6018 36.4528 28.6018C35.7141 28.6018 35.0366 28.3573 34.4878 27.9492C34.2726 28.1829 34.058 28.3969 33.8419 28.5784C33.3606 28.9827 32.7748 29.3105 32.0407 29.3105H31.9174L31.3789 29.2997C31.2301 29.5412 31.0372 29.7613 30.8019 29.9476C30.0944 30.5076 29.1779 30.6235 28.3885 30.3345ZM28.3416 23.6143C27.9688 23.1733 27.7506 22.606 27.7505 22.0003L27.7503 20.0003C27.7501 18.6196 28.8693 17.5002 30.25 17.5C31.6307 17.4998 32.7501 18.619 32.7503 19.9997L32.7503 20.1981L33.014 20.286C33.0051 20.1918 33.0005 20.0965 33.0005 20C33.0005 18.3432 34.3437 17 36.0005 17C36.4891 17 36.9505 17.1168 37.3581 17.324L36.7325 16.2486C36.628 16.069 36.4232 15.9727 36.2181 16.0069L28.6205 17.2731C28.1471 17.352 27.7401 17.6527 27.5254 18.0819L25.0532 23.0264C24.9664 23.2 24.9879 23.4081 25.1084 23.5603L28.8582 28.2977C29.0296 28.5142 29.3441 28.5508 29.5606 28.3794C29.7771 28.208 29.8137 27.8936 29.6423 27.6771L27.356 24.7887L27.8066 24.1742C27.9581 23.9676 28.1373 23.7789 28.3416 23.6143ZM38.9972 20.1415C38.9405 21.3641 38.1519 22.3955 37.0596 22.8077C37.1512 23.0356 37.2131 23.27 37.2464 23.5061L37.3068 23.9343L35.9103 25.6744C35.7375 25.8898 35.772 26.2045 35.9874 26.3773C36.2027 26.5502 36.5174 26.5157 36.6903 26.3003L39.89 22.313C40.0194 22.1517 40.0362 21.9274 39.9322 21.7486L38.9972 20.1415ZM36.0005 19C35.4482 19 35.0005 19.4477 35.0005 20C35.0005 20.5523 35.4482 21 36.0005 21C36.5528 21 37.0005 20.5523 37.0005 20C37.0005 19.4477 36.5528 19 36.0005 19ZM23.9861 26.5735C23.9211 26.3051 23.6509 26.1402 23.3825 26.2051C20.4762 26.908 18.2332 27.2366 16.0018 27.2283C13.769 27.22 11.5242 26.8744 8.61227 26.2038C8.34317 26.1418 8.07478 26.3098 8.01282 26.5789C7.95085 26.848 8.11876 27.1163 8.38786 27.1783C10.0739 27.5666 11.5557 27.8513 12.9543 28.0257L13.8306 28.1349V33.4575L13.8085 33.5608C13.8055 33.5749 13.8031 33.5893 13.8012 33.6041L13.0679 39.4376C13.0342 39.7057 13.2195 39.952 13.4864 39.9939C13.7533 40.0358 14.0052 39.8581 14.0553 39.5926L15.1479 33.7982H17.1133L18.206 39.5926C18.256 39.8581 18.5079 40.0358 18.7748 39.9939C19.0417 39.952 19.2271 39.7057 19.1934 39.4376L18.4601 33.6041C18.4582 33.5893 18.4557 33.5749 18.4527 33.5608L18.4306 33.4575V28.1251L19.301 28.0113C20.6248 27.8382 22.0301 27.561 23.6176 27.177C23.886 27.1121 24.051 26.8419 23.9861 26.5735ZM14 22C14 20.8954 14.8955 20 16 20C17.1046 20 18 20.8954 18 22C18 23.1046 17.1046 24 16 24C14.8955 24 14 23.1046 14 22Z" fill="black"/>
<path d="M31.8436 39.4263C30.7614 39.3897 29.6625 39.2985 28.5 39.1515V40.4999C28.5 41.2521 29.0572 41.8879 29.8028 41.9868C30.5485 42.0857 31.2521 41.617 31.4482 40.8908L31.8436 39.4263Z" fill="black"/>
<path d="M35.1412 39.3695L35.5519 40.8908C35.7479 41.617 36.4515 42.0857 37.1972 41.9868C37.9429 41.8879 38.5 41.2521 38.5 40.4999V39C37.3214 39.1739 36.2165 39.2975 35.1412 39.3695Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);