Przykład trwałego nagłówka flasterem sliver
class Delegate extends SliverPersistentHeaderDelegate {
final Color backgroundColor;
final String headerTitle;
Delegate(this.backgroundColor, this.headerTitle);
@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
return Container(
color: backgroundColor,
child: Center(
child: Text(
headerTitle,
style: const TextStyle(
color: Colors.black,
fontSize: 20,
),
),
),
);
}
@override
double get maxExtent => 150;
@override
double get minExtent => 60;
@override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
return true;
}
Fair Ferret