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="M29.5844 22.8731C30.7438 22.8731 31.8763 22.5579 32.8338 21.9687C33.806 22.5568 34.9534 22.8651 36.1242 22.8529L39.8433 21.6331C40.8913 20.8544 41.6107 19.7749 41.8813 18.5754C42.1518 17.3758 41.9569 16.1289 41.3293 15.0433C40.7017 13.9577 39.6794 13.0993 38.4336 12.6118C38.1491 11.4505 37.4326 10.4117 36.4029 9.66789L32.7725 8.5228H32.3638C31.5563 7.46088 30.344 6.70341 28.9574 6.39438L21.1741 6C19.8803 6.09689 18.6603 6.58325 17.7105 7.38081C17.2617 7.28544 16.8023 7.23601 16.3412 7.23346C15.2247 7.23553 14.1327 7.52881 13.1971 8.0779C12.2615 8.62699 11.5222 9.40843 11.0685 10.3279L8.11115 12.216C7.37528 13.1146 6.97913 14.2026 6.98108 15.3194C6.9738 15.7865 7.04266 16.2519 7.18545 16.7009C6.40957 17.6083 5.99236 18.7234 6.00011 19.869C5.99826 21.1976 6.56142 22.4764 7.57375 23.4423C7.65545 24.3935 8.02424 25.3065 8.64022 26.0824C9.2562 26.8583 10.0959 27.4677 11.0685 27.8444C12.1891 28.4776 13.138 29.3292 13.8453 30.3364C14.5527 31.3437 15.0005 32.4811 15.1559 33.6649H22.7915V28.1391C22.7901 27.158 23.0938 26.1962 23.6682 25.3627C24.2425 24.5293 25.0645 23.8576 26.041 23.4238C26.5901 23.2345 26.7252 22.9796 26.8907 22.6673C27.001 22.4592 27.1249 22.2255 27.3937 21.9687C27.6273 22.1124 27.8083 22.2399 27.9652 22.3504C28.4518 22.6929 28.7077 22.8731 29.5844 22.8731ZM34.032 20.3449C34.5652 20.6333 35.18 20.807 35.8225 20.8411L38.8778 19.839C39.4357 19.3535 39.79 18.7515 39.9302 18.1296C40.0877 17.4314 39.9791 16.6979 39.5978 16.0384C39.2129 15.3726 38.5587 14.8026 37.7048 14.4685L36.738 14.0902L36.491 13.0818C36.3463 12.4911 35.9991 11.9204 35.4592 11.4615L32.4646 10.5169H31.3721L30.7718 9.72751C30.296 9.10182 29.5621 8.60824 28.6714 8.3766L21.21 7.99854C20.3583 8.08446 19.584 8.41337 18.9966 8.90662L18.2493 9.5341L17.2948 9.33129C16.9821 9.26484 16.6609 9.22992 16.3376 9.22763C15.5675 9.23033 14.828 9.43391 14.2094 9.79695C13.59 10.1604 13.1326 10.6586 12.862 11.207L12.6151 11.7075L9.48953 13.703C9.14804 14.2036 8.98012 14.7602 8.98108 15.3101L8.98111 15.3274L8.98084 15.3448C8.97696 15.5937 9.01352 15.844 9.09138 16.0889L9.42858 17.1491L8.70555 17.9948C8.22801 18.5533 7.99572 19.2069 8.00006 19.8496L8.00011 19.8577L8.0001 19.8659C7.99906 20.6151 8.31472 21.3791 8.95437 21.9894L9.50169 22.5116L9.56642 23.2653C9.61317 23.8096 9.82528 24.3527 10.2066 24.833C10.5897 25.3156 11.1317 25.7182 11.791 25.9736L11.9261 26.026L12.0524 26.0973C12.1986 26.1799 12.3426 26.2657 12.4843 26.3546L12.4781 26.3592C15.1968 28.0179 16.3504 30.4319 16.742 31.6663H17.354V24.3727L15.1507 22.4142L13.6552 23.9098C13.2647 24.3003 12.6315 24.3003 12.241 23.9098C11.8505 23.5193 11.8505 22.8861 12.241 22.4956L14.0328 20.7037L13.4952 17.7468L11.0593 16.5289C10.5653 16.2819 10.3651 15.6812 10.6121 15.1872C10.8591 14.6933 11.4598 14.493 11.9538 14.74L14.3306 15.9285L17.242 14.0758L16.3365 11.6609C16.1425 11.1438 16.4046 10.5674 16.9217 10.3734C17.4388 10.1795 18.0152 10.4415 18.2091 10.9586L19.1822 13.5535H20.2587L20.7729 12.525L19.9576 10.6225C19.74 10.1149 19.9752 9.527 20.4828 9.30944C20.9904 9.09189 21.5783 9.32704 21.7959 9.83467L22.498 11.4729L25.286 11.9798L25.2975 11.9705L27.0994 10.5289C27.5307 10.1839 28.16 10.2538 28.505 10.6851C28.85 11.1163 28.7801 11.7456 28.3488 12.0906L27.1443 13.0543L28.4794 14.7709L28.9921 13.7457C29.1614 13.4069 29.5077 13.1929 29.8865 13.1929H32.0488C32.6011 13.1929 33.0488 13.6406 33.0488 14.1929C33.0488 14.7452 32.6011 15.1929 32.0488 15.1929H30.5045L30.2364 15.7291L31.9054 16.1C31.9852 16.1178 32.0625 16.1452 32.1357 16.1818L33.5772 16.9026C34.0712 17.1495 34.2714 17.7502 34.0245 18.2442C33.7775 18.7382 33.1768 18.9384 32.6828 18.6914L31.3514 18.0257L28.228 17.3316C28.0009 17.2811 27.7984 17.153 27.6556 16.9694L25.3674 14.0274L22.5941 13.5232C22.5539 13.5563 22.5107 13.5865 22.4648 13.6135L21.8767 14.7895V15.3552H23.0391C23.1943 15.3552 23.3474 15.3914 23.4863 15.4608L26.3694 16.9024C26.8634 17.1494 27.0636 17.75 26.8166 18.244C26.5696 18.738 25.9689 18.9382 25.475 18.6912L22.803 17.3552H21.8767V18.8782C21.8767 19.4304 21.429 19.8782 20.8767 19.8782C20.3244 19.8782 19.8767 19.4304 19.8767 18.8782V16.3629L19.8767 16.3552L19.8767 16.3476V15.5535H18.6452L15.4938 17.5589L16.0326 20.5223L19.0184 23.1762C19.2318 23.366 19.354 23.638 19.354 23.9236V31.6663H20.7916V28.1003C20.7916 25.3985 22.3008 23.7402 23.1251 22.9551C23.7844 22.327 24.7748 21.7975 25.1876 21.6113C25.2696 21.4277 25.5493 20.9512 26.0118 20.5137C26.4743 20.0762 26.9545 19.6205 27.1368 19.4473C28.3747 20.1548 29.336 20.8652 29.336 20.8652C29.336 20.8652 30.6172 20.7949 31.1993 20.5606C31.6649 20.3731 32.4766 19.8522 32.8243 19.6152L34.032 20.3449Z" fill="black"/>
<path d="M15 38H23V36H15V38Z" fill="black"/>
<path d="M23 42H15V40H23V42Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);