feat: update sales ui
Build & Deploy iOS to TestFlight / build-and-deploy (push) Waiting to run

This commit is contained in:
Efril
2026-06-23 23:18:22 +07:00
parent 7137cd2335
commit 8d801e52d9
37 changed files with 3234 additions and 833 deletions
@@ -13,13 +13,14 @@ class DateRangePickerBottomSheet {
DateTime? maxDate,
String? confirmText,
String? cancelText,
Color primaryColor = Colors.blue,
Color primaryColor = const Color(0xFFD90000),
Function(DateTime? startDate, DateTime? endDate)? onChanged,
}) async {
return await showModalBottomSheet<DateRangePickerSelectionChangedArgs?>(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
barrierColor: Colors.transparent,
isDismissible: false,
enableDrag: false,
builder: (BuildContext context) => _DateRangePickerBottomSheet(
@@ -71,6 +72,8 @@ class _DateRangePickerBottomSheetState
DateRangePickerSelectionChangedArgs? _selectionChangedArgs;
late AnimationController _animationController;
late Animation<double> _slideAnimation;
final DateRangePickerController _pickerController =
DateRangePickerController();
@override
void initState() {
@@ -88,6 +91,7 @@ class _DateRangePickerBottomSheetState
@override
void dispose() {
_animationController.dispose();
_pickerController.dispose();
super.dispose();
}
@@ -135,10 +139,75 @@ class _DateRangePickerBottomSheetState
return false;
}
void _applyQuickFilter(DateTime start, DateTime end) {
final range = PickerDateRange(start, end);
_pickerController.selectedRange = range;
setState(() {
_selectionChangedArgs = DateRangePickerSelectionChangedArgs(range);
});
}
Widget _buildQuickFilters() {
final now = DateTime.now();
final todayStart = DateTime(now.year, now.month, now.day);
// This week (Monday to today)
final weekday = now.weekday; // 1=Mon, 7=Sun
final weekStart = todayStart.subtract(Duration(days: weekday - 1));
// This month (1st to today)
final monthStart = DateTime(now.year, now.month, 1);
return Wrap(
spacing: 8,
runSpacing: 8,
children: [
_buildFilterChip(
context.lang.today,
() => _applyQuickFilter(todayStart, todayStart),
),
_buildFilterChip(
'Minggu ini',
() => _applyQuickFilter(weekStart, todayStart),
),
_buildFilterChip(
'Bulan ini',
() => _applyQuickFilter(monthStart, todayStart),
),
_buildFilterChip(
'MTD',
() => _applyQuickFilter(monthStart, todayStart),
),
],
);
}
Widget _buildFilterChip(String label, VoidCallback onTap) {
return GestureDetector(
onTap: onTap,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
decoration: BoxDecoration(
color: widget.primaryColor.withOpacity(0.08),
borderRadius: BorderRadius.circular(20),
border: Border.all(color: widget.primaryColor.withOpacity(0.3)),
),
child: Text(
label,
style: TextStyle(
color: widget.primaryColor,
fontWeight: FontWeight.w600,
fontSize: 13,
),
),
),
);
}
@override
Widget build(BuildContext context) {
final screenHeight = MediaQuery.of(context).size.height;
final bottomSheetHeight = screenHeight * 0.75;
final bottomSheetHeight = screenHeight * 0.85;
return AnimatedBuilder(
animation: _animationController,
@@ -209,7 +278,12 @@ class _DateRangePickerBottomSheetState
),
),
const SizedBox(height: 20),
const SizedBox(height: 16),
// Quick filter chips
_buildQuickFilters(),
const SizedBox(height: 16),
// Date Picker
Container(
@@ -221,8 +295,10 @@ class _DateRangePickerBottomSheetState
),
),
child: SfDateRangePicker(
controller: _pickerController,
onSelectionChanged: _onSelectionChanged,
selectionMode: DateRangePickerSelectionMode.range,
backgroundColor: Colors.white,
initialSelectedRange:
(widget.initialStartDate != null &&
widget.initialEndDate != null)
@@ -233,6 +309,7 @@ class _DateRangePickerBottomSheetState
: null,
minDate: widget.minDate,
maxDate: widget.maxDate,
selectionColor: widget.primaryColor,
startRangeSelectionColor: widget.primaryColor,
endRangeSelectionColor: widget.primaryColor,
rangeSelectionColor: widget.primaryColor
@@ -249,7 +326,7 @@ class _DateRangePickerBottomSheetState
),
monthViewSettings: DateRangePickerMonthViewSettings(
viewHeaderStyle: DateRangePickerViewHeaderStyle(
backgroundColor: Colors.grey.withOpacity(0.1),
backgroundColor: Colors.white,
textStyle: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,