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="M20 25C21.1046 25 22 25.8954 22 27C22 28.1046 21.1046 29 20 29C18.8954 29 18 28.1046 18 27C18 25.8954 18.8954 25 20 25Z" fill="black"/>
<path d="M25 19C25 17.8954 24.1046 17 23 17C21.8954 17 21 17.8954 21 19C21 20.1046 21.8954 21 23 21C24.1046 21 25 20.1046 25 19Z" fill="black"/>
<path d="M29 24C30.1046 24 31 24.8954 31 26C31 27.1046 30.1046 28 29 28C27.8954 28 27 27.1046 27 26C27 24.8954 27.8954 24 29 24Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M21 5C21 4.44772 21.4477 4 22 4H26C26.5523 4 27 4.44772 27 5C27 5.55228 26.5523 6 26 6H25V9.0328C28.3897 9.25592 31.4719 10.605 33.8759 12.7097L36.0208 10.5649L35.3137 9.85775C34.9231 9.46722 34.9231 8.83406 35.3137 8.44353C35.7042 8.05301 36.3373 8.05301 36.7279 8.44353L39.5563 11.272C39.9468 11.6625 39.9468 12.2956 39.5563 12.6862C39.1658 13.0767 38.5326 13.0767 38.1421 12.6862L37.435 11.9791L35.2902 14.1239C37.3949 16.528 38.7441 19.6103 38.9672 23.0002H42V22.0002C42 21.448 42.4477 21.0002 43 21.0002C43.5523 21.0002 44 21.448 44 22.0002V26.0002C44 26.5525 43.5523 27.0002 43 27.0002C42.4477 27.0002 42 26.5525 42 26.0002V25.0002H38.9672C38.744 28.3899 37.3949 31.472 35.2902 33.8761L37.435 36.0209L38.1421 35.3138C38.5327 34.9232 39.1658 34.9232 39.5563 35.3138C39.9469 35.7043 39.9469 36.3375 39.5563 36.728L36.7279 39.5564C36.3374 39.9469 35.7042 39.9469 35.3137 39.5564C34.9232 39.1659 34.9232 38.5327 35.3137 38.1422L36.0208 37.4351L33.876 35.2903C31.4719 37.3949 28.3897 38.7441 25 38.9672V42H26C26.5523 42 27 42.4477 27 43C27 43.5523 26.5523 44 26 44H22C21.4477 44 21 43.5523 21 43C21 42.4477 21.4477 42 22 42H23V38.9672C19.6102 38.7441 16.528 37.3949 14.1239 35.2902L11.9791 37.4349L12.6862 38.142C13.0768 38.5325 13.0768 39.1657 12.6862 39.5562C12.2957 39.9468 11.6625 39.9468 11.272 39.5562L8.44359 36.7278C8.05307 36.3373 8.05307 35.7041 8.44359 35.3136C8.83412 34.9231 9.46728 34.9231 9.85781 35.3136L10.5649 36.0207L12.7097 33.8759C10.6051 31.4719 9.25598 28.3899 9.03282 25.0002H6V26.0002C6 26.5525 5.55228 27.0002 5 27.0002C4.44772 27.0002 4 26.5525 4 26.0002V22.0002C4 21.448 4.44772 21.0002 5 21.0002C5.55228 21.0002 6 21.448 6 22.0002V23.0002H9.03279C9.25585 19.6104 10.605 16.5281 12.7097 14.124L10.565 11.9792L9.85786 12.6864C9.46734 13.0769 8.83417 13.0769 8.44365 12.6864C8.05313 12.2958 8.05313 11.6627 8.44365 11.2721L11.2721 8.44371C11.6626 8.05319 12.2958 8.05319 12.6863 8.44371C13.0768 8.83424 13.0768 9.4674 12.6863 9.85793L11.9792 10.565L14.1239 12.7098C16.528 10.6051 19.6102 9.25592 23 9.0328V6H22C21.4477 6 21 5.55228 21 5ZM33.8723 15.5417C35.619 17.5785 36.7463 20.162 36.9621 23.0002H36C35.4477 23.0002 35 23.448 35 24.0002C35 24.5525 35.4477 25.0002 36 25.0002H36.9621C36.7461 27.8383 35.6189 30.4216 33.8724 32.4582L33.1924 31.7782C32.8019 31.3877 32.1687 31.3877 31.7782 31.7782C31.3876 32.1688 31.3876 32.8019 31.7782 33.1925L32.4582 33.8725C30.4215 35.619 27.8381 36.7462 25 36.9621V36C25 35.4477 24.5523 35 24 35C23.4477 35 23 35.4477 23 36V36.9621C20.1618 36.7462 17.5784 35.619 15.5417 33.8723L16.2218 33.1923C16.6123 32.8017 16.6123 32.1686 16.2218 31.7781C15.8312 31.3875 15.1981 31.3875 14.8076 31.7781L14.1275 32.4581C12.381 30.4215 11.2539 27.8382 11.0379 25.0002H12C12.5523 25.0002 13 24.5525 13 24.0002C13 23.448 12.5523 23.0002 12 23.0002H11.0379C11.2537 20.162 12.3809 17.5786 14.1275 15.5418L14.8076 16.2219C15.1981 16.6124 15.8313 16.6124 16.2218 16.2219C16.6123 15.8314 16.6123 15.1982 16.2218 14.8077L15.5418 14.1276C17.5785 12.381 20.1619 11.2538 23 11.0379V12C23 12.5523 23.4477 13 24 13C24.5523 13 25 12.5523 25 12V11.0379C27.8381 11.2538 30.4214 12.381 32.4581 14.1275L31.7781 14.8075C31.3876 15.198 31.3876 15.8312 31.7781 16.2217C32.1686 16.6122 32.8018 16.6122 33.1923 16.2217L33.8723 15.5417Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);