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="M20 31C20 28.7909 21.7909 27 24 27C26.2091 27 28 28.7909 28 31V33C28 35.2091 26.2091 37 24 37C21.7909 37 20 35.2091 20 33V31ZM24 29C22.8954 29 22 29.8954 22 31V33C22 34.1046 22.8954 35 24 35C25.1046 35 26 34.1046 26 33V31C26 29.8954 25.1046 29 24 29Z" fill="black"/>
<path d="M31.7091 16.5165C29.9577 15.5486 28.4126 14.4866 27.6812 13.8061L26.3188 15.2703C27.2245 16.1129 28.9326 17.2671 30.7418 18.2669C32.5433 19.2625 34.5934 20.1882 36.1917 20.4834L36.5549 18.5166C35.2863 18.2823 33.4683 17.4886 31.7091 16.5165Z" fill="black"/>
<path d="M20.6922 13.8061C19.9607 14.4866 18.4156 15.5486 16.6642 16.5165C14.9051 17.4886 13.087 18.2823 11.8184 18.5166L12.1816 20.4834C13.78 20.1882 15.83 19.2625 17.6316 18.2669C19.4408 17.2671 21.1488 16.1129 22.0545 15.2703L20.6922 13.8061Z" fill="black"/>
<path d="M22.2702 23.4637C22.3402 23.0298 22.1534 22.6221 21.8879 22.2995C21.6173 21.9708 21.2228 21.6743 20.7465 21.4314C19.7901 20.9437 18.432 20.6346 16.8318 20.7478C15.1973 20.8634 14.026 21.5045 13.333 22.3166C12.6614 23.1037 12.4022 24.1194 12.7827 24.8929C12.8471 25.024 12.9657 25.1203 13.1071 25.1566C13.2486 25.1928 13.3989 25.1654 13.5184 25.0816C15.9615 23.368 18.888 22.9962 21.626 23.8608C21.7645 23.9046 21.9153 23.8859 22.0389 23.8097C22.1626 23.7334 22.247 23.6072 22.2702 23.4637Z" fill="black"/>
<path d="M25.7392 23.5215C25.6709 23.0987 25.8532 22.7032 26.1088 22.3927C26.3694 22.0762 26.7484 21.7916 27.2048 21.5589C28.121 21.0916 29.4207 20.7961 30.9507 20.9043C32.515 21.015 33.6383 21.6288 34.3038 22.4088C34.9479 23.1636 35.2002 24.1422 34.8318 24.8912C34.7674 25.0222 34.6488 25.1186 34.5074 25.1548C34.3659 25.1911 34.2156 25.1637 34.0961 25.0799C31.772 23.4498 28.9883 23.0961 26.3833 23.9186C26.2448 23.9624 26.0941 23.9437 25.9704 23.8675C25.8467 23.7912 25.7623 23.665 25.7392 23.5215Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.0466 38.2075C10.1912 38.4171 9.44802 38.6539 8.85209 38.9181C8.39904 39.1189 7.97523 39.3596 7.64949 39.6581C7.32564 39.9548 7 40.4045 7 41C7 41.5955 7.32564 42.0452 7.64949 42.3419C7.97523 42.6404 8.39904 42.8811 8.85209 43.0819C9.76509 43.4867 11.0239 43.827 12.502 44.1042C15.4747 44.6616 19.5393 45 24 45C28.4607 45 32.5253 44.6616 35.498 44.1042C36.9761 43.827 38.2349 43.4867 39.1479 43.0819C39.601 42.8811 40.0248 42.6404 40.3505 42.3419C40.6744 42.0452 41 41.5955 41 41C41 40.4045 40.6744 39.9548 40.3505 39.6581C40.0248 39.3596 39.601 39.1189 39.1479 38.9181C38.559 38.657 37.8263 38.4228 36.9837 38.2149C37.0061 37.6148 37.0052 37.0334 36.9823 36.4684C40.0899 33.2335 42 28.8398 42 24C42 14.0589 33.9411 6 24 6C14.0589 6 6 14.0589 6 24C6 28.831 7.90321 33.2176 11.0007 36.4507C10.9968 37.0198 11.0122 37.6046 11.0466 38.2075ZM24 40C26.287 40 28.4619 39.5202 30.4295 38.6557C30.7653 36.7372 30.7759 35.1076 30.5296 33.6084C30.2363 31.8229 29.5694 30.1657 28.5696 28.3745C28.1761 27.6697 27.9751 27.0012 28.0025 26.3723C28.031 25.7162 28.3045 25.1987 28.6783 24.8273C29.0332 24.4747 29.4545 24.2746 29.7924 24.1622C30.1259 24.0512 30.4556 24 30.697 24C31.7937 24 32.5652 24.5568 33.0583 25.1072C33.4634 25.5592 33.7396 26.0803 33.8687 26.324C33.8892 26.3625 33.9059 26.3942 33.9189 26.4174C35.2275 28.7616 36.2149 31.0941 36.6888 33.7478C38.7653 31.0488 40 27.6686 40 24C40 15.1634 32.8366 8 24 8C15.1634 8 8 15.1634 8 24C8 27.6031 9.19102 30.9281 11.2008 33.6027C11.5607 31.0279 12.4114 28.7256 13.8073 26.3916C13.8209 26.3689 13.8388 26.3362 13.8614 26.2951C14.1408 25.7873 15.1241 24 17.1819 24C17.4236 24 17.7627 24.0483 18.1094 24.156C18.4582 24.2644 18.8971 24.458 19.2695 24.8035C19.6629 25.1683 19.9657 25.6912 19.9973 26.3692C20.0275 27.0163 19.8056 27.6953 19.3839 28.4004C18.3358 30.1528 17.7567 31.7838 17.5693 33.5517C17.4053 35.0988 17.5366 36.7948 17.9653 38.8229C19.8276 39.5818 21.8649 40 24 40ZM17.7044 40.8683C17.6248 40.9138 17.5376 40.949 17.4441 40.9717C16.9075 41.1022 16.3667 40.7729 16.2362 40.2362C15.6079 37.652 15.359 35.4292 15.5804 33.3409C15.8031 31.2401 16.4953 29.3338 17.6674 27.3738C17.9689 26.8698 18.0051 26.5833 17.9995 26.4623C17.9953 26.3723 17.9684 26.3245 17.9095 26.2699C17.8297 26.1958 17.6937 26.1211 17.5162 26.066C17.4329 26.0402 17.3536 26.0227 17.2877 26.0121C17.2229 26.0016 17.1859 26.0001 17.1819 26C16.3643 26 15.9597 26.6827 15.5936 27.3006C15.5877 27.3105 15.5819 27.3204 15.576 27.3302C15.5585 27.3597 15.5411 27.3891 15.5237 27.4181C13.3839 30.996 12.6519 34.458 13.1493 39.4317C13.2043 39.9813 12.8034 40.4713 12.2538 40.5263C11.9159 40.5601 11.6004 40.4214 11.3948 40.1819C10.6801 40.3621 10.0991 40.553 9.66262 40.7465C9.45104 40.8403 9.29287 40.9263 9.17822 41C9.29287 41.0737 9.45104 41.1597 9.66262 41.2535C10.3689 41.5666 11.4533 41.8727 12.8706 42.1385C15.6887 42.6669 19.6241 43 24 43C28.3759 43 32.3113 42.6669 35.1294 42.1385C36.5467 41.8727 37.6311 41.5666 38.3374 41.2535C38.549 41.1597 38.7071 41.0737 38.8218 41C38.7071 40.9263 38.549 40.8403 38.3374 40.7465C37.9092 40.5566 37.3419 40.3694 36.6458 40.1921C36.4416 40.4237 36.1333 40.5578 35.8023 40.5269C35.2524 40.4756 34.8483 39.9882 34.8996 39.4383C35.3577 34.5309 34.2143 31.0499 32.1726 27.3923C32.1411 27.3359 32.1101 27.2783 32.0786 27.2201C31.9407 26.9644 31.7952 26.6945 31.5688 26.4418C31.3148 26.1583 31.0443 26 30.697 26C30.6896 26.0006 30.5758 26.0093 30.4239 26.0599C30.2706 26.1109 30.1553 26.1792 30.088 26.246C30.0396 26.2941 30.0054 26.3473 30.0006 26.4592C29.9945 26.5983 30.0344 26.8953 30.3159 27.3997C31.3883 29.3209 32.161 31.201 32.5032 33.2842C32.8458 35.3697 32.7479 37.6021 32.1535 40.2213C32.0313 40.7599 31.4956 41.0974 30.957 40.9752C30.8002 40.9396 30.6605 40.869 30.5441 40.7734C28.5158 41.5654 26.3087 42 24 42C21.7853 42 19.6639 41.6 17.7044 40.8683ZM39.0438 41.1785C39.0447 41.1797 39.0447 41.1799 39.0447 41.1799L39.0427 41.1771L39.0438 41.1785Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);