build method

  1. @override
Widget build(
  1. BuildContext context
)
override

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:

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="M14.75 7.22898C14.75 5.95534 15.916 5.02392 17.1433 5.25877C22.3412 6.25336 25.6585 6.26502 30.8524 5.26223C32.0804 5.02515 33.25 5.95614 33.25 7.23214V7.64608L34 7.64608C35.1046 7.64608 36 8.54151 36 9.64608V11.174C36 12.2786 35.1046 13.174 34 13.174H33.25V14.0524C33.25 14.9569 32.6396 15.7578 31.7522 15.9835C28.8981 16.7096 26.5277 17.0843 24.1021 17.0834C21.6784 17.0826 19.2457 16.7068 16.2679 15.9802C15.3716 15.7615 14.75 14.9566 14.75 14.0435V13.174H14C12.8954 13.174 12 12.2786 12 11.174V9.64608C12 8.54151 12.8954 7.64608 14 7.64608H14.75V7.22898ZM16.75 7.22898C16.75 7.22908 16.75 7.22888 16.75 7.22898V7.64608C16.75 8.75065 15.8546 9.64608 14.75 9.64608H14V11.174H14.75C15.8546 11.174 16.75 12.0695 16.75 13.174V14.0392C19.6356 14.7428 21.897 15.0827 24.1028 15.0834C26.3061 15.0842 28.5001 14.7467 31.25 14.0476V13.174C31.25 12.0695 32.1454 11.174 33.25 11.174H34V9.64608H33.25C32.1454 9.64608 31.25 8.75065 31.25 7.64608V7.23214C31.25 7.23203 31.25 7.23224 31.25 7.23214C31.2495 7.23162 31.2488 7.23064 31.2479 7.22989C31.2449 7.22746 31.2419 7.22617 31.2401 7.22567L31.2377 7.22533C31.237 7.2253 31.2351 7.22529 31.2315 7.22597C25.7838 8.27778 22.2102 8.26457 16.7675 7.22313C16.764 7.22247 16.7622 7.22249 16.7615 7.22252L16.7594 7.22283C16.7577 7.22328 16.7548 7.22451 16.752 7.22687C16.7511 7.22757 16.7505 7.22849 16.75 7.22898Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M19 9.00011C19.5523 9.00011 20 9.44783 20 10.0001V12.0001C20 12.5524 19.5523 13.0001 19 13.0001C18.4477 13.0001 18 12.5524 18 12.0001V10.0001C18 9.44783 18.4477 9.00011 19 9.00011Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.75 20.229C14.75 18.9553 15.916 18.0239 17.1433 18.2588C22.3412 19.2534 25.6585 19.265 30.8524 18.2622C32.0804 18.0251 33.25 18.9561 33.25 20.2321V20.6461L34 20.6461C35.1046 20.6461 36 21.5415 36 22.6461V24.174C36 25.2786 35.1046 26.174 34 26.174H33.25V27.0524C33.25 27.9569 32.6396 28.7578 31.7522 28.9835C28.8981 29.7096 26.5277 30.0843 24.1021 30.0834C21.6784 30.0826 19.2457 29.7068 16.2679 28.9802C15.3716 28.7615 14.75 27.9566 14.75 27.0435V26.174H14C12.8954 26.174 12 25.2786 12 24.174V22.6461C12 21.5415 12.8954 20.6461 14 20.6461H14.75V20.229ZM16.75 20.229C16.75 20.2291 16.75 20.2289 16.75 20.229V20.6461C16.75 21.7507 15.8546 22.6461 14.75 22.6461H14V24.174H14.75C15.8546 24.174 16.75 25.0695 16.75 26.174V27.0392C19.6356 27.7428 21.897 28.0827 24.1028 28.0834C26.3061 28.0842 28.5001 27.7467 31.25 27.0476V26.174C31.25 25.0695 32.1454 24.174 33.25 24.174H34V22.6461H33.25C32.1454 22.6461 31.25 21.7507 31.25 20.6461V20.2321C31.25 20.232 31.25 20.2322 31.25 20.2321C31.2495 20.2316 31.2488 20.2306 31.2479 20.2299C31.2449 20.2275 31.2419 20.2262 31.2401 20.2257L31.2377 20.2253C31.237 20.2253 31.2351 20.2253 31.2315 20.226C25.7838 21.2778 22.2102 21.2646 16.7675 20.2231C16.764 20.2225 16.7622 20.2225 16.7615 20.2225L16.7594 20.2228C16.7577 20.2233 16.7548 20.2245 16.752 20.2269C16.7511 20.2276 16.7505 20.2285 16.75 20.229Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M19 22.0001C19.5523 22.0001 20 22.4478 20 23.0001V25.0001C20 25.5524 19.5523 26.0001 19 26.0001C18.4477 26.0001 18 25.5524 18 25.0001V23.0001C18 22.4478 18.4477 22.0001 19 22.0001Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.75 33.229C14.75 31.9553 15.916 31.0239 17.1433 31.2588C22.3412 32.2534 25.6585 32.265 30.8524 31.2622C32.0804 31.0251 33.25 31.9561 33.25 33.2321V33.6461H34C35.1046 33.6461 36 34.5415 36 35.6461V37.174C36 38.2786 35.1046 39.174 34 39.174H33.25V40.0524C33.25 40.9569 32.6396 41.7578 31.7522 41.9835C28.8981 42.7096 26.5277 43.0843 24.1021 43.0834C21.6784 43.0826 19.2457 42.7068 16.2679 41.9802C15.3716 41.7615 14.75 40.9566 14.75 40.0435V39.174H14C12.8954 39.174 12 38.2786 12 37.174V35.6461C12 34.5415 12.8954 33.6461 14 33.6461H14.75V33.229ZM16.75 33.229C16.75 33.2291 16.75 33.2289 16.75 33.229V33.6461C16.75 34.7507 15.8546 35.6461 14.75 35.6461H14V37.174H14.75C15.8546 37.174 16.75 38.0695 16.75 39.174V40.0392C19.6356 40.7428 21.897 41.0827 24.1028 41.0834C26.3061 41.0842 28.5001 40.7467 31.25 40.0476V39.174C31.25 38.0695 32.1454 37.174 33.25 37.174H34V35.6461H33.25C32.1454 35.6461 31.25 34.7507 31.25 33.6461V33.2321C31.25 33.232 31.25 33.2322 31.25 33.2321C31.2495 33.2316 31.2488 33.2306 31.2479 33.2299C31.2449 33.2275 31.2419 33.2262 31.2401 33.2257L31.2377 33.2253C31.237 33.2253 31.2351 33.2253 31.2315 33.226C25.7838 34.2778 22.2102 34.2646 16.7675 33.2231C16.764 33.2225 16.7622 33.2225 16.7615 33.2225L16.7594 33.2228C16.7577 33.2233 16.7548 33.2245 16.752 33.2269C16.7511 33.2276 16.7505 33.2285 16.75 33.229Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M19 35.0001C19.5523 35.0001 20 35.4478 20 36.0001V38.0001C20 38.5524 19.5523 39.0001 19 39.0001C18.4477 39.0001 18 38.5524 18 38.0001V36.0001C18 35.4478 18.4477 35.0001 19 35.0001Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );