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="M30.4448 20.6639C32.165 20.2678 33.7247 19.6273 34.8289 18.2557C35.86 16.975 36.3012 15.2884 36.491 13.2654C37.9709 13.7215 39.1123 14.7653 39.9984 16.3935C41.065 18.3534 41.7287 21.137 41.9327 24.6164C35.9743 24.0837 31.8015 27.3671 30.7561 31.4H25.8025L24 34.7647L22.1975 31.4H17.2439C16.1985 27.3671 12.0257 24.0837 6.06728 24.6164C6.27127 21.137 6.93499 18.3534 8.0016 16.3935C8.88769 14.7653 10.0291 13.7215 11.509 13.2654C11.6988 15.2884 12.14 16.975 13.1711 18.2557C14.2719 19.6231 15.8254 20.2639 17.5392 20.6602L17.2831 18.5258C14.3667 17.6681 13.5137 16.0136 13.3878 11C13.2246 11 13.0637 11.0041 12.905 11.0121C12.3758 11.039 11.872 11.1105 11.3931 11.2245C6.69845 12.3423 4.39855 17.5486 4.0477 24.9326C4.01579 25.6042 4 26.2938 4 27C4.69598 26.822 5.36344 26.7003 6.00153 26.6292C12.0863 25.951 15.5 29.8702 15.5 33.4H21L24 39L27 33.4H32.5C32.5 29.8702 35.9137 25.951 41.9985 26.6292C42.6366 26.7003 43.304 26.822 44 27C44 26.2938 43.9842 25.6042 43.9523 24.9326C43.6014 17.5486 41.3015 12.3423 36.6069 11.2245C36.128 11.1105 35.6242 11.039 35.095 11.0121C34.9363 11.0041 34.7754 11 34.6122 11C34.4865 16.0058 33.636 17.6629 30.7304 18.5218L30.4448 20.6639Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.8896 12.0061C19.4385 11.9451 19.9329 12.3407 19.9939 12.8896L20.9939 21.8896C21.0549 22.4385 20.6593 22.9329 20.1104 22.9939C19.5615 23.0549 19.0671 22.6593 19.0061 22.1104L18.0061 13.1104C17.9451 12.5615 18.3407 12.0671 18.8896 12.0061Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.1104 12.0061C28.5615 11.9451 28.0671 12.3407 28.0061 12.8896L27.0061 21.8896C26.9451 22.4385 27.3407 22.9329 27.8896 22.9939C28.4385 23.0549 28.9329 22.6593 28.9939 22.1104L29.9939 13.1104C30.0549 12.5615 29.6593 12.0671 29.1104 12.0061Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.0046 16.0001C22.9774 16.0055 21.9005 16.2893 20.3857 16.9226L19.6143 15.0774C21.2267 14.4032 22.5854 14.0076 23.9941 14.0001C25.4075 13.9926 26.7714 14.3762 28.3984 15.0828L27.6016 16.9172C26.0997 16.2649 25.0272 15.9947 24.0046 16.0001Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);