feat: category

This commit is contained in:
efrilm
2025-08-17 12:50:10 +07:00
parent f84090c0e6
commit 4a4f6388d7
19 changed files with 2041 additions and 20 deletions
@@ -1,11 +1,12 @@
import 'package:flutter/material.dart';
import '../../../../common/theme/theme.dart';
import '../../../../domain/category/category.dart';
class ProductCategoryHeaderDelegate extends SliverPersistentHeaderDelegate {
final List<String> categories;
final String selectedCategory;
final ValueChanged<String> onCategoryChanged;
final List<Category> categories;
final Category selectedCategory;
final ValueChanged<Category> onCategoryChanged;
ProductCategoryHeaderDelegate({
required this.categories,
@@ -35,7 +36,7 @@ class ProductCategoryHeaderDelegate extends SliverPersistentHeaderDelegate {
return Container(
margin: const EdgeInsets.only(right: 12.0),
child: FilterChip(
label: Text(category),
label: Text(category.name),
selected: isSelected,
onSelected: (selected) => onCategoryChanged(category),
backgroundColor: AppColor.surface,
@@ -64,6 +65,7 @@ class ProductCategoryHeaderDelegate extends SliverPersistentHeaderDelegate {
@override
bool shouldRebuild(ProductCategoryHeaderDelegate oldDelegate) {
return oldDelegate.selectedCategory != selectedCategory;
return oldDelegate.categories != categories ||
oldDelegate.selectedCategory != selectedCategory;
}
}