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="M33.219 13.2094L33.1289 13.1396C32.9561 11.8258 32.3265 10.4574 31.3446 9.30289C29.7495 7.42761 27.1506 6 23.6697 6C20.2409 6 17.8226 7.56423 16.3967 9.50251C15.6911 10.4616 15.2279 11.5122 15.0005 12.5097C14.9537 12.7148 14.9163 12.9208 14.8889 13.1258L14.781 13.2094C13.6569 14.0801 12.8323 15.1359 13.0277 16.3468C13.2165 17.5167 14.2736 18.2289 15.2576 18.6644C15.5084 18.7754 15.7784 18.8791 16.0651 18.9756C16.0221 19.3113 16 19.6533 16 20C16 24.4183 19.5817 28 24 28C28.4183 28 32 24.4183 32 20C32 19.6533 31.9779 19.3113 31.9349 18.9756C32.2216 18.8791 32.4916 18.7754 32.7424 18.6644C33.7264 18.2289 34.7835 17.5167 34.9723 16.3468C35.1677 15.1359 34.3431 14.0801 33.219 13.2094ZM16.9447 14.6719C16.8148 14.298 16.781 13.6975 16.9504 12.9542C17.1158 12.229 17.4606 11.4345 18 10.6982L18 13.5C18 14.0523 18.4477 14.5 19 14.5C19.5523 14.5 20 14.0523 20 13.5V8.91075C20.8229 8.44152 21.818 8.11503 23 8.02506V11.5C23 12.0523 23.4477 12.5 24 12.5C24.5523 12.5 25 12.0523 25 11.5V8.08698C26.1683 8.24422 27.1674 8.60479 28 9.0873V13.5C28 14.0523 28.4477 14.5 29 14.5C29.5523 14.5 30 14.0523 30 13.5V10.8182C31.1046 12.2344 31.3637 13.7622 31.0529 14.679C30.8756 15.202 31.1559 15.7698 31.679 15.9471C32.1055 16.0917 32.5619 15.9319 32.8118 15.5843C33.009 15.8594 33.0015 16.0054 32.9978 16.0282C32.9849 16.1083 32.8316 16.4378 31.9329 16.8356C31.5427 17.0083 31.0792 17.1634 30.5577 17.2999L30.5341 17.3057C29.9689 17.4525 29.34 17.5767 28.6667 17.6777C27.51 17.8512 26.2222 17.9561 24.9003 17.9889C24.6016 17.9963 24.3011 18 24 18C23.4283 18 22.8588 17.9866 22.2992 17.96C21.2566 17.9105 20.2484 17.8153 19.3242 17.6763C18.6543 17.5756 18.0286 17.4518 17.4659 17.3057L17.4424 17.2999C16.9208 17.1634 16.4573 17.0083 16.0671 16.8356C15.1684 16.4378 15.0151 16.1083 15.0022 16.0282C14.9985 16.0054 14.991 15.8594 15.1882 15.5843C15.4398 15.9342 15.9001 16.0933 16.3281 15.9447C16.8498 15.7635 17.1258 15.1936 16.9447 14.6719ZM18.0221 19.4809C18.3543 19.546 18.6978 19.6049 19.0503 19.6576C20.1182 19.8172 21.2685 19.92 22.4383 19.9681C22.9569 19.9894 23.4793 20 24 20C24.5228 20 25.0473 19.9893 25.568 19.9679C26.7323 19.9198 27.8773 19.8175 28.9408 19.6589C29.2964 19.6059 29.6429 19.5466 29.9779 19.4809C29.9925 19.6519 30 19.825 30 20C30 23.3137 27.3137 26 24 26C20.6863 26 18 23.3137 18 20C18 19.825 18.0075 19.6518 18.0221 19.4809Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29 28.4896C29.6578 28.6045 30.3281 28.7389 31 28.8923C36.4433 30.1349 42 32.6202 42 36.0001V42.0001H6V36.0001C6 32.6202 11.5567 30.1349 17 28.8923C17.672 28.7389 18.3422 28.6045 19 28.4896V33H29V28.4896ZM15 31.4912C15.654 31.2915 16.3247 31.1096 17 30.9466V35H31V30.9466C32.0247 31.1938 33.0386 31.4849 34 31.8152V40H36V32.5967C36.2893 32.7257 36.5693 32.8587 36.8384 32.9956C37.9747 33.5735 38.8176 34.1704 39.3521 34.7401C39.8768 35.2993 40 35.7126 40 36.0001V40.0001H8V36.0001C8 35.7126 8.1232 35.2993 8.64787 34.7401C9.18243 34.1704 10.0253 33.5735 11.1616 32.9956C11.7306 32.7062 12.3483 32.434 13 32.1806V40H15V31.4912Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);