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="M12.1538 18C12.1538 11.9249 17.4575 7 23.9999 7C30.5423 7 35.8459 11.9249 35.8459 18C35.8459 21.8069 33.7642 25.1627 30.5952 27.139C27.9071 28.8153 25.0768 31.4539 25.0768 34.9113V35C25.0768 38.3137 22.1839 41 18.6153 41C15.0467 41 12.1538 38.3137 12.1538 35V33H10V35C10 39.4183 13.8572 43 18.6153 43C23.3734 43 27.2306 39.4183 27.2306 35V34.9113C27.2306 32.5075 29.244 30.3908 31.796 28.7993C35.5353 26.4674 37.9998 22.5012 37.9998 18C37.9998 10.8203 31.7318 5 23.9999 5C16.268 5 10 10.8203 10 18H12.1538ZM23 14C21.0523 14 19.472 15.3146 19.0888 17.0195L19.1166 17.0209C19.9301 17.0621 21.0346 17.1779 22.1548 17.4844C23.2662 17.7884 24.4667 18.2999 25.4017 19.1809C26.3665 20.0899 27 21.3498 27 23.0076C27 23.0379 26.9986 23.0681 26.9959 23.0982C26.8495 24.7072 26.4555 25.9377 25.8591 26.8602C25.2535 27.797 24.4729 28.3632 23.6571 28.6841C22.8593 28.9981 22.0589 29.0658 21.4081 29.0658C21.0809 29.0658 20.779 29.0484 20.5304 29.0326L20.4315 29.0262C20.3121 29.0185 20.2145 29.0122 20.1316 29.0082C20.1194 29.0292 20.1055 29.0546 20.0898 29.085C19.9887 29.2818 19.9124 29.4891 19.8131 29.7591C19.7492 29.933 19.6756 30.133 19.5797 30.3729C19.3698 30.8979 19.0688 31.5508 18.5625 32.0722C18.0191 32.6317 17.2788 33 16.3113 33C15.4734 33 14.779 32.8076 14.2345 32.4351C13.6875 32.0611 13.3744 31.562 13.2035 31.0944C13.0363 30.6372 13 30.1996 13 29.8924C13 29.7353 13.0095 29.6026 13.0197 29.5056C13.0248 29.4568 13.0301 29.4163 13.0346 29.3855C13.0369 29.37 13.0389 29.357 13.0407 29.3464L13.043 29.3324L13.044 29.3269L13.0444 29.3245L13.0446 29.3234C13.0447 29.3228 13.0448 29.3223 14.0285 29.5021C15.0122 29.6819 15.0123 29.6814 15.0124 29.6809L15.0129 29.6782L15.0134 29.6754L15.0139 29.6722C15.0139 29.6727 15.0136 29.6742 15.0134 29.6754C15.0126 29.6812 15.0109 29.6938 15.0089 29.7133C15.0047 29.7528 15 29.8153 15 29.8924C15 30.0536 15.0207 30.2404 15.0819 30.4077C15.1392 30.5646 15.2256 30.69 15.3635 30.7843C15.5037 30.8802 15.7796 31 16.3113 31C16.7135 31 16.9434 30.8687 17.1276 30.6789C17.349 30.4509 17.533 30.1046 17.7226 29.6304C17.7686 29.5154 17.82 29.3773 17.8752 29.2289C18.0055 28.8782 18.1573 28.4698 18.3111 28.1707C18.3446 28.1054 18.3841 28.0333 18.4302 27.9578C18.9871 26.535 19.8476 24.0427 19.5 23C19.2674 22.3021 18.8183 21.6043 18.4045 21.0574C17.8999 20.6346 17.5158 20.2274 17.284 19.7388C16.9977 19.1353 16.9988 18.5042 16.9999 17.9243L17 17.8209C17 14.572 19.721 12 23 12C26.279 12 29 14.572 29 17.8209H27C27 15.7447 25.2438 14 23 14ZM20.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,
);