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="M15.9896 14.0764C18.239 14.0764 20.0626 12.2684 20.0626 10.0382C20.0626 7.80796 18.239 6 15.9896 6C13.7401 6 11.9165 7.80796 11.9165 10.0382C11.9165 12.2684 13.7401 14.0764 15.9896 14.0764ZM15.9896 12.0764C17.1449 12.0764 18.0587 11.1513 18.0587 10.0382C18.0587 8.92506 17.1449 8 15.9896 8C14.8342 8 13.9204 8.92506 13.9204 10.0382C13.9204 11.1513 14.8342 12.0764 15.9896 12.0764Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.27498 16.5754C10.2309 16.0019 11.2881 15.7641 12.3486 15.7641H19.6867C20.7472 15.7641 21.8044 16.0019 22.7603 16.5754C23.7143 17.1478 24.4017 17.955 24.8805 18.8376C25.6925 20.3346 25.9768 22.1796 26.0268 24.0448C28.7669 24.0758 30.9785 26.3024 30.9785 29.0444V34.0444C30.9785 35.149 31.8756 36.0444 32.9823 36.0444C34.089 36.0444 34.9862 35.149 34.9862 34.0444L34.9866 22.7944H33.4117V21.3444H31.694C30.7454 21.3444 29.9764 20.5447 29.9764 19.5582V17.4157L29.933 16.4249L29.9764 16.423V8.89173C29.9764 7.90522 30.7454 7.10549 31.694 7.10549H34.2704L34.7565 6.58553C35.431 5.86407 36.5451 5.86407 37.2195 6.58553L37.7056 7.10549H40.282C41.2306 7.10549 41.9996 7.90522 41.9996 8.89173V19.5582C41.9996 20.5447 41.2306 21.3444 40.282 21.3444H38.5646V22.7944H36.9904L36.9901 34.0444C36.9901 36.2536 35.1957 38.0444 32.9823 38.0444C30.7689 38.0444 28.9746 36.2536 28.9746 34.0444V29.0444C28.9746 27.4058 27.6582 26.0739 26.0233 26.0449C26.0236 26.0698 26.0239 26.095 26.0242 26.1206L26.0242 26.1218L26.0243 26.1257C26.0293 26.5314 26.0353 27.0148 26.0353 27.5372C26.0353 29.0833 24.7795 30.3367 23.2304 30.3367C22.9495 30.3367 22.6782 30.2954 22.4223 30.2187V33.024H22.415L22.415 39.203C22.415 40.6995 21.2358 41.9313 19.738 41.9995C18.2402 42.0677 16.9535 40.9482 16.8169 39.458L16.0629 31.2292H15.9165L15.1624 39.458C15.0259 40.9482 13.7392 42.0677 12.2414 41.9995C10.7436 41.9313 9.56439 40.6995 9.56439 39.203L9.56439 33.024H9.55701V30.2443L9.55691 30.2349C9.31764 30.3012 9.06543 30.3367 8.80485 30.3367C7.25577 30.3367 6 29.0833 6 27.5372C6 27.0145 6.00597 26.531 6.01098 26.1251L6.01101 26.1233C6.01265 25.9901 6.01419 25.8656 6.01539 25.7504C6.01806 25.4948 6.01859 25.3043 6.01728 25.1654C6.0159 25.0181 6.01253 24.9539 6.01101 24.9368L6.00393 24.8573C6.00131 24.8279 6 24.7984 6 24.7688V24.689C6.00002 22.6089 6.24934 20.5069 7.1548 18.8376C7.63361 17.955 8.32098 17.1478 9.27498 16.5754ZM22.4294 27.5372C22.4294 27.1514 22.4261 26.7944 22.4223 26.4664V24.7701C22.4238 24.7418 22.4253 24.7149 22.4271 24.6895C22.4287 24.666 22.4294 24.6424 22.4293 24.6188C22.4288 24.457 22.4264 24.2998 22.4223 24.147V21.6016H20.4184V24.1412L20.4183 24.1565V24.7483L20.4184 24.7636V26.447L20.4183 26.4623V30.1083C20.4135 30.1479 20.4111 30.1883 20.4111 30.2292L20.4111 39.203C20.4111 39.6303 20.0743 39.9821 19.6466 40.0016C19.2189 40.0211 18.8515 39.7014 18.8125 39.2758L17.9751 30.1381C17.9279 29.6232 17.4953 29.2292 16.9773 29.2292H15.002C14.484 29.2292 14.0514 29.6232 14.0042 30.1381L13.1669 39.2758C13.1279 39.7014 12.7604 40.0211 12.3327 40.0016C11.905 39.9821 11.5683 39.6303 11.5683 39.203L11.5683 30.2292C11.5683 30.1879 11.5658 30.1472 11.5609 30.1072V21.6016H9.55701V27.8135C9.44437 28.1192 9.14904 28.3367 8.80485 28.3367C8.36248 28.3367 8.00387 27.9787 8.00387 27.5372C8.00387 27.0277 8.0097 26.555 8.01473 26.1479C8.01636 26.0154 8.01793 25.8885 8.01916 25.7712C8.02435 25.2733 8.02311 24.9405 8.00702 24.7598L7.99994 24.6803C7.99996 22.7002 8.25283 21.0142 8.91699 19.7899C9.25661 19.1638 9.71259 18.6464 10.3074 18.2895C10.9028 17.9323 11.5903 17.7641 12.3486 17.7641H19.6867C20.4449 17.7641 21.1325 17.9323 21.7279 18.2895C22.3227 18.6464 22.7787 19.1638 23.1183 19.7899C23.7824 21.0142 24.0314 22.7089 24.0314 24.689V24.7245L24.0283 24.7598C24.0122 24.9405 24.0109 25.2733 24.0161 25.7712C24.0173 25.8887 24.0189 26.015 24.0205 26.1477L24.0206 26.1502C24.0256 26.5568 24.0314 27.0286 24.0314 27.5372C24.0314 27.9787 23.6728 28.3367 23.2304 28.3367C22.7881 28.3367 22.4294 27.9787 22.4294 27.5372ZM36.2405 8.46991C36.6195 8.87531 37.1501 9.10549 37.7056 9.10549H39.9958V15.2835C39.6723 15.1516 39.3035 15.0602 38.893 15.0463C38.2088 15.0231 37.4866 15.2177 36.7489 15.6738C35.7615 16.2844 34.8372 16.4542 33.7774 16.4779C33.2943 16.4886 32.8002 16.469 32.2467 16.4471L31.9803 16.4367V9.10549H34.2704C34.826 9.10549 35.3566 8.87531 35.7356 8.46991L35.988 8.19986L36.2405 8.46991ZM31.9803 18.4382L32.1651 18.4455C32.7111 18.4673 33.2722 18.4896 33.8221 18.4774C35.1106 18.4486 36.4192 18.2304 37.8042 17.374C38.2527 17.0967 38.5889 17.0371 38.8249 17.0451C39.0666 17.0533 39.2842 17.1355 39.4836 17.264C39.6877 17.3955 39.8555 17.5652 39.9756 17.7112L39.9958 17.7361V19.3444H31.9803V18.4382Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);