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="M29.9591 19.5138V17.3761L29.9154 16.3804L29.9591 16.3786V8.8473C29.9591 7.86078 30.7292 7.06105 31.6792 7.06105H34.2594L34.7462 6.54109C35.4216 5.81964 36.5373 5.81964 37.2128 6.54109L37.6996 7.06105H40.2797C41.2297 7.06105 41.9999 7.86078 41.9999 8.8473V19.5138C41.9999 20.5003 41.2297 21.3 40.2797 21.3H38.5596V22.75H36.9832L36.9826 34C36.9826 36.2091 35.1857 38 32.9691 38C30.7524 38 28.9555 36.2091 28.9555 34V28.9501C28.9555 27.3408 27.6626 26.0325 26.0556 26.0006C25.9556 26.9004 25.1901 27.6002 24.2605 27.6002C23.2631 27.6002 22.4544 26.7943 22.4544 25.8002C22.4544 25.1461 22.4274 23.0403 22.056 21.1377C21.9092 20.3857 21.7253 19.7579 21.5181 19.2921V28.5H21.4959L21.4959 40.2C21.4959 41.1669 20.7294 41.961 19.7599 41.9986C18.7904 42.0361 17.9644 41.3036 17.8891 40.3396L16.9753 28.6397C16.9716 28.593 16.9698 28.5464 16.9698 28.5H15.0967C15.0967 28.5464 15.0949 28.593 15.0912 28.6397L14.1774 40.3396C14.1021 41.3036 13.2761 42.0361 12.3066 41.9986C11.3371 41.961 10.5706 41.1669 10.5706 40.2V28.5H10.5484V19.2926C10.3412 19.7583 10.1574 20.386 10.0107 21.1377C9.63923 23.0403 9.61222 25.1461 9.61222 25.8002C9.61222 26.7943 8.8036 27.6002 7.80611 27.6002C6.80862 27.6002 6 26.7943 6 25.8002C6 25.1042 6.02378 22.71 6.46492 20.4502C6.68239 19.3361 7.02891 18.1012 7.62267 17.1004C8.22104 16.0919 9.28644 15.0002 10.9548 15.0002H21.1118C22.7802 15.0002 23.8456 16.0919 24.444 17.1004C25.0377 18.1012 25.3843 19.3361 25.6017 20.4502C25.8447 21.6947 25.9611 22.9801 26.0166 24C28.75 24.0114 30.9623 26.2232 30.9623 28.9501V34C30.9623 35.1046 31.8607 36 32.9691 36C34.0774 36 34.9758 35.1046 34.9758 34L34.9764 22.75H33.3993V21.3H31.6792C30.7292 21.3 29.9591 20.5003 29.9591 19.5138ZM37.6996 9.06105C37.1432 9.06105 36.6119 8.83087 36.2323 8.42547L35.9795 8.15542L35.7266 8.42547C35.3471 8.83087 34.8157 9.06105 34.2594 9.06105H31.9659V16.3923L32.2325 16.4027C32.7867 16.4246 33.2817 16.4442 33.7654 16.4334C34.8268 16.4098 35.7524 16.2399 36.7413 15.6294C37.4801 15.1733 38.2033 14.9786 38.8885 15.0018C39.2997 15.0158 39.669 15.1072 39.9931 15.2392V9.06105H37.6996Z" fill="black"/>
<path d="M19.6898 9.6C19.6898 11.5882 18.0527 13.2 16.0333 13.2C14.0138 13.2 12.3767 11.5882 12.3767 9.6C12.3767 7.61177 14.0138 6 16.0333 6C18.0527 6 19.6898 7.61177 19.6898 9.6Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);