meokg456/NestedScrollViewBugFixDemo

hello brother please with SliverPersistentHeaderDelegate it working for bottom but for SliverPersistentHeaderDelegate it not working

Opened this issue · 0 comments

import 'package:flutter/material.dart';

class SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
final TabBar _tabBar;

SliverAppBarDelegate(this._tabBar);

@OverRide
double get minExtent => _tabBar.preferredSize.height;
@OverRide
double get maxExtent => _tabBar.preferredSize.height;

@OverRide
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
return PreferredSize(
preferredSize: Size.fromHeight(_tabBar.preferredSize.height),
child: Container(
height: _tabBar.preferredSize.height,
decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor,
),
child: _tabBar,
),
);
}

@OverRide
bool shouldRebuild(SliverAppBarDelegate oldDelegate) {
return false;
}
}