intrinsic_size_builder 2.0.2 intrinsic_size_builder: ^2.0.2 copied to clipboard
Finds the intrinsic size of a widget and provides it in a convenient builder.
text_box #
A simple example illustrating getting the intrinsic size of some text widget.
sliver_app_bar #
A sliver app bar with dynamic sizing of flexible space and bottom.
Notice:
- We nest 2 IntrinsicSizeBuilder's in this case, to get both flexibleSpace height and bottom height.
images #
Put images in a SliverAppBar of dynamic, varying sizes.
Notice:
- We manually call Image.network().resolve() to be able to add a status listener.
- When the image is loaded we need to call IntrinsicSizeBuilder.refresh(context), so that the IntrinsicSizeBuilder detects the new size of the widget. This is necessary since the loading and loaded heights differ.
- This examples also illustrate the use of the
firstFrameWidget
parameter. This is a visual optimization. In this (forced) case you can see a red (unwanted) background for 1 frame, just after launch, if you do not setfirstFrameWidget
. ThefirstFrameWidget
is set to the LoadingBody with same key as the real LoadingBody, resulting in, the LoadingBody is displayed 1 extra frame, and the transition from LoadingBody to LoadedBody happens without the 1-frame red glitch.