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="M7.54777 3.75L5.94168 8.76905C4.32067 13.8347 3.78111 19.1842 4.35791 24.4715L6.50609 44.1632L8.4943 43.9463L6.34611 24.2546C5.79967 19.2456 6.31083 14.1776 7.84652 9.3786L9.45262 4.35955L7.54777 3.75Z" fill="black"/>
<path d="M40.4522 3.75L42.0583 8.76905C43.6793 13.8347 44.2189 19.1842 43.6421 24.4715L41.4939 44.1632L39.5057 43.9463L41.6539 24.2546C42.2003 19.2456 41.6892 14.1776 40.1535 9.3786L38.5474 4.35955L40.4522 3.75Z" fill="black"/>
<path d="M30.1508 20.913C30.6688 20.7215 30.9335 20.1463 30.742 19.6283C30.5504 19.1103 29.9752 18.8456 29.4572 19.0372L27.7785 19.6579C26.0096 20.3119 25.6125 22.6357 27.0637 23.8401C27.3729 24.0967 27.2158 24.599 26.8155 24.6337L25.3829 24.7578C23.2081 24.9463 22.3337 27.6602 23.9893 29.083C24.2604 29.3159 24.1781 29.7549 23.8411 29.8739L23.1671 30.1119C22.6463 30.2958 22.3732 30.8671 22.5571 31.3878C22.741 31.9086 23.3122 32.1817 23.833 31.9978L24.507 31.7598C26.294 31.1288 26.7301 28.8013 25.2928 27.5661C24.9805 27.2978 25.1455 26.7859 25.5557 26.7504L26.9883 26.6262C29.1696 26.4371 30.0259 23.6994 28.341 22.3011C28.0747 22.0801 28.1476 21.6538 28.4721 21.5338L30.1508 20.913Z" fill="black"/>
<path d="M17.6246 25.6362C17.0763 25.5694 16.5778 25.9597 16.511 26.5079C16.4442 27.0561 16.8345 27.5547 17.3827 27.6215L18.1771 27.7183C20.138 27.9571 21.6106 25.9665 20.8083 24.1613L20.7347 23.9956C20.6175 23.7319 20.7979 23.4319 21.0858 23.4118C21.9145 23.354 22.5541 22.892 22.9616 22.334C23.3636 21.7834 23.5808 21.093 23.5849 20.417C23.5873 20.0188 23.6656 19.7118 23.8041 19.5039C23.9193 19.3308 24.1386 19.1288 24.6644 19.0412C25.2091 18.9504 25.5772 18.4351 25.4864 17.8904C25.3956 17.3456 24.8803 16.9776 24.3356 17.0684C23.3335 17.2354 22.5982 17.7065 22.1394 18.3953C21.7038 19.0494 21.5886 19.7932 21.5849 20.405C21.5832 20.6794 21.4902 20.9575 21.3464 21.1545C21.208 21.344 21.0661 21.4083 20.9467 21.4166C19.2744 21.5332 18.2262 23.276 18.907 24.8079L18.9807 24.9735C19.152 25.3589 18.8376 25.7839 18.4189 25.7329L17.6246 25.6362Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 24.0548C12 29.6463 15.8243 34.3446 21 35.6768V44.0548H23V36.0137C23.3297 36.0409 23.6632 36.0548 24 36.0548C24.3368 36.0548 24.6703 36.0409 25 36.0137V44.0548H27V35.6768C32.1757 34.3446 36 29.6463 36 24.0548C36 17.4274 30.6274 12.0548 24 12.0548C17.3726 12.0548 12 17.4274 12 24.0548ZM24 14.0548C18.4772 14.0548 14 18.532 14 24.0548C14 29.5777 18.4772 34.0548 24 34.0548C29.5228 34.0548 34 29.5777 34 24.0548C34 18.532 29.5228 14.0548 24 14.0548Z" fill="black"/>
<path d="M24.1499 5.05481C24.7022 5.05481 25.1499 5.50252 25.1499 6.05481V7.05481C25.1499 7.60709 24.7022 8.05481 24.1499 8.05481C23.5976 8.05481 23.1499 7.60709 23.1499 7.05481V6.05481C23.1499 5.50252 23.5976 5.05481 24.1499 5.05481Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);