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="M38.7071 8.29289C39.0977 8.68342 39.0977 9.31658 38.7071 9.70711L28.6718 19.7424C29.4786 19.7491 30.3161 19.7381 31.2062 19.7264C31.9817 19.7162 32.797 19.7055 33.6667 19.7055C36.0499 19.7055 37.7035 20.6423 38.7339 22.1322C39.7192 23.5568 40.0586 25.3762 40.1243 27.0522C40.1906 28.7474 39.9809 30.4216 39.7605 31.6571C39.6497 32.2785 39.5347 32.797 39.4469 33.1622C39.403 33.3449 39.3657 33.4897 39.3391 33.5902L39.3334 33.6116V39C39.3334 39.5523 38.8856 40 38.3334 40H34C33.4477 40 33 39.5523 33 39C33 38.153 33.1278 37.5029 33.3691 36.9823C33.6176 36.4459 33.9498 36.1297 34.1927 35.919C34.2562 35.8639 34.3038 35.8223 34.3393 35.7912C32.621 34.8023 31.612 33.9739 30.8167 32.9182C30.3934 32.3563 30.0488 31.7541 29.6933 31.0868C29.5564 30.8299 29.4209 30.5693 29.2785 30.2952C29.1444 30.0374 29.004 29.7674 28.8505 29.4774L22 31.7474V37.2741C22 37.9123 21.8989 38.5743 21.479 39.104C21.0446 39.6521 20.4261 39.8643 19.8488 39.9587C19.2797 40.0517 18.585 40.0552 17.8203 40.0432C17.6659 40.0408 17.5073 40.0377 17.3438 40.0343C17.2458 40.0322 17.1459 40.03 17.0441 40.0278C16.4407 40.0146 15.7698 40 15 40C14.5899 40 14.1555 39.823 13.8916 39.4047C13.673 39.0582 13.6634 38.6855 13.6832 38.4482C13.7241 37.9572 13.9438 37.4332 14.1987 36.9961C14.4642 36.541 14.8317 36.0707 15.2721 35.702C15.6846 35.3567 16.254 35.0246 16.9249 35.0013L16.9251 34.9982C16.9331 34.8669 16.928 34.6899 16.9068 34.4511C16.8843 34.1983 16.8413 33.8777 16.7912 33.5054C16.6887 32.7429 16.5571 31.7637 16.5142 30.7068C15.6004 30.3147 14.8705 29.8775 14.3247 29.3245C13.6238 28.6142 13.3019 27.792 13.1758 26.8615C13.0562 25.9801 13.1071 24.9477 13.1735 23.7926L13.1932 23.4545C13.2408 22.6388 13.2942 21.7258 13.3191 20.6816C12.2325 20.9557 11.0353 21 10 21C7.97983 21 7.00077 19.2878 6.56298 18.1131C6.32621 17.4778 6.18796 16.8545 6.10856 16.3979C6.06848 16.1674 6.0425 15.9742 6.02634 15.8363C6.01825 15.7672 6.01259 15.7117 6.00884 15.672L6.00458 15.6245L6.0034 15.61L6.00303 15.6052L6.00289 15.6035C6.00289 15.6035 6.00279 15.6021 7.00002 15.5278L6.00279 15.6021C5.96894 15.148 6.24618 14.7284 6.67714 14.5813L7.13078 14.4263C7.41072 14.3305 7.79657 14.1984 8.22024 14.0528C8.84862 13.837 9.55741 13.5926 10.1271 13.3937C10.2938 12.8791 10.6033 12.3913 10.9291 11.993C11.4417 11.3662 12.1504 10.7681 12.9514 10.3935C13.7506 10.0197 14.7431 9.82646 15.7205 10.205C16.7121 10.589 17.4576 11.4713 17.9375 12.7633C18.7078 14.8375 19.5682 16.26 20.5091 17.2495C21.4393 18.2277 22.4854 18.8219 23.6984 19.187C24.3932 19.396 25.1462 19.531 25.9702 19.6156L37.2929 8.29289C37.6834 7.90237 38.3166 7.90237 38.7071 8.29289ZM23.1221 21.1021C23.4778 21.2091 23.8412 21.2988 24.2121 21.3737L22.0858 23.5H15.194C15.2549 22.4566 15.3262 21.2074 15.3329 19.7231C15.5676 19.5289 15.7831 19.3034 15.9701 19.0414C16.4324 18.3938 16.6667 17.5996 16.6667 16.6752H14.6667C14.6667 17.2508 14.5259 17.6222 14.3424 17.8793C14.1539 18.1434 13.8643 18.3645 13.4453 18.541C12.5666 18.911 11.3341 19 10 19C9.35355 19 8.8326 18.476 8.43707 17.4147C8.28005 16.9934 8.17495 16.5629 8.10659 16.2062C8.33231 16.1289 8.5931 16.0395 8.87004 15.9443C9.71791 15.6531 10.7223 15.3064 11.334 15.0896C11.7332 14.9482 12 14.5706 12 14.147C12 14.0626 12.0949 13.7267 12.4772 13.2592C12.8291 12.8289 13.308 12.4346 13.7986 12.2052C14.2911 11.9748 14.6944 11.9524 14.9983 12.07C15.2879 12.1822 15.7091 12.508 16.0626 13.4597C16.8948 15.7003 17.8774 17.3843 19.0598 18.6277C20.253 19.8825 21.6108 20.6473 23.1221 21.1021ZM20.6855 30.0761L21.5 29.8062V25.5H15.1042C15.1001 25.9197 15.1148 26.2768 15.1576 26.5927C15.2398 27.1984 15.418 27.585 15.7482 27.9196C16.1131 28.2893 16.7349 28.6677 17.8532 29.0898C18.2424 29.2367 18.5 29.6093 18.5 30.0253C18.5 31.2058 18.6317 32.1728 18.7505 33.0462C18.8087 33.4733 18.8638 33.878 18.8989 34.2743C18.9443 34.786 18.9729 35.4441 18.7208 35.9912C18.5759 36.3058 18.3398 36.5846 17.9981 36.77C17.6741 36.9457 17.3241 37 17 37C16.9536 37 16.8002 37.0311 16.556 37.2355C16.3246 37.4293 16.0983 37.709 15.9263 38.0039L15.9248 38.0065C16.3536 38.0122 16.7514 38.0209 17.1146 38.0288C17.3789 38.0346 17.6253 38.0399 17.8516 38.0435C18.6338 38.0557 19.1578 38.0451 19.5262 37.9849C19.7022 37.9561 19.8034 37.9216 19.8587 37.8952C19.8846 37.8829 19.8979 37.8736 19.9035 37.8693C19.9042 37.8688 19.9048 37.8683 19.9053 37.8679C19.9093 37.8645 19.9116 37.8617 19.9116 37.8617C19.9137 37.8591 20 37.7489 20 37.2741V31.0253C20 30.5942 20.2763 30.2117 20.6855 30.0761ZM26.7314 21.6828L23.5 24.9142V29.1434L29.0188 27.3147C29.4773 27.1627 29.9789 27.3603 30.2107 27.784C30.5377 28.3818 30.8228 28.93 31.0725 29.4099C31.2118 29.6777 31.3401 29.9244 31.4584 30.1464C31.8012 30.7898 32.0871 31.2807 32.4141 31.7148C33.0435 32.5502 33.8951 33.2697 35.8156 34.327C36.0565 34.4596 36.2321 34.6855 36.3012 34.9516C36.4511 35.5285 36.4785 36.0863 36.227 36.5996C36.036 36.9892 35.6999 37.2669 35.5511 37.3897C35.5463 37.3937 35.5414 37.3978 35.537 37.4014C35.5238 37.4123 35.5125 37.4218 35.5033 37.4297C35.3524 37.5607 35.2606 37.6573 35.1836 37.8233C35.1618 37.8705 35.1389 37.9285 35.1169 38H37.3334V33.696L34.0915 26.6461L35.9086 25.8106L37.9549 30.2605C38.0831 29.3014 38.1681 28.2104 38.1258 27.1304C38.0664 25.6135 37.76 24.24 37.089 23.2699C36.4632 22.3651 35.4501 21.7055 33.6667 21.7055C32.8609 21.7055 32.0664 21.7157 31.2944 21.7256C30.124 21.7406 29.0049 21.755 27.9755 21.7322C27.5544 21.7229 27.1396 21.7074 26.7314 21.6828Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);