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
contextusing 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="M24.4999 29.2531C24.4999 28.3172 25.149 27.5064 26.0623 27.3016C27.7565 26.9217 29.6112 26.2548 31.2545 25.2061C33.8565 23.5457 35.9999 20.8694 35.9999 16.8448C35.9999 13.2877 34.6443 10.5976 32.5209 8.78559C30.4231 6.99545 27.6479 6.12096 24.8641 6.01183C22.2297 5.90856 19.2782 6.53165 16.8548 7.91828C14.4598 9.28857 12.6542 11.3514 12.024 14.1679C11.9035 14.7069 12.2426 15.2415 12.7816 15.3621C13.3205 15.4827 13.8552 15.1435 13.9758 14.6046C14.9187 10.3901 19.7612 7.81333 24.7857 8.0103C27.2293 8.10609 29.5407 8.87165 31.2227 10.307C32.8794 11.7207 33.9999 13.8444 33.9999 16.8448C33.9999 20.0202 32.3607 22.1277 30.1786 23.5202C27.9689 24.9303 25.2673 25.552 23.4302 25.6803C22.9063 25.7169 22.4999 26.1526 22.4999 26.6778V31.9998C22.4999 32.5521 22.9476 32.9998 23.4999 32.9998C24.0522 32.9998 24.4999 32.5521 24.4999 31.9998V29.2531ZM25.54 34.1994C26.1304 33.6515 26.4999 32.8688 26.4999 31.9998V29.2531C28.3628 28.8355 30.4468 28.0941 32.3304 26.8921C35.3525 24.9636 37.9999 21.7184 37.9999 16.8448C37.9999 12.731 36.4092 9.47442 33.8192 7.26422C31.3054 5.11913 28.0663 4.13583 24.9424 4.01337C19.0007 3.78045 11.625 6.79094 10.0723 13.7312C9.71055 15.3481 10.728 16.9521 12.3449 17.3139C13.9618 17.6756 15.5658 16.6581 15.9275 15.0412C16.5748 12.1482 20.1991 9.83203 24.7074 10.0088C26.8086 10.0911 28.6569 10.7467 29.9244 11.8283C31.1156 12.8448 31.9999 14.4026 31.9999 16.8448C31.9999 19.1826 30.8529 20.7174 29.1028 21.8342C27.2451 23.0197 24.8898 23.5734 23.2909 23.6851C21.719 23.7949 20.4999 25.1021 20.4999 26.6778V31.9998C20.4999 33.0033 20.9926 33.8917 21.7492 34.4363C22.2419 34.7909 22.8465 34.9998 23.4999 34.9998C23.6703 34.9998 23.8373 34.9856 23.9999 34.9583C24.5893 34.8595 25.1205 34.5887 25.54 34.1994ZM25.8133 36.4336C25.269 36.1563 24.6527 35.9999 23.9999 35.9999C23.8306 35.9999 23.6637 36.0104 23.4999 36.0308C22.8595 36.1107 22.2662 36.3419 21.7567 36.6876C20.6965 37.407 19.9999 38.6221 19.9999 39.9999C19.9999 42.209 21.7908 43.9999 23.9999 43.9999C26.209 43.9999 27.9999 42.209 27.9999 39.9999C27.9999 38.4435 27.1111 37.0948 25.8133 36.4336ZM23.9999 37.9999C22.8953 37.9999 21.9999 38.8953 21.9999 39.9999C21.9999 41.1044 22.8953 41.9999 23.9999 41.9999C25.1045 41.9999 25.9999 41.1044 25.9999 39.9999C25.9999 38.8953 25.1045 37.9999 23.9999 37.9999Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);