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="M21.5 32C21.261 32 21.0415 32.0839 20.8695 32.2238C20.6664 31.5657 20.2492 30.9601 19.7806 30.3749C19.4353 29.9438 18.806 29.8742 18.3749 30.2194C17.9438 30.5647 17.8742 31.194 18.2194 31.6251C18.8459 32.4073 18.9936 32.7954 18.9998 33.0459C19.005 33.2571 18.9106 33.6115 18.26 34.3274C17.8885 34.7361 17.9187 35.3686 18.3274 35.74C18.7361 36.1115 19.3686 36.0813 19.74 35.6726C20.2772 35.0815 20.7095 34.4724 20.8979 33.7985C21.0654 33.925 21.2739 34 21.5 34H26.5C26.7261 34 26.9346 33.925 27.1021 33.7985C27.2905 34.4724 27.7228 35.0815 28.26 35.6726C28.6314 36.0813 29.2639 36.1115 29.6726 35.74C30.0813 35.3686 30.1115 34.7361 29.74 34.3274C29.0894 33.6115 28.995 33.2571 29.0002 33.0459C29.0064 32.7954 29.1541 32.4073 29.7806 31.6251C30.1258 31.194 30.0562 30.5647 29.6251 30.2194C29.194 29.8742 28.5647 29.9438 28.2194 30.3749C27.7508 30.9601 27.3336 31.5657 27.1305 32.2238C26.9585 32.0839 26.739 32 26.5 32H21.5Z" 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 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,
);