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="M42 24C42 33.9411 33.9411 42 24 42C14.0589 42 6 33.9411 6 24C6 14.0589 14.0589 6 24 6C33.9411 6 42 14.0589 42 24ZM44 24C44 35.0457 35.0457 44 24 44C12.9543 44 4 35.0457 4 24C4 12.9543 12.9543 4 24 4C35.0457 4 44 12.9543 44 24ZM16.1685 19.1931C14.8238 20.2322 13.4726 20.8383 12.4422 21.0435C11.7478 21.1817 11.4217 21.1121 11.2983 21.0679C11.2867 20.9373 11.3015 20.6042 11.6104 19.9672C12.0688 19.0218 12.996 17.8671 14.3407 16.8279C15.6854 15.7888 17.0367 15.1827 18.0671 14.9775C18.7615 14.8393 19.0875 14.9089 19.2109 14.9531C19.2226 15.0837 19.2077 15.4168 18.8988 16.0538C18.4404 16.9992 17.5132 18.1539 16.1685 19.1931ZM17.3914 20.7756C14.3197 23.1494 10.8729 23.8358 9.69277 22.3086C8.51263 20.7815 10.0461 17.6192 13.1178 15.2454C16.1895 12.8716 19.6363 12.1852 20.8165 13.7124C21.9966 15.2395 20.4632 18.4018 17.3914 20.7756ZM33.3839 32.3301C32.8287 31.4567 31.7897 30.4294 30.3533 29.5621C28.9168 28.6947 27.5239 28.2537 26.4924 28.169C25.822 28.1141 25.5117 28.2098 25.3903 28.2662C25.3969 28.4 25.4566 28.7191 25.8175 29.2868C26.3727 30.1603 27.4116 31.1875 28.8481 32.0549C30.2846 32.9222 31.6775 33.3633 32.709 33.4479C33.3794 33.5029 33.6896 33.4072 33.8111 33.3507C33.8045 33.217 33.7447 32.8978 33.3839 32.3301ZM35.5516 34.4016C36.5382 32.7677 34.6736 29.8344 31.387 27.85C28.1004 25.8655 24.6363 25.5814 23.6498 27.2153C22.6632 28.8493 24.5277 31.7825 27.8143 33.767C31.1009 35.7514 34.565 36.0356 35.5516 34.4016ZM30.594 16.8496C31.3145 18.3899 31.6107 19.8419 31.5857 20.8931C31.5688 21.6027 31.4289 21.9059 31.3588 22.0164C31.229 21.9994 30.9066 21.9125 30.3511 21.4706C29.5282 20.8161 28.6035 19.6581 27.8829 18.1178C27.1624 16.5775 26.8661 15.1254 26.8912 14.0743C26.9081 13.3647 27.048 13.0615 27.1181 12.951C27.2479 12.968 27.5702 13.0549 28.1258 13.4968C28.9487 14.1513 29.8734 15.3093 30.594 16.8496ZM32.4055 16.0022C34.0514 19.5205 33.9676 23.036 32.2185 23.8542C30.4693 24.6724 27.7171 22.4835 26.0713 18.9652C24.4255 15.4469 24.5093 11.9314 26.2584 11.1132C28.0076 10.295 30.7597 12.4838 32.4055 16.0022ZM19.9163 35.9561C19.9115 34.8725 19.5644 33.3899 18.7808 31.8312C17.9973 30.2725 17.0144 29.1094 16.1476 28.4592C15.5202 27.9885 15.1743 27.9258 15.0507 27.9192C14.9822 28.0223 14.8262 28.3374 14.8296 29.1217C14.8344 30.2053 15.1815 31.688 15.9651 33.2466C16.7486 34.8053 17.7315 35.9684 18.5983 36.6187C19.2257 37.0893 19.5717 37.152 19.6953 37.1586C19.7637 37.0555 19.9198 36.7404 19.9163 35.9561ZM20.6034 38.9651C22.3678 38.0781 22.3519 34.482 20.5678 30.9329C18.7836 27.3838 15.907 25.2258 14.1425 26.1127C12.3781 26.9997 12.3941 30.5958 14.1782 34.1449C15.9623 37.694 18.8389 39.8521 20.6034 38.9651ZM13.5693 20.3906C14.1216 20.3906 14.5693 19.9429 14.5693 19.3906C14.5693 18.8383 14.1216 18.3906 13.5693 18.3906C13.017 18.3906 12.5693 18.8383 12.5693 19.3906C12.5693 19.9429 13.017 20.3906 13.5693 20.3906ZM16.3631 16.9844C16.3631 17.2605 16.1393 17.4844 15.8631 17.4844C15.587 17.4844 15.3631 17.2605 15.3631 16.9844C15.3631 16.7082 15.587 16.4844 15.8631 16.4844C16.1393 16.4844 16.3631 16.7082 16.3631 16.9844ZM15.6371 18.8906C15.9133 18.8906 16.1371 18.6668 16.1371 18.3906C16.1371 18.1145 15.9133 17.8906 15.6371 17.8906C15.361 17.8906 15.1371 18.1145 15.1371 18.3906C15.1371 18.6668 15.361 18.8906 15.6371 18.8906ZM18.3477 16.077C18.3477 16.4636 18.0343 16.777 17.6477 16.777C17.2611 16.777 16.9477 16.4636 16.9477 16.077C16.9477 15.6904 17.2611 15.377 17.6477 15.377C18.0343 15.377 18.3477 15.6904 18.3477 16.077ZM31.4185 32.8984C31.9708 32.8984 32.4185 32.4507 32.4185 31.8984C32.4185 31.3462 31.9708 30.8984 31.4185 30.8984C30.8662 30.8984 30.4185 31.3462 30.4185 31.8984C30.4185 32.4507 30.8662 32.8984 31.4185 32.8984ZM30.4185 30.7129C30.4185 30.9631 30.2156 31.166 29.9654 31.166C29.7151 31.166 29.5123 30.9631 29.5123 30.7129C29.5123 30.4626 29.7151 30.2598 29.9654 30.2598C30.2156 30.2598 30.4185 30.4626 30.4185 30.7129ZM26.8269 29.4861C27.0739 29.4861 27.2741 29.2859 27.2741 29.039C27.2741 28.792 27.0739 28.5918 26.8269 28.5918C26.58 28.5918 26.3798 28.792 26.3798 29.039C26.3798 29.2859 26.58 29.4861 26.8269 29.4861ZM29.0845 29.944C29.0845 30.3682 28.7406 30.7121 28.3163 30.7121C27.8921 30.7121 27.5481 30.3682 27.5481 29.944C27.5481 29.5197 27.8921 29.1758 28.3163 29.1758C28.7406 29.1758 29.0845 29.5197 29.0845 29.944ZM29.3007 18.0762C29.8529 18.0762 30.3007 17.6285 30.3007 17.0762C30.3007 16.5239 29.8529 16.0762 29.3007 16.0762C28.7484 16.0762 28.3007 16.5239 28.3007 17.0762C28.3007 17.6285 28.7484 18.0762 29.3007 18.0762ZM28.3007 15.0957C28.3007 15.3718 28.0768 15.5957 27.8007 15.5957C27.5245 15.5957 27.3007 15.3718 27.3007 15.0957C27.3007 14.8196 27.5245 14.5957 27.8007 14.5957C28.0768 14.5957 28.3007 14.8196 28.3007 15.0957ZM30.1768 20.2496C30.5634 20.2496 30.8768 19.9362 30.8768 19.5496C30.8768 19.163 30.5634 18.8496 30.1768 18.8496C29.7902 18.8496 29.4768 19.163 29.4768 19.5496C29.4768 19.9362 29.7902 20.2496 30.1768 20.2496ZM18.4574 33.0195C18.4574 33.5718 18.0097 34.0195 17.4574 34.0195C16.9051 34.0195 16.4574 33.5718 16.4574 33.0195C16.4574 32.4672 16.9051 32.0195 17.4574 32.0195C18.0097 32.0195 18.4574 32.4672 18.4574 33.0195ZM17.3729 31.123C17.6232 31.123 17.826 30.9202 17.826 30.6699C17.826 30.4197 17.6232 30.2168 17.3729 30.2168C17.1227 30.2168 16.9198 30.4197 16.9198 30.6699C16.9198 30.9202 17.1227 31.123 17.3729 31.123ZM16.1675 29.627C16.1675 29.9031 15.9436 30.127 15.6675 30.127C15.3913 30.127 15.1675 29.9031 15.1675 29.627C15.1675 29.3508 15.3913 29.127 15.6675 29.127C15.9436 29.127 16.1675 29.3508 16.1675 29.627ZM18.8675 35.8355C19.2541 35.8355 19.5675 35.5221 19.5675 35.1355C19.5675 34.7489 19.2541 34.4355 18.8675 34.4355C18.4809 34.4355 18.1675 34.7489 18.1675 35.1355C18.1675 35.5221 18.4809 35.8355 18.8675 35.8355Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );