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="M17.6316 31.506C17.428 31.7553 17.2665 32.0737 17.1603 32.3837C17.0546 32.6923 16.9711 33.087 17.0095 33.4906C17.0492 33.9073 17.2392 34.4466 17.7887 34.7678C18.2969 35.0649 18.8851 35.0363 19.4055 34.9059L19.4189 34.9023C21.8147 34.2663 22.9879 34.0031 24.1232 34.0082C25.2612 34.0133 26.4085 34.2873 28.7617 34.9008C29.2163 35.0286 29.7571 35.0597 30.2382 34.7705C30.7353 34.4718 30.9197 33.9828 30.9756 33.6165C31.0312 33.2517 30.9844 32.8889 30.9091 32.5953C30.8332 32.2996 30.708 31.9942 30.5377 31.7408C30.4215 31.5677 30.2491 31.3888 30.1867 31.3241L30.1749 31.3118L30.166 31.3024C28.8425 29.854 26.5038 29 23.9868 29C21.3636 29 18.9189 29.9297 17.6316 31.506ZM24.1322 32.0082C22.7264 32.0019 21.3347 32.3267 19.0973 32.9185C19.1072 32.8969 19.1172 32.8764 19.1273 32.8574C19.1548 32.8054 19.1752 32.7777 19.1807 32.7711C19.9669 31.8084 21.7418 31 23.9868 31C26.1285 31 27.8547 31.7378 28.6895 32.6515C28.7203 32.6852 28.7507 32.7171 28.774 32.7417L28.7757 32.7435C28.7806 32.7486 28.7851 32.7534 28.7895 32.758C28.8083 32.7778 28.8228 32.7932 28.8364 32.8081C28.8679 32.8425 28.877 32.8553 28.8776 32.8561C28.8794 32.8589 28.8816 32.8622 28.8838 32.866C26.8177 32.3297 25.4893 32.0143 24.1322 32.0082Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28 23.5C28 22.1193 29.1193 21 30.5 21C31.8807 21 33 22.1193 33 23.5C33 24.8807 31.8807 26 30.5 26C29.1193 26 28 24.8807 28 23.5ZM30.5 23C30.2239 23 30 23.2239 30 23.5C30 23.7761 30.2239 24 30.5 24C30.7761 24 31 23.7761 31 23.5C31 23.2239 30.7761 23 30.5 23Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.5 21C16.1193 21 15 22.1193 15 23.5C15 24.8807 16.1193 26 17.5 26C18.8807 26 20 24.8807 20 23.5C20 22.1193 18.8807 21 17.5 21ZM17 23.5C17 23.2239 17.2239 23 17.5 23C17.7761 23 18 23.2239 18 23.5C18 23.7761 17.7761 24 17.5 24C17.2239 24 17 23.7761 17 23.5Z" fill="black"/>
<path d="M16.8885 20.3566C15.2494 19.8157 13.6076 19.4657 12.5546 19.3109L12.8454 17.3322C14.0047 17.5026 15.7594 17.8779 17.5153 18.4574C19.2474 19.0291 21.0972 19.8366 22.3528 20.9217L21.0451 22.435C20.0949 21.6138 18.5514 20.9055 16.8885 20.3566Z" fill="black"/>
<path d="M35.3949 19.311C34.3419 19.4658 32.7001 19.8158 31.061 20.3567C29.3981 20.9056 27.8546 21.6139 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.311Z" 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,
);