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="M18 30.707C17.0781 31.0885 16.0352 31.3613 14.6885 31.3613C12.8526 31.3613 12.2458 32.8297 11.6009 34.3903C10.8697 36.1599 10.0895 38.0479 7.41312 38.0479C2.37634 38.0479 3.61914 22.5479 6.61916 16.5479C9.61919 10.5479 13.7245 10.0479 22.1192 10.0479C27.2615 10.0479 28.5655 10.8319 29.5758 11.4395C30.2149 11.8238 30.7364 12.1374 32.0374 12.1374C33.3805 12.1374 35.2609 11.7362 37.1413 11.335C39.9619 10.7332 42.7825 10.1315 43.7898 10.8837C45.4687 12.1374 40.432 21.3314 35.3952 21.3314C32.8027 21.3314 31.2481 23.1899 29.7392 24.9937C28.3166 26.6944 26.9347 28.3464 24.762 28.3464C22.6699 28.3464 21.311 29.0047 20 29.7061V39.5479H18V30.707ZM8.69292 35.6058C8.47288 35.8312 8.15654 36.0479 7.41312 36.0479H7.41083C7.35819 36.0479 7.31753 36.0479 7.21331 35.9452C7.06443 35.7986 6.8432 35.4767 6.62867 34.8677C6.19706 33.6425 5.97531 31.7877 6.00219 29.5721C6.05609 25.1293 7.08823 20.0818 8.40801 17.4423C9.7236 14.8111 11.1431 13.6011 13.0187 12.9314C15.091 12.1915 17.867 12.0479 22.1192 12.0479C22.4358 12.0479 22.7355 12.051 23.0192 12.0568C22.1361 13.1859 21.6549 14.4264 21.3967 15.502C21.1898 16.3644 21.1212 17.1377 21.104 17.6968C21.0953 17.9773 21.0996 18.2065 21.1063 18.3695C21.1097 18.451 21.1137 18.5161 21.1171 18.563L21.12 18.602L21.1215 18.6195L21.1231 18.6371L21.1237 18.6431L21.124 18.6465C21.124 18.6469 21.1241 18.6474 22.1191 18.5479C23.1142 18.4484 23.1142 18.4487 23.1142 18.4491L23.1119 18.4191C23.1099 18.3916 23.1071 18.3469 23.1046 18.2868C23.0996 18.1665 23.096 17.9856 23.103 17.7583C23.1171 17.3017 23.1735 16.6688 23.3415 15.9687C23.6443 14.7069 24.2935 13.2816 25.6646 12.2314C27.0451 12.408 27.6744 12.6758 28.0486 12.8693C28.2163 12.956 28.3581 13.0412 28.5502 13.1565L28.6079 13.1912C28.8138 13.3147 29.0948 13.4822 29.4246 13.632C30.1563 13.9642 30.9609 14.1374 32.0374 14.1374C33.0791 14.1374 34.2867 13.948 35.4295 13.7297C36.117 13.5983 36.872 13.4374 37.6006 13.2821C38.0667 13.1828 38.5224 13.0857 38.9423 13.0002C40.0902 12.7664 41.0754 12.5959 41.8452 12.5466C41.8838 12.5441 41.9212 12.542 41.9573 12.5402C41.7061 13.3297 41.1912 14.3795 40.46 15.4488C39.709 16.547 38.7994 17.5638 37.8539 18.2858C36.8904 19.0217 36.0515 19.3314 35.3952 19.3314C31.8714 19.3314 29.7796 21.8299 28.3949 23.4838L28.2639 23.6402C27.5199 24.5286 26.9555 25.2025 26.3463 25.6952C25.7756 26.1567 25.2963 26.3464 24.762 26.3464C22.723 26.3464 21.2212 26.8734 20 27.4589V23.0479C20 22.6526 20.195 22.2841 20.5335 21.9879C20.8909 21.6752 21.2902 21.5479 21.5 21.5479V19.5479C20.7098 19.5479 19.8591 19.9205 19.2165 20.4828C18.5727 21.0461 18.0298 21.8962 18.0012 22.9597H12.9072C10.5179 22.9597 7.65081 24.0112 10.5179 26.1135C12.5977 27.6385 16.186 26.4249 18 25.6433V28.5027C16.9811 29.0186 16.0552 29.3613 14.6885 29.3613C12.9882 29.3613 11.8003 30.1533 11.0098 31.2027C10.4285 31.9744 10.028 32.9519 9.74132 33.6517C9.73622 33.6642 9.73111 33.6767 9.72608 33.689C9.69086 33.7749 9.65739 33.8564 9.62554 33.9325C9.27146 34.7786 9.0088 35.2823 8.69292 35.6058Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);