feat: invetory range date
This commit is contained in:
@@ -1,17 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../components/field/date_range_picker_field.dart';
|
||||
|
||||
class InventorySliverTabBarDelegate extends SliverPersistentHeaderDelegate {
|
||||
final TabBar tabBar;
|
||||
final DateTime? startDate;
|
||||
final DateTime? endDate;
|
||||
final Function(DateTime?, DateTime?)? onDateRangeChanged;
|
||||
|
||||
InventorySliverTabBarDelegate({required this.tabBar});
|
||||
InventorySliverTabBarDelegate({
|
||||
required this.tabBar,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.onDateRangeChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
double get minExtent => 60;
|
||||
double get minExtent => 120; // Increased height to accommodate date picker
|
||||
|
||||
@override
|
||||
double get maxExtent => 60;
|
||||
double get maxExtent => 120;
|
||||
|
||||
@override
|
||||
Widget build(
|
||||
@@ -31,22 +40,40 @@ class InventorySliverTabBarDelegate extends SliverPersistentHeaderDelegate {
|
||||
],
|
||||
),
|
||||
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: Column(
|
||||
children: [
|
||||
// Date Range Picker Section
|
||||
if (onDateRangeChanged != null)
|
||||
Expanded(
|
||||
child: DateRangePickerField(
|
||||
maxDate: DateTime.now(),
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
onChanged: onDateRangeChanged!,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// Tab Bar Section
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.background,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
border: Border.all(
|
||||
color: AppColor.primary.withOpacity(0.1),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: tabBar,
|
||||
),
|
||||
),
|
||||
child: tabBar,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRebuild(InventorySliverTabBarDelegate oldDelegate) {
|
||||
return false;
|
||||
return oldDelegate.startDate != startDate ||
|
||||
oldDelegate.endDate != endDate ||
|
||||
oldDelegate.tabBar != tabBar;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user