sliver_app_bar_builder
sliver_app_bar_builder copied to clipboard
Type Argument Error
The argument type 'Container Function(BuildContext, double, double)' can't be assigned to the parameter type 'ExpandRatioBuilderContentCallback?'. @mvacha @tenhobi @mathew65 @petrnymsa @ArtemRedchych
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xffF5F4F9),
body: CustomScrollView(
slivers: [
SliverAppBarBuilder(
barHeight: 60,
pinned: true,
leadingActions: [
(context, expandRatio, barHeight, overlapsContent) {
return SizedBox(
height: barHeight,
child: const BackButton(),
);
}
],
initialContentHeight: 150,
contentBuilder: (context, expandRatio, contentHeight, overlapsContent) {
return Container(
alignment: Alignment.centerLeft,
height: 60,
transform: Matrix4.translationValues(10 + (1 - expandRatio) * 40, 0, 0),
child: Text(
'My Title',
style: TextStyle(
fontSize: 22 + expandRatio * 10,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
);
},
),
],
),
Hi, you are reffering to code from README, right?
The type is defined as such, with centerPadding property added to it.
typedef ExpandRatioBuilderContentCallback = Widget Function(
BuildContext context,
double expandRatio,
double contentHeight,
EdgeInsets centerPadding,
bool overlapsContent,
);
Therefore in the example in README is not updated. I will modify it later. Thanks!