import 'package:flutter/material.dart';

import '../../../../common/theme/theme.dart';

class InventorySliverTabBarDelegate extends SliverPersistentHeaderDelegate {
  final TabBar tabBar;

  InventorySliverTabBarDelegate({required this.tabBar});

  @override
  double get minExtent => 60;

  @override
  double get maxExtent => 60;

  @override
  Widget build(
    BuildContext context,
    double shrinkOffset,
    bool overlapsContent,
  ) {
    return Container(
      decoration: BoxDecoration(
        color: AppColor.surface,
        boxShadow: [
          BoxShadow(
            color: AppColor.black.withOpacity(0.05),
            blurRadius: 8,
            offset: const Offset(0, 2),
          ),
        ],
      ),
      padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
      child: Container(
        decoration: BoxDecoration(
          color: AppColor.background,
          borderRadius: BorderRadius.circular(30),
          border: Border.all(
            color: AppColor.primary.withOpacity(0.1),
            width: 1,
          ),
        ),
        child: tabBar,
      ),
    );
  }

  @override
  bool shouldRebuild(InventorySliverTabBarDelegate oldDelegate) {
    return false;
  }
}
