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="M9.75848 8.70499C9.65806 8.2292 9.19269 7.9217 8.71451 8.01733C8.23619 8.113 7.92492 8.57594 8.01542 9.05408C8.08584 9.36669 8.18626 9.68114 8.30944 10.0033C8.5211 10.5569 8.87252 11.3206 9.43973 12.203C10.299 13.5396 11.6444 15.134 13.7256 16.6779L14.2619 17.0758L14.0999 17.7237C13.8633 18.6697 13.6687 19.8586 13.6667 21.1461L13.6666 21.1667C13.6666 21.8723 13.757 22.4744 13.9169 23.0035C13.9443 23.0012 13.972 23.0001 13.9999 23.0001H33.9999C34.0279 23.0001 34.0557 23.0012 34.0831 23.0035C34.2429 22.4744 34.3334 21.8723 34.3334 21.1667C34.3334 19.8713 34.138 18.6748 33.9001 17.7236L33.7381 17.0757L34.2744 16.6779C36.3555 15.1339 37.7009 13.5396 38.5601 12.203C39.2115 11.1898 39.7579 10.1239 39.9835 9.05883C40.077 8.57901 39.7653 8.11331 39.2854 8.01733C38.8072 7.9217 38.3418 8.22919 38.2414 8.70499L38.2387 8.71755L38.235 8.73321L38.2345 8.73522C38.1942 8.90323 37.9316 9.89305 37.0647 11.2416C36.2441 12.5181 34.8707 14.1345 32.5999 15.6884L32.2221 15.947L31.7795 15.8299C29.8322 15.3149 27.2563 14.7715 24.9778 14.6406L24.9748 14.6404C24.654 14.6211 24.3289 14.6112 24 14.6112C23.6707 14.6112 23.345 14.6211 23.0238 14.6405L23.0209 14.6407C20.7426 14.7717 18.1673 15.315 16.2204 15.8299L15.7778 15.947L15.4 15.6884C13.1292 14.1345 11.7558 12.5181 10.9352 11.2416C10.4399 10.4712 10.142 9.81828 9.96997 9.36838C9.9034 9.19427 9.82179 8.97225 9.76414 8.73018L9.76115 8.71762L9.75848 8.70499ZM11.7121 8.27646C11.3787 6.73799 9.8714 5.74635 8.32228 6.05617C6.75777 6.36907 5.74315 7.89101 6.05605 9.45552L6.05819 9.46624L6.06057 9.4769C6.1574 9.91145 6.29133 10.3252 6.44133 10.7176C6.69759 11.3878 7.10923 12.2763 7.75738 13.2845C8.6643 14.6953 10.0173 16.3136 12.0117 17.8849C11.8145 18.8331 11.6686 19.946 11.6667 21.1423L11.6666 21.1667C11.6666 23.0618 12.1936 24.4894 13.0323 25.6749C13.8292 26.8014 14.8942 27.6827 15.8905 28.5071L15.9392 28.5475C17.2476 29.6304 18.5057 30.6806 19.4666 32.242C20.4139 33.7814 21.1111 35.8897 21.1111 39.1112C21.1111 40.7066 22.4045 42 24 42C25.5955 42 26.8889 40.7066 26.8889 39.1111C26.8889 35.8896 27.5861 33.7814 28.5334 32.242C29.4943 30.6806 30.7523 29.6304 32.0607 28.5475L32.1096 28.5071C33.1058 27.6827 34.1708 26.8014 34.9677 25.6749C35.8064 24.4894 36.3334 23.0618 36.3334 21.1667C36.3334 19.9611 36.1869 18.8394 35.9883 17.8848C37.9826 16.3136 39.3356 14.6952 40.2425 13.2845C40.9475 12.1878 41.6435 10.8804 41.9417 9.46567L41.9438 9.45552C42.2567 7.89102 41.2421 6.36907 39.6776 6.05617C38.1292 5.74651 36.6227 6.73698 36.2883 8.27411C36.2691 8.34861 36.0657 9.09708 35.3823 10.1601C34.7416 11.1568 33.6556 12.4678 31.8386 13.7791C29.8882 13.2834 27.383 12.7756 25.094 12.644C24.7335 12.6223 24.3686 12.6112 24 12.6112C23.6309 12.6112 23.2655 12.6223 22.9045 12.6441C20.6159 12.7758 18.1113 13.2836 16.1613 13.7792C14.3443 12.4678 13.2582 11.1568 12.6175 10.1601C12.2032 9.51556 11.9655 8.98736 11.8381 8.65411C11.7785 8.49836 11.7377 8.38108 11.7121 8.27646Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);