
Code:
CustomScrollView(
slivers: <Widget>[
SliverAppBar(
expandedHeight: 200.0,
flexibleSpace: FlexibleSpaceBar(
title: Container(color: Colors.red, child: Text("Flexible title")),
background: Image.asset("assets/chocolate.jpg", fit: BoxFit.cover),
),
),
SliverList(delegate: SliverChildListDelegate(_buildChildren())),
],
);
Why there is a default padding in the title. I used Container to bring contrast so that the margin can be visible easily. Even I tried using centerTitle: false and it didn't change anything.
You can now use the titlePadding attribute like so:
flexibleSpace: FlexibleSpaceBar(
title: Text('Home'),
titlePadding: EdgeInsetsDirectional.only(
start: 0.0,
bottom: 16.0,
),
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With