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="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_4161_11243)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 3.25C7.16751 3.25 3.25 7.16751 3.25 12C3.25 16.8325 7.16751 20.75 12 20.75C16.8325 20.75 20.75 16.8325 20.75 12C20.75 7.16751 16.8325 3.25 12 3.25ZM6.53446 16.0852C6.13404 16.1912 5.89536 16.6018 6.00136 17.0022C6.10736 17.4026 6.51789 17.6413 6.91831 17.5353C8.84734 17.0246 11.1324 16.1498 13.4861 14.9763C15.8301 13.8076 17.8965 12.5151 19.4629 11.2864C19.7888 11.0307 19.8457 10.5593 19.5901 10.2334C19.3344 9.90748 18.863 9.85052 18.5371 10.1062C17.0645 11.2613 15.0874 12.5018 12.8168 13.6339C10.5367 14.7707 8.34755 15.6053 6.53446 16.0852Z" fill="currentColor"/>
<path d="M20.3362 6.75517C19.692 6.7149 18.7864 6.81696 17.6707 7.07848L17.3284 5.61807C18.5107 5.34091 19.5777 5.20483 20.4298 5.25809C21.221 5.30754 22.1187 5.54277 22.5088 6.3253C22.8733 7.05631 22.5866 7.85359 22.2063 8.47634C21.8023 9.13788 21.1496 9.84681 20.3373 10.5618L19.3462 9.43583C20.1058 8.76729 20.6337 8.17332 20.9261 7.69458C21.2421 7.17704 21.1674 6.99665 21.1664 6.9946C21.1637 6.98919 21.0413 6.79924 20.3362 6.75517Z" fill="currentColor"/>
<path d="M5.83733 17.7912C4.77744 18.0097 3.81846 18.1043 3.04701 18.0288C2.3208 17.9577 1.51151 17.7069 1.14704 16.9759C0.757762 16.1951 1.10781 15.3387 1.54249 14.6784C2.01041 13.9677 2.75773 13.1996 3.68638 12.4243L4.64771 13.5757C3.77169 14.3071 3.14866 14.9666 2.79537 15.5032C2.40884 16.0904 2.48682 16.3013 2.48945 16.3066C2.49047 16.3086 2.58957 16.4769 3.19309 16.5359C3.75138 16.5906 4.54349 16.5264 5.53452 16.3221L5.83733 17.7912Z" fill="currentColor"/>
</g>
<defs>
<clipPath id="clip0_4161_11243">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);