Adds a new widget that allows to use a builder to make custom appbars.
First, add the sliver_appbar_builder
package to your pubspec.yaml.
dependencies:
sliver_appbar_builder: <Package version>
or
dependencies:
sliver_appbar_builder:
git:
url: https://github.com/AxonDesigns/sliver_appbar_builder.git
then, use flutter pub get
.
Now, import the package in your Dart code, use:
import 'package:sliver_appbar_builder/sliver_appbar_builder.dart';
SliverAppBarBuilder(
expandedHeight: 150,
collapsedHeight: 70,
floating: false,
pinned: true,
contentBuilder: (context, shrinkOffset, statusBarHeight, overlapsContent) {
return Container(
color: Color.lerp(Colors.amber, Colors.red, shrinkOffset),
child: Padding(
padding: EdgeInsets.only(top: statusBarHeight),
child: const Center(
child: Text("Home Page"),
),
),
);
},
);