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">
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.9697 6.96967C19.2626 6.67678 19.7374 6.67678 20.0303 6.96967L19.5 7.5C20.0303 6.96967 20.0306 6.96989 20.0308 6.97012L20.0313 6.9706L20.0323 6.97168L20.0349 6.97426L20.0416 6.98113L20.0613 7.00165C20.0771 7.01833 20.0982 7.04101 20.1237 7.06959C20.1747 7.1267 20.2439 7.20756 20.325 7.31121C20.487 7.51816 20.6983 7.8181 20.9084 8.20336C21.3286 8.97364 21.75 10.0966 21.75 11.5C21.75 12.9034 21.3286 14.0264 20.9084 14.7966C20.6983 15.1819 20.487 15.4818 20.325 15.6888C20.2439 15.7924 20.1747 15.8733 20.1237 15.9304C20.0982 15.959 20.0771 15.9817 20.0613 15.9984L20.0416 16.0189L20.0349 16.0257L20.0323 16.0283L20.0313 16.0294L20.0308 16.0299C20.0306 16.0301 20.0303 16.0303 19.5207 15.5207L20.0303 16.0303C19.7374 16.3232 19.2626 16.3232 18.9697 16.0303C18.6776 15.7383 18.6768 15.2654 18.9671 14.9723C18.9679 14.9714 18.9688 14.9705 18.9697 14.9697L19.5 15.5C18.9697 14.9697 18.9695 14.9699 18.9693 14.9701L18.9689 14.9705L18.9682 14.9711L18.9673 14.9721L18.9724 14.9667C18.9786 14.9602 18.9897 14.9482 19.0052 14.9309C19.0362 14.8962 19.0842 14.8404 19.1437 14.7643C19.263 14.6119 19.4267 14.3806 19.5916 14.0784C19.9214 13.4736 20.25 12.5966 20.25 11.5C20.25 10.4034 19.9214 9.52636 19.5916 8.92164C19.4267 8.6194 19.263 8.38809 19.1437 8.23567C19.0842 8.15963 19.0362 8.10377 19.0052 8.06908C18.9897 8.05176 18.9786 8.03978 18.9724 8.03326L18.9671 8.02774C18.6768 7.73464 18.6776 7.2617 18.9697 6.96967Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.0367 3.3964C14.2002 2.62923 15.75 3.46373 15.75 4.85741V19.1431C15.75 20.5368 14.2002 21.3713 13.0367 20.6041L7.03762 16.6487C6.99677 16.6218 6.94892 16.6074 6.9 16.6074H4C2.48122 16.6074 1.25 15.3762 1.25 13.8574V10.1431C1.25 8.62434 2.48122 7.39313 4 7.39313H6.9C6.94892 7.39313 6.99677 7.37877 7.03762 7.35184L13.0367 3.3964Z" fill="currentColor"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);