In Flutter, the AppBar widget has a parameter called appBar which is of type PreferredSize. The PreferredSize class has two parameters of its own: child and preferredSize. You can create your own widget and set it as the value for the appBar parameter of the AppBar widget by using these parameters. You can create something like
2
Answers
There are two ways (that I know of) to achieve this
With Appbar
You can use the
flexibleSpace
property inside of AppBar combining withSafeArea
to achieve this.With Body
You can use
Stack
and thePositioned
widgetIn Flutter, the
AppBar
widget has a parameter calledappBar
which is of typePreferredSize
. ThePreferredSize
class has two parameters of its own:child
andpreferredSize
. You can create your own widget and set it as the value for theappBar
parameter of theAppBar
widget by using these parameters. You can create something likeand assign it to your appBar widget
The final code will look like