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="M32 30.8333C32 29.1764 33.3431 27.8333 35 27.8333C36.6568 27.8333 38 29.1764 38 30.8333V42.9999C38 43.5522 37.5523 43.9999 37 43.9999C36.4477 43.9999 36 43.5522 36 42.9999V30.8333C36 30.281 35.5523 29.8333 35 29.8333C34.4477 29.8333 34 30.281 34 30.8333V31.0555C34 31.6078 33.5523 32.0555 33 32.0555C32.4477 32.0555 32 31.6078 32 31.0555V30.8333Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4734 14C26.4635 14 24.3049 15.7816 22.9359 18.2165C21.5911 20.6081 21 23.6281 21 26.2819C21 27.0434 21.2522 27.8323 21.5372 28.5049C21.8328 29.2026 22.2174 29.8972 22.587 30.5011C22.6723 30.6404 22.7576 30.7762 22.8417 30.9074C22.9451 31.0685 23 31.2559 23 31.4473V41.1333C23 41.5481 23.3816 42 24 42C24.6184 42 25 41.5481 25 41.1333V31.9418C25 28.9717 25.9737 25.9949 26.7914 23.4951L26.8139 23.4264C26.9585 22.984 27.0982 22.5569 27.2294 22.1415C27.4382 21.48 27.6569 20.8532 27.8796 20.2665C28.0357 19.8551 28.4424 19.5942 28.8814 19.6236C29.3205 19.6531 29.6887 19.966 29.7884 20.3946L30.5052 23.4726C30.5802 23.7948 30.7721 24.0321 30.9942 24.1547L35.6191 25.1878C35.681 25.2016 35.7415 25.2213 35.7996 25.2466C36.1886 25.4156 36.714 25.2463 36.9256 24.6717C37.1344 24.1046 36.886 23.531 36.4952 23.3024L32.7966 22.6584C32.4012 22.5896 32.0853 22.291 31.9942 21.9001L30.3363 14.7802C30.2168 14.2671 29.8242 14 29.4734 14ZM21.1926 17.2363C22.7941 14.3879 25.5227 12 29.4734 12C30.8575 12 31.9782 13.0127 32.2842 14.3266L33.792 20.8017L36.98 21.3567C37.0581 21.3703 37.1343 21.3932 37.207 21.4247C38.7116 22.0785 39.356 23.8593 38.8024 25.3628C38.2485 26.8669 36.6262 27.7203 35.0998 27.1211L30.4464 26.0816C30.3845 26.0677 30.3241 26.0481 30.2659 26.0228C29.4935 25.6872 28.9215 25.0301 28.6499 24.2466C27.8285 26.7609 27 29.3861 27 31.9418V41.1333C27 42.7804 25.5907 44 24 44C22.4092 44 21 42.7804 21 41.1333V31.7373C20.9605 31.6741 20.9209 31.6101 20.8812 31.5452C20.4824 30.8937 20.0438 30.1067 19.6957 29.2853C19.3732 28.5243 19 27.4422 19 26.2819C19 23.3784 19.6389 19.9994 21.1926 17.2363Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.117 10.0753C10.3762 9.58763 10.9817 9.40245 11.4694 9.66168L17.047 12.6266C17.3882 12.808 17.5944 13.1697 17.5766 13.5556C17.5588 13.9416 17.3202 14.2828 16.9638 14.432L15.2539 15.1479L18.38 16.8733C18.8635 17.1401 19.0391 17.7485 18.7723 18.232C18.5054 18.7155 17.8971 18.8911 17.4136 18.6243L12.4769 15.8996C12.1411 15.7143 11.9409 15.3532 11.9616 14.9702C11.9823 14.5872 12.2202 14.2498 12.574 14.1017L14.2449 13.4021L10.5306 11.4277C10.0429 11.1684 9.85776 10.563 10.117 10.0753Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.83169 19.9784C9.94247 19.4179 10.4551 19.0511 10.9766 19.1591L14.6432 19.9182C14.9946 19.991 15.2755 20.2674 15.3723 20.6357C15.4691 21.0041 15.3657 21.4034 15.1041 21.6721L14.3066 22.4914L16.2447 22.9956C16.7604 23.1297 17.069 23.6882 16.9338 24.243C16.7987 24.7978 16.271 25.1387 15.7553 25.0046L12.1302 24.0615C11.7905 23.9731 11.526 23.6934 11.4394 23.331C11.3527 22.9685 11.4577 22.5806 11.7134 22.3179L12.4374 21.5742L10.5754 21.1887C10.0539 21.0807 9.72091 20.5388 9.83169 19.9784Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M33 10C34.1046 10 35 9.10457 35 8C35 6.89543 34.1046 6 33 6C31.8954 6 31 6.89543 31 8C31 9.10457 31.8954 10 33 10ZM33 12C35.2091 12 37 10.2091 37 8C37 5.79086 35.2091 4 33 4C30.7908 4 29 5.79086 29 8C29 10.2091 30.7908 12 33 12Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);