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="M36.0001 23.9995C36.0001 23.1711 35.3285 22.4995 34.5001 22.4995C33.6716 22.4995 33.0001 23.1711 33.0001 23.9995C33.0001 24.8279 33.6716 25.4995 34.5001 25.4995C35.3285 25.4995 36.0001 24.8279 36.0001 23.9995Z" fill="black"/>
<path d="M30.7521 23.25C31.1674 23.25 31.5041 23.5858 31.5041 24C31.5041 24.4142 31.1674 24.75 30.7521 24.75C30.3367 24.75 30.0001 24.4142 30.0001 24C30.0001 23.5858 30.3367 23.25 30.7521 23.25Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M44 24C44 35.0457 35.0457 44 24 44C12.9543 44 4 35.0457 4 24C4 12.9543 12.9543 4 24 4C35.0457 4 44 12.9543 44 24ZM34.9338 38.2998C31.9029 40.6208 28.1125 42 24 42C14.0589 42 6 33.9411 6 24C6 19.5568 7.60986 15.4897 10.2781 12.35L15.6468 18.0005H14C10.6863 18.0005 8 20.6868 8 24.0005C8 27.3142 10.6863 30.0005 14 30.0005H27.0484L34.9338 38.2998ZM11.6574 10.898L18.4056 18.0005H34C37.3137 18.0005 40 20.6868 40 24.0005C40 27.3142 37.3137 30.0005 34 30.0005H29.8072L36.454 36.9961C39.8719 33.7199 42 29.1085 42 24C42 14.0589 33.9411 6 24 6C19.2226 6 14.8799 7.86119 11.6574 10.898ZM38 24.0005C38 21.7913 36.2091 20.0005 34 20.0005H20.3059L22.2055 21.9998H26.0001C27.1047 21.9998 28.0001 22.8952 28.0001 23.9998C28.0001 25.1024 27.1079 25.9966 26.006 25.9997L27.9069 28.0005H34C36.2091 28.0005 38 26.2096 38 24.0005ZM10 24.0005C10 21.7913 11.7909 20.0005 14 20.0005H17.5471L19.4467 21.9998H14.0001C12.8956 21.9998 12.0001 22.8952 12.0001 23.9998C12.0001 25.1043 12.8956 25.9998 14.0001 25.9998H23.2472L25.1481 28.0005H14C11.7909 28.0005 10 26.2096 10 24.0005Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);