Reputation: 1055
For instance, I am working on an app with many screens, so I am creating lots of Scaffold
s and AppBar
s.
Say my design spec says that "the appbar title should be centered always, on all platforms", i.e. I want the centerTitle
argument to AppBar
to always be true
.
I could wrap AppBar
with a custom widget MyAppBar
and always set centerTitle
to true
, but
AppBar
propertiesAppBar
Is there an option better than "just try to remember to set it everywhere you create an AppBar
"?
Upvotes: 0
Views: 62
Reputation: 277487
Making a custom MyAppBar
widget that always center the title is the correct solution.
But the premise that is has a lot of boilerplate/hard to maintain is false.
You don't need all AppBar
properties. Only expose those that are relevant to your app.
Upvotes: 2