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="M15.8282 18.1398C13.6843 16.7409 11.3026 16 8.87115 16H8V6H6V41C6 41.5523 6.44772 42 7 42H42V40H8V18H8.87117C10.8868 18 12.8924 18.6123 14.7353 19.8148C16.5811 21.0192 18.2174 22.7864 19.5 25.0011C20.9186 27.4509 22.7615 29.4633 24.9025 30.8604C27.0465 32.2593 29.4283 33.0002 31.8597 33H38.3663L35.2927 36.0748C34.9023 36.4654 34.9024 37.0986 35.293 37.489C35.6836 37.8795 36.3168 37.8793 36.7073 37.4887L41.4873 32.7067C41.8776 32.3162 41.8776 31.6833 41.4873 31.2928L36.7073 26.5108C36.3168 26.1202 35.6836 26.1201 35.293 26.5105C34.9024 26.901 34.9023 27.5341 35.2927 27.9247L38.3667 31H31.8596C29.844 31.0001 27.8383 30.3879 25.9954 29.1854C24.1496 27.981 22.5133 26.2137 21.2308 23.9988C19.8121 21.5492 17.9693 19.5368 15.8282 18.1398Z" fill="black"/>
<path d="M40.5537 12.7796C40.8395 13.0654 41 13.453 41 13.8571V16.1429C41 16.547 40.8395 16.9346 40.5537 17.2204C40.2679 17.5061 39.8803 17.6667 39.4762 17.6667H35.6667V21.4762C35.6667 21.8803 35.5061 22.2679 35.2204 22.5537C34.9346 22.8395 34.547 23 34.1429 23H31.8571C31.453 23 31.0654 22.8395 30.7796 22.5537C30.4939 22.2679 30.3333 21.8803 30.3333 21.4762V17.6667H26.5238C26.1197 17.6667 25.7321 17.5061 25.4463 17.2204C25.1605 16.9346 25 16.547 25 16.1429V13.8571C25 13.453 25.1605 13.0654 25.4463 12.7796C25.7321 12.4939 26.1197 12.3333 26.5238 12.3333H30.3333V8.52381C30.3333 8.11967 30.4939 7.73208 30.7796 7.44631C31.0654 7.16054 31.453 7 31.8571 7H34.1429C34.547 7 34.9346 7.16054 35.2204 7.44631C35.5061 7.73208 35.6667 8.11967 35.6667 8.52381V12.3333H39.4762C39.8803 12.3333 40.2679 12.4939 40.5537 12.7796Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);