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="M26.3929 18.4663C25.6784 18.166 24.8935 18 24.0698 18C20.7561 18 18.0698 20.6863 18.0698 24C18.0698 27.3137 20.7561 30 24.0698 30C27.3835 30 30.0698 27.3137 30.0698 24C30.0698 23.7352 30.0527 23.4743 30.0194 23.2186C30.6219 22.6699 31 21.8791 31 21C31 19.3431 29.6569 18 28 18C27.4088 18 26.8575 18.171 26.3929 18.4663ZM24.0698 28C21.8607 28 20.0698 26.2091 20.0698 24C20.0698 21.7909 21.8607 20 24.0698 20C24.435 20 24.7888 20.0489 25.1249 20.1406C25.0436 20.4129 25 20.7013 25 21C25 22.6569 26.3431 24 28 24C28.707 24 29.3569 23.7554 29.8697 23.3463C29.3739 23.742 28.7498 23.9845 28.0698 24C28.0698 26.2091 26.279 28 24.0698 28ZM29 21C29 21.5523 28.5523 22 28 22C27.4477 22 27 21.5523 27 21C27 20.4477 27.4477 20 28 20C28.5523 20 29 20.4477 29 21Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.19605 20.8642C8.60396 17.0063 15.0813 12.0927 23.8218 12.0013C23.8811 12.0004 23.9405 12 24 12L24.0291 12L24.0697 12C32.9356 12 39.5032 16.97 42.9433 20.8642C44.538 22.6695 44.538 25.3305 42.9433 27.1358C39.5032 31.03 32.9356 36 24.0697 36L24.0291 36L24 36C23.9405 36 23.8811 35.9996 23.8218 35.9987C15.0813 35.9073 8.60396 30.9937 5.19606 27.1358C3.60132 25.3305 3.60131 22.6695 5.19605 20.8642ZM6.69497 22.1883C5.76834 23.2372 5.76834 24.7628 6.69497 25.8117C8.57391 27.9387 11.4255 30.3754 15.086 32.0339C13.1678 29.9068 12 27.0898 12 24C12 20.9102 13.1678 18.0932 15.086 15.9661C11.4255 17.6246 8.57391 20.0613 6.69497 22.1883ZM24.0284 14C23.9677 14.0002 23.9071 14.0005 23.8466 14.0012C18.3945 14.0831 14 18.5284 14 24C14 29.4716 18.3945 33.9169 23.8466 33.9988C23.9071 33.9995 23.9677 33.9998 24.0284 34C29.5382 33.9847 34 29.5134 34 24C34 18.4866 29.5382 14.0153 24.0284 14ZM36 24C36 27.1409 34.7933 29.9999 32.8182 32.1388C36.5918 30.4794 39.5254 27.984 41.4443 25.8117C42.371 24.7628 42.371 23.2372 41.4443 22.1883C39.5254 20.016 36.5918 17.5206 32.8182 15.8612C34.7933 18.0001 36 20.8591 36 24Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);