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="M19.4955 10H21.4955L21.4955 15.1364C21.4955 15.3519 21.5423 15.4465 21.5613 15.4782C21.5812 15.5113 21.6071 15.5357 21.6478 15.5583C21.6942 15.5841 21.7507 15.6016 21.8025 15.6112C21.8237 15.6151 21.8398 15.6169 21.848 15.6176L21.9539 15.6177C21.9377 14.1013 21.9518 11.3039 24.3225 11.3039C27.6338 11.3039 29.999 22.3099 28.5799 23.4329C27.1608 24.556 24.3225 23.8822 22.9034 22.5345C21.8668 21.55 21.8492 19.3748 21.908 17.6177L21.828 17.6176L21.828 17.6095L21.8279 17.6158L21.828 17.6176L21.8266 17.6176L21.8242 17.6176L21.819 17.6176L21.8071 17.6174C21.7984 17.6172 21.7883 17.617 21.7768 17.6166C21.754 17.6157 21.7256 17.6142 21.6924 17.6116C21.6264 17.6063 21.5396 17.5965 21.4384 17.5777C21.2402 17.541 20.9634 17.466 20.6766 17.3066C20.6166 17.2733 20.556 17.2362 20.4956 17.1949C20.4351 17.2362 20.3745 17.2734 20.3145 17.3067C20.0276 17.466 19.7508 17.5411 19.5526 17.5778C19.4515 17.5965 19.3646 17.6064 19.2986 17.6116C19.2655 17.6143 19.2371 17.6158 19.2142 17.6166L19.1935 17.6172L19.184 17.6175L19.172 17.6176L19.1669 17.6176L19.1645 17.6177L19.1633 17.6177L19.1622 17.6177L19.0924 17.6176C19.1507 19.3724 19.1306 21.5392 18.0966 22.5212C16.6775 23.8689 13.8392 24.5427 12.4201 23.4197C11.001 22.2966 13.3662 11.2906 16.6775 11.2906C19.055 11.2906 19.0623 14.1042 19.0459 15.6176L19.1434 15.6176C19.1517 15.6169 19.1676 15.6151 19.1885 15.6112C19.2403 15.6016 19.2968 15.5841 19.3433 15.5583C19.384 15.5357 19.4099 15.5114 19.4297 15.4782C19.4487 15.4466 19.4955 15.352 19.4955 15.1364V10ZM16.1049 14.0986C16.4549 13.5466 16.6864 13.3601 16.7687 13.3025C16.7983 13.3522 16.8502 13.4577 16.9016 13.6528C17.0551 14.2358 17.0499 14.9158 17.0446 15.6176C17.0436 15.7469 17.0426 15.8772 17.0426 16.0075C17.0426 16.3541 17.0591 16.7774 17.0751 17.1872C17.081 17.3392 17.0869 17.4895 17.0918 17.6332C17.1114 18.2063 17.1212 18.7754 17.0943 19.3135C17.067 19.8592 17.0046 20.3031 16.909 20.6374C16.8154 20.9646 16.7246 21.0651 16.7195 21.0708C16.3334 21.4375 15.6408 21.7925 14.8952 21.9302C14.4994 22.0033 14.2077 21.9967 14.0066 21.9653C13.9962 21.7624 13.997 21.4991 14.0172 21.1747C14.0805 20.1544 14.316 18.8177 14.6977 17.4844C15.0828 16.139 15.5799 14.9269 16.1049 14.0986ZM26.3023 17.4977C25.9172 16.1523 25.4201 14.9402 24.8951 14.1119C24.5451 13.5599 24.3136 13.3734 24.2313 13.3158C24.2017 13.3654 24.1498 13.471 24.0984 13.6661C23.9449 14.2491 23.9501 14.9291 23.9554 15.6309C23.9564 15.7601 23.9574 15.8905 23.9574 16.0207C23.9574 16.3674 23.9409 16.7906 23.9249 17.2005L23.9246 17.2089C23.9187 17.3581 23.913 17.5054 23.9082 17.6465C23.8886 18.2196 23.8788 18.7887 23.9057 19.3268C23.933 19.8725 23.9954 20.3164 24.091 20.6506C24.1846 20.9778 24.2754 21.0784 24.2805 21.0841C24.6666 21.4507 25.3592 21.8058 26.1048 21.9435C26.5006 22.0166 26.7923 22.01 26.9934 21.9786C27.0038 21.7757 27.003 21.5124 26.9828 21.188C26.9195 20.1677 26.684 18.831 26.3023 17.4977Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 6C6.44772 6 6 6.44772 6 7V27C6 27.5523 6.44772 28 7 28H19V30H7C6.44772 30 6 30.4477 6 31V37C6 37.5523 6.44772 38 7 38H14V40C14 41.1031 14.8929 42 15.9989 42H36.8619C37.7891 42 38.5602 41.8291 39.1852 41.495C39.8201 41.1557 40.2479 40.6777 40.5235 40.1611C41.0092 39.2505 41.003 38.2298 41.0001 37.7573C41 37.7382 40.9999 37.72 40.9998 37.7027C40.9998 37.6902 40.9998 37.6782 40.9998 37.6667V24C41.552 24 42 23.5523 42 23V17C42 16.4477 41.5523 16 41 16L40.9998 12.9048C40.9998 12.3186 40.8973 11.7723 40.6284 11.3049C40.3491 10.8194 39.9414 10.5077 39.4943 10.3177C39.0697 10.1373 38.6099 10.0661 38.1871 10.0328C37.7694 9.99998 37.316 9.99999 36.8847 10H36.8619V12C37.3203 12 37.6988 12.0006 38.0302 12.0267C38.3638 12.0529 38.5764 12.1008 38.7121 12.1585C38.8254 12.2066 38.866 12.2521 38.8948 12.3022C38.9341 12.3705 38.9998 12.5385 38.9998 12.9048V16C38.4476 16.0001 38 16.4478 38 17V23C38 23.5522 38.4476 23.9999 38.9998 24V37.6762C38.9998 38.2056 38.9998 38.7681 38.7588 39.2198C38.6533 39.4176 38.4984 39.5943 38.2424 39.7312C37.9765 39.8733 37.5484 40 36.8619 40H27V38H34C34.5523 38 35 37.5523 35 37V31C35 30.4477 34.5523 30 34 30H21V28H34C34.5523 28 35 27.5523 35 27V7C35 6.44772 34.5523 6 34 6H7ZM8 8V26H33V8H8ZM25 38V40H16V38H25ZM27 34.5V36H33V32H8V36H14V34.5C14 33.9477 14.4477 33.5 15 33.5C15.5523 33.5 16 33.9477 16 34.5V36H25V34.5C25 33.9477 25.4477 33.5 26 33.5C26.5523 33.5 27 33.9477 27 34.5ZM39.5 22V18H40.5V22H39.5Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);