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="M31.4245 38.1768C29.2056 39.3412 26.6798 40 24 40C15.1634 40 8 32.8366 8 24C8 15.1634 15.1634 8 24 8C32.8366 8 40 15.1634 40 24C40 24.1673 39.9974 24.334 39.9923 24.5H41.9932C41.9977 24.3339 42 24.1672 42 24C42 14.0589 33.9411 6 24 6C14.0589 6 6 14.0589 6 24C6 33.9411 14.0589 42 24 42C27.0254 42 29.8764 41.2536 32.379 39.935L31.4245 38.1768Z" fill="black"/>
<path d="M13.7428 23.3502C13.6237 24.0879 14.1242 24.7954 14.8073 25.2328C15.521 25.69 16.5386 25.9399 17.737 25.763C18.983 25.5791 19.8685 24.8878 20.3905 24.0976C20.8948 23.3341 21.1024 22.4047 20.8707 21.7159C20.8163 21.5541 20.6831 21.4312 20.5174 21.39C20.3517 21.3489 20.1764 21.3951 20.0526 21.5127C18.2567 23.2174 16.2287 23.6362 14.4105 22.9611C14.2702 22.909 14.114 22.9225 13.9847 22.9979C13.8554 23.0732 13.7667 23.2025 13.7428 23.3502Z" fill="black"/>
<path d="M33.8187 23.3502C33.9377 24.0879 33.4373 24.7954 32.7542 25.2328C32.0404 25.69 31.0229 25.9399 29.8244 25.763C28.5785 25.5791 27.693 24.8878 27.171 24.0976C26.6666 23.3341 26.459 22.4047 26.6907 21.7159C26.7452 21.5541 26.8784 21.4312 27.0441 21.39C27.2098 21.3489 27.3851 21.3951 27.5089 21.5127C29.3048 23.2174 31.3327 23.6362 33.151 22.9611C33.2913 22.909 33.4475 22.9225 33.5768 22.9979C33.7061 23.0732 33.7948 23.2025 33.8187 23.3502Z" fill="black"/>
<path d="M40 32C40 34.2091 38.2091 36 36 36C33.7909 36 32 34.2091 32 32C32 28.5 36 25 36 25C36 25 40 28.5 40 32Z" fill="black"/>
<path d="M20.8 33.6C22.4 31.4667 25.6 31.4667 27.2 33.6C27.5314 34.0418 28.1582 34.1314 28.6 33.8C29.0418 33.4686 29.1314 32.8418 28.8 32.4C26.4 29.2 21.6 29.2 19.2 32.4C18.8686 32.8418 18.9582 33.4686 19.4 33.8C19.8418 34.1314 20.4686 34.0418 20.8 33.6Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);