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.1096 32.8759C29.6418 31.7507 26.9988 31 23.9824 31C20.737 31 17.9239 31.8691 16.5415 33.1386C15.9452 33.6862 15.3756 35.3447 17.5497 34.9359C23.878 33.6758 24.4931 33.7222 30.6988 34.9359C32.2848 35.276 32.1457 34.0519 31.7107 33.4262C31.5724 33.2274 31.3758 33.0781 31.1819 32.931L31.1096 32.8759Z" fill="black"/>
<path d="M20 24C20 26.2091 18.8807 28 17.5 28C16.1193 28 15 26.2091 15 24C15 22.3859 15.5975 20.9952 16.4579 20.363L16.439 20.3567C14.7999 19.8158 13.1581 19.4658 12.1051 19.311L12.3959 17.3323C13.5552 17.5027 15.3099 17.878 17.0658 18.4575C18.7979 19.0292 20.6477 19.8367 21.9034 20.9218L20.5956 22.4351C20.2987 22.1785 19.9439 21.9329 19.5455 21.6998C19.8319 22.3504 20 23.1438 20 24Z" fill="black"/>
<path d="M33 24C33 26.2091 31.8807 28 30.5 28C29.1193 28 28 26.2091 28 24C28 22.9751 28.2409 22.0402 28.6371 21.3324C27.9572 21.6703 27.362 22.0396 26.9044 22.4351L25.5966 20.9218C26.8523 19.8367 28.7021 19.0292 30.4342 18.4575C32.1901 17.878 33.9448 17.5027 35.1041 17.3323L35.3949 19.311C34.41 19.4558 32.91 19.7713 31.3789 20.2542C32.326 20.8234 33 22.2857 33 24Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24 42C33.9411 42 42 33.9411 42 24C42 14.0589 33.9411 6 24 6C14.0589 6 6 14.0589 6 24C6 33.9411 14.0589 42 24 42ZM24 40C32.8366 40 40 32.8366 40 24C40 15.1634 32.8366 8 24 8C15.1634 8 8 15.1634 8 24C8 32.8366 15.1634 40 24 40Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);