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="M6 12.1944C6 8.77335 8.77335 6 12.1944 6C13.6163 6 14.9271 6.47988 15.9723 7.28507C17.0174 6.47988 18.3282 6 19.7501 6C21.3959 6 22.8916 6.64243 24.0001 7.68804C25.1085 6.64243 26.6042 6 28.2501 6C29.6719 6 30.9827 6.47987 32.0278 7.28502C33.0729 6.47987 34.3837 6 35.8055 6C39.2266 6 42 8.77335 42 12.1944C42 13.6129 41.5223 14.921 40.7206 15.9649C41.5261 17.1052 42 18.498 42 20C42 21.6057 41.4585 23.0861 40.5496 24.2668C41.454 25.3431 42 26.7332 42 28.2501C42 31.6712 39.2267 34.4445 35.8056 34.4445C34.3837 34.4445 33.073 33.9646 32.0278 33.1595C31.7715 33.357 31.4992 33.5349 31.2131 33.691C31.2052 33.7087 31.1965 33.7297 31.1871 33.7542C31.1244 33.9175 31.06 34.1596 31 34.4761V42H29V34.3846C29 34.3253 29.0053 34.2662 29.0158 34.2078C29.0897 33.7964 29.1865 33.3849 29.32 33.0372C29.387 32.8629 29.4739 32.6758 29.5906 32.5038C29.7032 32.3376 29.8827 32.1274 30.156 31.9877C30.5851 31.7683 30.9721 31.4768 31.3007 31.1288C31.4896 30.9287 31.7526 30.8153 32.0278 30.8153C32.303 30.8153 32.566 30.9287 32.7549 31.1288C33.521 31.9402 34.6036 32.4445 35.8056 32.4445C38.1221 32.4445 40 30.5666 40 28.2501C40 26.9746 39.432 25.833 38.5316 25.0621C38.3181 24.8793 38.1913 24.6151 38.1824 24.3341C38.1736 24.0531 38.2833 23.7814 38.4849 23.5855C39.4206 22.6758 40 21.4064 40 20C40 18.6918 39.4989 17.503 38.6765 16.6112C38.308 16.2117 38.3261 15.5909 38.7173 15.2136C39.5093 14.4495 40 13.3801 40 12.1944C40 9.95267 38.2413 8.12165 36.0284 8.00582V8.03547C35.0773 8.03547 34.0984 8.50674 33.4631 9.27834C32.8483 10.025 32.566 11.0356 32.9487 12.1838C33.1234 12.7078 32.8402 13.2741 32.3162 13.4487C31.7923 13.6234 31.226 13.3402 31.0513 12.8162C30.6133 11.5022 30.7216 10.2536 31.185 9.19783C30.4275 8.45575 29.3927 8 28.2501 8C26.8323 8 25.5785 8.70248 24.8177 9.78286C24.6304 10.0488 24.3254 10.2071 24.0001 10.2071C23.6747 10.2071 23.3697 10.0488 23.1824 9.78286C22.4216 8.70248 21.1678 8 19.7501 8C18.548 8 17.4654 8.50432 16.6994 9.31573C16.5105 9.51584 16.2474 9.62925 15.9722 9.62925C15.6971 9.62925 15.434 9.51584 15.2451 9.31573C14.4791 8.50432 13.3965 8 12.1944 8C9.87792 8 8 9.87792 8 12.1944C8 13.3965 8.50432 14.4791 9.31573 15.2451C9.51585 15.434 9.62926 15.6971 9.62926 15.9723C9.62926 16.2475 9.51585 16.5105 9.31574 16.6994C8.50433 17.4654 8.00001 18.548 8.00001 19.7501C8.00001 21.1678 8.70249 22.4216 9.78287 23.1824C10.0489 23.3697 10.2071 23.6747 10.2071 24.0001C10.2071 24.3254 10.0489 24.6304 9.78287 24.8177C8.70249 25.5785 8.00001 26.8323 8.00001 28.2501C8.00001 30.2334 9.3775 31.8974 11.2291 32.3331C11.6808 32.4394 12 32.8425 12 33.3065V35.3335C12 35.8245 12.398 36.2224 12.8889 36.2224C13.3798 36.2224 13.7778 35.8245 13.7778 35.3336V32.7576C13.7778 32.3995 13.9692 32.0688 14.2797 31.8904C15.5422 31.1653 16.3889 29.806 16.3889 28.2501C16.3889 26.8323 15.6864 25.5785 14.606 24.8177C14.5496 24.7779 14.498 24.7328 14.4517 24.6834C13.7663 24.2325 12.9467 23.9999 11.9999 23.9999C11.4476 23.9999 10.9999 23.5522 10.9999 22.9999C10.9999 22.4477 11.4477 21.9999 11.9999 21.9999C13.1309 21.9999 14.1881 22.2486 15.1211 22.7549C15.9043 21.9921 16.3889 20.9276 16.3889 19.7501C16.3889 18.548 15.8846 17.4654 15.0732 16.6994C14.8731 16.5105 14.7596 16.2474 14.7596 15.9722C14.7596 15.697 14.8731 15.434 15.0732 15.2451C15.1321 15.1894 15.1894 15.1321 15.2451 15.0732C15.434 14.873 15.697 14.7596 15.9722 14.7596C16.2474 14.7596 16.5105 14.873 16.6994 15.0732C17.4654 15.8846 18.548 16.3889 19.7501 16.3889C21.1678 16.3889 22.4216 15.6864 23.1824 14.606C23.3697 14.34 23.6747 14.1818 24.0001 14.1818C24.3254 14.1818 24.6304 14.34 24.8177 14.606C25.5785 15.6864 26.8323 16.3889 28.2501 16.3889C28.6583 16.3889 29.0512 16.3309 29.422 16.2233C29.808 16.1112 30.2237 16.2412 30.4771 16.5533C30.7305 16.8654 30.7723 17.2989 30.5834 17.6537C30.2113 18.3523 30 19.15 30 20C30 20.9044 30.2393 21.7506 30.6579 22.4812C31.797 23.1214 32.5429 23.7528 32.9825 24.4854C33.5016 25.3507 33.5007 26.2228 33.5 26.9235L33.5 26.9999C33.5 27.5522 33.0523 27.9999 32.5 27.9999C31.9477 27.9999 31.5 27.5522 31.5 26.9999C31.5 26.2131 31.4793 25.8674 31.2675 25.5144C31.0944 25.2259 30.736 24.8519 29.9177 24.3637C29.8417 24.3547 29.7659 24.3368 29.6918 24.3097C29.2435 24.1456 28.7584 24.0556 28.2501 24.0556C25.9335 24.0556 24.0556 25.9335 24.0556 28.2501C24.0556 29.8786 24.9835 31.2922 26.3441 31.9877C26.4499 32.0418 26.5448 32.1054 26.6294 32.1739C26.8638 32.3637 27 32.6493 27 32.951V42H25V33.5242C23.2347 32.4342 22.0556 30.4806 22.0556 28.2501C22.0556 24.829 24.829 22.0556 28.2501 22.0556L28.307 22.0559C28.1074 21.4054 28 20.7149 28 20C28 19.446 28.0645 18.9063 28.1866 18.3886C26.5658 18.3723 25.0943 17.733 24.0001 16.7008C22.8916 17.7465 21.3959 18.3889 19.7501 18.3889C19.2116 18.3889 18.689 18.3201 18.1908 18.1908C18.3201 18.689 18.3889 19.2116 18.3889 19.7501C18.3889 21.3959 17.7465 22.8916 16.7009 24.0001C17.7465 25.1085 18.3889 26.6042 18.3889 28.2501C18.3889 30.3371 17.3563 32.182 15.7778 33.3033V35.3336C15.7778 36.929 14.4844 38.2224 12.8889 38.2224C11.2934 38.2224 10 36.929 10 35.3335V34.0442C7.66233 33.1583 6.00001 30.8993 6.00001 28.2501C6.00001 26.6042 6.64245 25.1085 7.68805 24.0001C6.64245 22.8916 6.00001 21.3959 6.00001 19.7501C6.00001 18.3282 6.47989 17.0174 7.28508 15.9723C6.47989 14.9271 6 13.6163 6 12.1944Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);