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 19C20.2138 19 21.2364 19.6583 21.9213 20.5716C22.6061 21.4845 23 22.7 23 24C23 25.3 22.6061 26.5155 21.9213 27.4284C21.2364 28.3417 20.2138 29 19 29C17.7862 29 16.7636 28.3417 16.0787 27.4284C15.3939 26.5155 15 25.3 15 24C15 22.7 15.3939 21.4845 16.0787 20.5716C16.7636 19.6583 17.7862 19 19 19ZM21 24C21 23.0909 20.7224 22.3063 20.3213 21.7716C19.9205 21.2371 19.4431 21 19 21C18.5569 21 18.0795 21.2371 17.6787 21.7716C17.2776 22.3063 17 23.0909 17 24C17 24.9091 17.2776 25.6937 17.6787 26.2284C18.0795 26.7629 18.5569 27 19 27C19.4431 27 19.9205 26.7629 20.3213 26.2284C20.7224 25.6937 21 24.9091 21 24Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M26.0787 20.5716C26.7636 19.6583 27.7862 19 29 19C30.2138 19 31.2364 19.6583 31.9213 20.5716C32.6061 21.4845 33 22.7 33 24C33 25.3 32.6061 26.5155 31.9213 27.4284C31.2364 28.3417 30.2138 29 29 29C27.7862 29 26.7636 28.3417 26.0787 27.4284C25.3939 26.5155 25 25.3 25 24C25 22.7 25.3939 21.4845 26.0787 20.5716ZM27.6787 21.7716C27.2776 22.3063 27 23.0909 27 24C27 24.9091 27.2776 25.6937 27.6787 26.2284C28.0795 26.7629 28.5569 27 29 27C29.4431 27 29.9205 26.7629 30.3213 26.2284C30.7224 25.6937 31 24.9091 31 24C31 23.0909 30.7224 22.3063 30.3213 21.7716C29.9205 21.2371 29.4431 21 29 21C28.5569 21 28.0795 21.2371 27.6787 21.7716Z" fill="black"/>
<path d="M24 29L23.9818 29.0084C23.7321 29.1255 21 30.4486 21 32.2759C21 33.1061 21.5794 33.8805 22.3993 33.9874C22.4627 33.9957 22.5276 34 22.5937 34C23.233 34 23.7073 33.6278 24 33.0998C24.2928 33.6278 24.7671 34 25.4062 34C25.4724 34 25.5373 33.9957 25.6007 33.9874C26.4205 33.8805 27 33.1062 27 32.2759C27 30.369 24.0178 29.0078 24.0178 29.0078L24 29Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.9693 7.55747C10.3617 9.822 9 12.9793 9 16.5C9 19.9313 9.79883 22.0837 10.6056 23.6972C10.7892 24.0644 10.9724 24.4022 11.1375 24.7065L11.1717 24.7696C11.349 25.0966 11.5003 25.3782 11.6275 25.6468C11.8792 26.1781 12 26.5857 12 27V30.9992C12 31.5515 12.4477 32 13 32L13.0157 32C13.0295 32.5428 13.0556 33.2704 13.1047 34.0863C13.2082 35.8049 13.4178 37.9883 13.8559 39.6552C14.0237 40.2938 14.4243 40.8384 14.9753 41.1919C16.2644 42.0189 19.7777 44 24 44C28.2223 44 31.7356 42.0189 33.0247 41.1919C33.5757 40.8384 33.9763 40.2938 34.1441 39.6552C34.5822 37.9883 34.7918 35.8049 34.8953 34.0863C34.9444 33.2704 34.9705 32.5428 34.9843 32L35 32C35.5523 32 36 31.5515 36 30.9992V27C36 26.5857 36.1208 26.1781 36.3725 25.6468C36.4997 25.3782 36.651 25.0966 36.8283 24.7696L36.8625 24.7065C37.0276 24.4022 37.2109 24.0643 37.3944 23.6972C38.2012 22.0837 39 19.9313 39 16.5C39 12.9793 37.6383 9.822 35.0307 7.55747C32.4332 5.30179 28.6812 4 24 4C19.3188 4 15.5668 5.30179 12.9693 7.55747ZM32.6164 32.5382C32.7167 32.4701 32.8348 32.4036 32.9736 32.3418C32.9587 32.8049 32.9354 33.3606 32.8989 33.9661C32.7966 35.665 32.5948 37.6821 32.2098 39.1468C32.1708 39.295 32.0786 39.4227 31.9448 39.5085C30.7664 40.2645 27.6482 42 24 42C20.3518 42 17.2336 40.2645 16.0552 39.5085C15.9214 39.4227 15.8292 39.295 15.7902 39.1468C15.4052 37.6821 15.2034 35.665 15.1011 33.9661C15.0646 33.3606 15.0413 32.8049 15.0264 32.3418C15.1652 32.4036 15.2833 32.4701 15.3836 32.5382C15.7823 32.809 15.9892 33.1635 16.0954 33.567C16.2073 33.9921 16.2028 34.4631 16.1546 34.8974C16.1309 35.1101 16.0985 35.301 16.069 35.4672L16.0613 35.5108C16.0496 35.5764 16.0373 35.6455 16.028 35.7038C16.0192 35.759 16 35.8793 16 36C16 36.8549 16.7238 37.6113 17.8492 38.1037C19.0297 38.6201 20.9369 39 24 39C27.0631 39 28.9703 38.6201 30.1508 38.1037C31.2762 37.6113 32 36.8549 32 36C32 35.8793 31.9808 35.759 31.972 35.7038C31.9627 35.6455 31.9504 35.5764 31.9387 35.5108L31.931 35.4672C31.9015 35.301 31.8691 35.1101 31.8454 34.8974C31.7972 34.4631 31.7927 33.9921 31.9046 33.567C32.0108 33.1635 32.2177 32.809 32.6164 32.5382ZM29.3492 36.2713C28.5297 36.6299 26.9369 37 24 37C21.0631 37 19.4703 36.6299 18.6508 36.2713C18.2723 36.1057 18.0995 35.9662 18.0253 35.8899L18.0384 35.816C18.0695 35.6404 18.1113 35.3977 18.1423 35.1182C18.2034 34.5682 18.2302 33.8204 18.0296 33.058C17.8233 32.274 17.374 31.4723 16.5071 30.8836C15.8566 30.4419 15.0275 30.1586 14 30.0501V27C14 26.1643 13.7458 25.4469 13.435 24.7907C13.281 24.4655 13.1042 24.1378 12.9299 23.8163L12.8984 23.7582C12.731 23.4496 12.5625 23.139 12.3944 22.8028C11.7012 21.4163 11 19.5687 11 16.5C11 13.5207 12.1383 10.928 14.2807 9.06753C16.4332 7.19821 19.6812 6 24 6C28.3188 6 31.5668 7.19821 33.7193 9.06753C35.8617 10.928 37 13.5207 37 16.5C37 19.5687 36.2988 21.4163 35.6056 22.8028C35.4375 23.139 35.269 23.4496 35.1016 23.7582L35.0701 23.8163C34.8958 24.1378 34.719 24.4655 34.565 24.7907C34.2542 25.4469 34 26.1643 34 27V30.0501C32.9725 30.1586 32.1434 30.4419 31.4929 30.8836C30.626 31.4723 30.1767 32.274 29.9704 33.058C29.7698 33.8204 29.7966 34.5682 29.8577 35.1182C29.8887 35.3977 29.9305 35.6404 29.9616 35.816L29.9747 35.8899C29.9005 35.9662 29.7277 36.1057 29.3492 36.2713Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);