Flutter - Auto Scaling the Text Size

preview_player
Показать описание
In this episode I cover how the text size can be scaled to the wrapping container.

This episode covers:
- Scaling text automatically
- Scaling text with a gesture
- Pinching in the emulator

The code used in this episode:

The challenge:
- Figure out how to keep the text from jumping on the second scaling pinch gesture event.
Рекомендации по теме
Комментарии
Автор

Great video thanks you. I am searching for this for two months thank you so much for sharing your knowledge..👍👍

nanisamireddy
Автор

Hey, great video! The reason why it jumps is that it is adding .35 of the initial height on the very first call of onScaleUpdate. So it's not a smooth transition. And the larger the initial height, the larger the issue.

One solution would just to multiply the initial height and don't add to it. You said multiplying it by the scale directly was too fast, so maybe the square/cubed root of the scale would work better. That way it is always multiplied by 1.0 to start with and there's no jump in size.

Max-ybmx
Автор

very very thanks your tutorial was very util!!!

mtux
Автор

Hi, thanks for this. I am not sure whether this helps, since this video was made a year ago. I think it is a math problem. I would try _height = _initHeight * (1 + (details.scale * .35)). I hope this works.

fyzuladzwan
Автор

Hi,
try this once
if(details.scale!=1.0) {
_hight = _inithight* details.scale;
}

abhinandanmore