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="M14.8073 22.2328C14.1242 21.7953 13.6237 21.0878 13.7428 20.3501C13.7667 20.2024 13.8554 20.0731 13.9847 19.9978C14.114 19.9225 14.2702 19.909 14.4105 19.9611C16.2287 20.6361 18.2567 20.2174 20.0526 18.5126C20.1764 18.3951 20.3517 18.3488 20.5174 18.39C20.6831 18.4311 20.8163 18.554 20.8707 18.7158C21.1024 19.4046 20.8948 20.3341 20.3905 21.0975C19.8685 21.8877 18.983 22.579 17.737 22.7629C16.5386 22.9399 15.521 22.6899 14.8073 22.2328Z" fill="black"/>
<path d="M32.7542 22.2328C33.4373 21.7953 33.9377 21.0878 33.8187 20.3501C33.7948 20.2024 33.7061 20.0731 33.5768 19.9978C33.4475 19.9225 33.2913 19.909 33.151 19.9611C31.3327 20.6361 29.3048 20.2174 27.5089 18.5126C27.3851 18.3951 27.2098 18.3488 27.0441 18.39C26.8784 18.4311 26.7452 18.554 26.6907 18.7158C26.459 19.4046 26.6666 20.3341 27.171 21.0975C27.693 21.8877 28.5785 22.579 29.8244 22.7629C31.0229 22.9399 32.0404 22.6899 32.7542 22.2328Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M33.2581 31C31.5382 27.4383 28.0381 25 24 25C19.9619 25 16.4618 27.4383 14.7419 31C14.273 31.9709 15.0582 33 16.1363 33L31.8637 33C32.9418 33 33.727 31.9709 33.2581 31ZM24 27C26.8697 27 29.4525 28.5553 30.9778 31L17.0222 31C18.5475 28.5553 21.1303 27 24 27Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M42 24C42 33.9411 33.9411 42 24 42C14.0589 42 6 33.9411 6 24C6 14.0589 14.0589 6 24 6C33.9411 6 42 14.0589 42 24ZM40 24C40 32.8366 32.8366 40 24 40C15.1634 40 8 32.8366 8 24C8 15.1634 15.1634 8 24 8C32.8366 8 40 15.1634 40 24Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);