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="M33.7698 6.7752H35.1839C36.7855 6.7752 38.0839 8.06595 38.0839 9.65817V18.7246C38.0839 20.3168 36.7855 21.6076 35.1839 21.6076H34.364C34.2714 22.0613 33.8678 22.4028 33.3841 22.4028H32.5839L32.584 26.5779C32.584 27.676 31.6885 28.5661 30.584 28.5661H24.4142L22.0033 30.9628L22.0066 30.9661L20.9605 32.0061L29.8488 32.0064L32.533 29.3379H36.5261C37.3351 29.3379 38.0637 29.6803 38.5732 30.2272H39.2106C40.7512 30.2272 42.0001 31.4688 42.0001 33.0003V39.2267C42.0001 40.7582 40.7512 41.9998 39.2106 41.9998H37.4211L37.3802 41.9996H32.9473C31.6055 41.9996 30.4312 41.2865 29.7871 40.2208H16.3814C14.6924 40.2208 13.0726 39.5537 11.8783 38.3664L9.21179 35.7156L8.1705 36.8001C7.78916 37.1972 7.15617 37.2118 6.75667 36.8327C6.35717 36.4536 6.34245 35.8244 6.72379 35.4272L7.79719 34.3093L5.99988 32.5226V19.1928C5.99988 17.8168 7.7562 17.2257 8.59698 18.3188L15.0705 26.7344L16.1185 25.6429C16.4999 25.2458 17.1329 25.2311 17.5324 25.6102C17.9319 25.9893 17.9466 26.6186 17.5652 27.0158L16.3003 28.3332L18.6951 31.4464L19.2962 30.8488L19.2928 30.8456L23 27.1602C23.375 26.7873 23.8837 26.5779 24.4142 26.5779H30.584L30.5839 22.4028H29.7841C29.3003 22.4028 28.8967 22.0613 28.8041 21.6076H27.9839C26.3822 21.6076 25.0839 20.3168 25.0839 18.7246V9.65817C25.0839 8.06594 26.3822 6.7752 27.9839 6.7752H29.398C29.989 6.29629 30.7449 5.99976 31.5839 5.99976C32.4229 5.99976 33.1788 6.29629 33.7698 6.7752ZM32.8832 8.76346H35.1839C35.6809 8.76346 36.0839 9.16403 36.0839 9.65817V14.6002C35.9941 14.5629 35.9008 14.5267 35.8041 14.4921C34.6386 14.0749 33.0039 13.9028 31.1472 14.7994C29.6817 15.5071 28.4406 15.7832 27.5837 15.8854C27.3988 15.9075 27.2317 15.9214 27.0839 15.9299V9.65817C27.0839 9.16403 27.4868 8.76346 27.9839 8.76346H30.2846C30.5439 8.29989 31.0287 7.98801 31.5839 7.98801C32.1391 7.98801 32.6239 8.29989 32.8832 8.76346ZM27.0839 17.9207V18.7246C27.0839 19.2187 27.4868 19.6193 27.9839 19.6193H35.1839C35.6809 19.6193 36.0839 19.2187 36.0839 18.7246V16.8586C36.0642 16.8446 36.0432 16.8301 36.021 16.8151C35.8146 16.6756 35.5097 16.4999 35.1267 16.3628C34.3797 16.0955 33.3143 15.9633 32.0211 16.5878C30.3366 17.4012 28.8777 17.7336 27.822 17.8595C27.5474 17.8922 27.3003 17.911 27.0839 17.9207ZM14.9024 29.789L17.2683 32.8647L16.601 33.5282L14.9999 35.0279H17.8283L18.8283 34.1258L19.0072 33.9479C19.1735 33.9786 19.3437 33.9944 19.5158 33.9944L30.6772 33.9946L33.3614 31.3262H36.5261C36.9622 31.3262 37.3156 31.6776 37.3156 32.111V34.6748H36.5261C36.0901 34.6748 35.7367 34.3234 35.7367 33.89V33.0005H33.7367V33.89C33.7367 35.4215 34.9856 36.6631 36.5261 36.6631H39.3156V32.2223C39.702 32.2734 40.0001 32.6022 40.0001 33.0003V39.2267C40.0001 39.6601 39.6466 40.0115 39.2106 40.0115H37.4211L37.3904 40.0113C35.9802 39.995 34.8422 38.8535 34.8422 37.4477V36.4012H32.8422V37.4477C32.8422 38.3985 33.1354 39.2812 33.6368 40.0113H32.9473C32.0171 40.0113 31.2631 39.2617 31.2631 38.337H30.263V38.2325H16.3814C15.2229 38.2325 14.1117 37.775 13.2925 36.9605L10.5931 34.277L14.9024 29.789ZM13.6726 28.1903L9.17852 32.8707L7.99988 31.699V20.8156L13.6726 28.1903Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);