As you may know, one of the most important things to understand when developing your UI in Flutter is this sentence:
Constraints go down. Sizes go up. Parent sets position.
If you haven’t, I suggest you read this article before continuing.
And as always, I came a little late to the party and only learned about this a year into my Flutter career.
In some scenarios though, maybe it’s worth diving a little deeper.
Consider this conversation between a parent
Widget and its child:
Child: Mom, Dad, how big should I be?
Parent: Hey buddy, you just need to be…
Let’s go on an adventure today.
Our quest is to implement a header with custom snapping behavior.
Something like this:
You can follow the article with the completed code here.
Since ListView doesn’t support scroll effects. To CustomScrollView we go!
First, we should check if there is any prebuilt way to do this.
SliverAppBar looks promising. It even has the
expandedHeightwhich will allow the
flexibleSpacewidget to expand and collapse within the SliverAppBar.
In Flutter, hiding a widget is very easy.
Let’s say you want to hide
MyWidget in this layout when
All you have to do is:
However, things get a little more complicated when you notice that if
MyWidget is a
State will be recreated each time
MyWidget is shown. Or the fact that
MyWidget size would shrink to 0 and crumble your layouts. What should you do if you want to get
MyWidget size to do some calculation while it is hidden?
Let’s look at some widgets that handle…
Like most programmers in third-world countries, my first choice of OS has always been Windows. And as far as developing Android goes, the experience is, at the very least, tolerable, except one thing: Font Rendering.
Window’s font rendering, comparing to it’s macOS counterpart, is horrendous no matter how many hours you spent staring at those 6 sample texts to configure ClearType.
For normal users maybe it’s not a big deal, but when most of your job is to look at texts…
Here’s where MacType comes in. Download it here.
A better font rasterizer for Windows