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="M9.00006 13.9995C9.00006 10.2209 11.3284 6.98843 14.6248 5.65405L15.3753 7.50793C12.8081 8.5471 11.0001 11.0633 11.0001 13.9995V30.3774L10.3333 30.613C9.45903 30.922 9.24986 31.1919 9.16148 31.3759C9.02687 31.6561 9.00006 32.0586 9.00006 32.9995C9.00006 34.6766 9.68683 36.454 10.8178 37.8082C11.9481 39.1616 13.4379 39.9995 15.0001 39.9995C16.5622 39.9995 18.052 39.1616 19.1823 37.8082C20.3133 36.454 21.0001 34.6766 21.0001 32.9995C21.0001 32.0586 20.9733 31.6561 20.8386 31.3759C20.7503 31.1919 20.5411 30.922 19.6668 30.613L19.0001 30.3774V19.9995C19.0001 17.2381 21.2387 14.9995 24.0001 14.9995H25.0001V25.9995C25.0001 29.2903 28.3008 31.9995 32.0001 31.9995C35.6993 31.9995 39.0001 29.2903 39.0001 25.9995V15.9995H41.0001V25.9995C41.0001 30.7096 36.4603 33.9995 32.0001 33.9995C27.5399 33.9995 23.0001 30.7096 23.0001 25.9995V17.1702C21.8349 17.582 21.0001 18.6933 21.0001 19.9995V28.9993C21.7557 29.3574 22.3131 29.8267 22.6413 30.5097C23.001 31.2583 23.0005 32.1367 23.0001 32.9187L23.0001 32.9995C23.0001 35.1884 22.1198 37.411 20.7173 39.0902C19.3141 40.7704 17.3039 41.9995 15.0001 41.9995C12.6962 41.9995 10.686 40.7704 9.28279 39.0902C7.8803 37.411 7.00006 35.1884 7.00006 32.9995L7.00003 32.9187C6.9996 32.1367 6.99911 31.2583 7.35877 30.5097C7.68697 29.8267 8.24444 29.3574 9.00006 28.9993V13.9995Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M32 15C29.2386 15 27 17.2386 27 20V25C27 27.7614 29.2386 30 32 30C34.7614 30 37 27.7614 37 25V20C37 17.9497 35.7659 16.1876 34 15.416V6H32V15ZM35 25V20C35 18.3431 33.6569 17 32 17C30.3431 17 29 18.3431 29 20V25C29 26.6569 30.3431 28 32 28C33.6569 28 35 26.6569 35 25Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);