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="M23.9999 7C17.4575 7 12.1538 11.9249 12.1538 18H10C10 10.8203 16.268 5 23.9999 5C31.7318 5 37.9998 10.8203 37.9998 18C37.9998 22.5012 35.5353 26.4674 31.796 28.7993C29.244 30.3908 27.2306 32.5075 27.2306 34.9113V35C27.2306 39.4183 23.3734 43 18.6153 43C13.8572 43 10 39.4183 10 35V33H12.1538V35C12.1538 38.3137 15.0467 41 18.6153 41C22.1839 41 25.0768 38.3137 25.0768 35V34.9113C25.0768 31.4539 27.9071 28.8153 30.5952 27.139C33.7642 25.1627 35.8459 21.8069 35.8459 18C35.8459 11.9249 30.5423 7 23.9999 7ZM19.0888 17.0195C19.472 15.3146 21.0523 14 23 14C25.2438 14 27 15.7447 27 17.8209H29C29 14.572 26.279 12 23 12C19.721 12 17 14.572 17 17.8209C17 19.4602 17.6387 20.7713 19.0188 21.5288C19.768 21.94 20.2693 22.2895 20.5748 22.57C20.6497 22.6387 20.7061 22.6971 20.7484 22.7451C20.5637 22.8323 20.2632 22.9315 19.8121 23.0178L20.1879 24.9822C20.8602 24.8536 21.4835 24.6622 21.9568 24.3587C22.4506 24.0421 22.9228 23.4937 22.8587 22.7099C22.8042 22.0432 22.3697 21.5027 21.9273 21.0966C21.4548 20.6628 20.7981 20.2239 19.9812 19.7755C19.6596 19.599 19.4076 19.3642 19.2395 19.0314C19.9322 19.0772 20.7861 19.1834 21.6271 19.4135C22.5702 19.6715 23.4243 20.0656 24.0302 20.6365C24.5985 21.172 24.9893 21.8978 24.9998 22.9636C24.8705 24.3254 24.5479 25.2047 24.1796 25.7744C23.8162 26.3364 23.3787 26.6444 22.9248 26.823C22.453 27.0087 21.9322 27.0658 21.4081 27.0658C21.1478 27.0658 20.8987 27.052 20.6577 27.0366L20.566 27.0307C20.3659 27.0176 20.1475 27.0034 19.9638 27.0034C19.0142 27.0034 18.5332 27.7387 18.3111 28.1707C18.1573 28.4698 18.0055 28.8782 17.8752 29.2289C17.82 29.3773 17.7686 29.5154 17.7226 29.6304C17.533 30.1046 17.349 30.4509 17.1276 30.6789C16.9434 30.8687 16.7135 31 16.3113 31C15.7796 31 15.5037 30.8802 15.3635 30.7843C15.2256 30.69 15.1392 30.5646 15.0819 30.4077C15.0207 30.2404 15 30.0536 15 29.8924C15 29.8153 15.0047 29.7528 15.0089 29.7133C15.0109 29.6938 15.0127 29.6806 15.0136 29.6748C15.0139 29.6728 15.014 29.6717 15.014 29.6717L15.0136 29.6748L15.0129 29.6782L15.0126 29.68C15.0125 29.6805 15.0122 29.6819 14.0285 29.5021C13.0448 29.3223 13.0447 29.3228 13.0446 29.3234L13.0444 29.3245L13.044 29.3269L13.043 29.3324L13.0407 29.3464C13.0389 29.357 13.0369 29.37 13.0346 29.3855C13.0301 29.4163 13.0248 29.4568 13.0197 29.5056C13.0095 29.6026 13 29.7353 13 29.8924C13 30.1996 13.0363 30.6372 13.2035 31.0944C13.3744 31.562 13.6875 32.0611 14.2345 32.4351C14.779 32.8076 15.4734 33 16.3113 33C17.2788 33 18.0191 32.6317 18.5625 32.0722C19.0688 31.5508 19.3698 30.8979 19.5797 30.3729C19.6756 30.133 19.7492 29.9331 19.8131 29.7592C19.9124 29.4892 19.9887 29.2819 20.0898 29.085C20.1055 29.0546 20.1194 29.0292 20.1316 29.0082C20.2145 29.0122 20.3121 29.0185 20.4315 29.0262L20.5304 29.0326C20.779 29.0484 21.0809 29.0658 21.4081 29.0658C22.0589 29.0658 22.8593 28.9981 23.6571 28.6841C24.4729 28.3632 25.2535 27.797 25.8591 26.8602C26.4555 25.9377 26.8495 24.7072 26.9959 23.0982C26.9986 23.0681 27 23.0379 27 23.0076C27 21.3498 26.3665 20.0899 25.4017 19.1809C24.4667 18.2999 23.2662 17.7884 22.1548 17.4844C21.0346 17.1779 19.9301 17.0621 19.1166 17.0209C19.1073 17.0204 19.0981 17.02 19.0888 17.0195ZM20.1923 28.9192C20.1923 28.9197 20.1893 28.9235 20.1832 28.9292C20.1892 28.9216 20.1923 28.9188 20.1923 28.9192Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);