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 d="M8.46289 18.5911C8.46287 16.8205 9.13032 14.1735 11.1262 11.9805C13.0948 9.81741 16.4436 8 21.997 8C24.8969 8 26.7944 8.35253 28.218 8.91692C29.6317 9.47742 30.6517 10.2748 31.7777 11.3038C31.8673 11.3856 31.9532 11.4638 32.0356 11.5387C32.9207 12.3441 33.3979 12.7783 33.6509 13.4426C34.9272 16.7931 37.1986 21.6057 38.6703 24.6413C39.0005 25.3224 38.5008 26.112 37.7572 26.112H35.56V33C35.56 33.5523 35.1123 34 34.56 34H29.1151C29.0703 33.9949 29.0246 33.9927 28.9782 33.9937C28.8057 33.9975 28.6396 33.9996 28.4792 34H28.352C26.0659 33.9936 24.964 33.6422 23.3377 33.0588C22.8179 32.8723 22.2453 33.1425 22.0588 33.6624C21.8723 34.1822 22.1425 34.7548 22.6624 34.9413C24.209 35.4962 25.4159 35.8815 27.4073 35.9769V42H29.4073V36H34.56C36.2169 36 37.56 34.6569 37.56 33V28.112H37.7572C39.9903 28.112 41.4383 25.7661 40.4699 23.7687C38.9957 20.7281 36.7609 15.9887 35.5199 12.7307C35.0859 11.5912 34.2313 10.8223 33.4212 10.0935C33.3222 10.0044 33.2238 9.91586 33.1269 9.82736C31.9317 8.73512 30.7005 7.74968 28.9551 7.05771C27.2195 6.36963 25.05 6 21.997 6C15.9684 6 12.05 7.99392 9.64707 10.6343C7.27141 13.2447 6.46286 16.3932 6.46289 18.5911C6.46296 24.2512 9.66061 28.6551 11.4999 30.6382V42H13.4999V29.8311L13.2151 29.5396C11.5944 27.8812 8.46295 23.7903 8.46289 18.5911Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);