2025-10-27 21:55:19 +07:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../../common/extension/extension.dart';
|
|
|
|
|
import '../../../../common/theme/theme.dart';
|
|
|
|
|
import '../../../components/field/field.dart';
|
|
|
|
|
import '../../../components/page/page_title.dart';
|
|
|
|
|
import '../../../components/picker/date_range_picker.dart';
|
|
|
|
|
import '../../../components/spaces/space.dart';
|
|
|
|
|
|
|
|
|
|
class OrderTitle extends StatelessWidget {
|
|
|
|
|
final String title;
|
|
|
|
|
final DateTime startDate;
|
|
|
|
|
final DateTime endDate;
|
|
|
|
|
final Function(String) onChanged;
|
|
|
|
|
final void Function(DateTime? start, DateTime? end) onDateRangeChanged;
|
2025-10-30 16:35:47 +07:00
|
|
|
final int totalOrder;
|
2025-10-27 21:55:19 +07:00
|
|
|
const OrderTitle({
|
|
|
|
|
super.key,
|
|
|
|
|
required this.title,
|
|
|
|
|
required this.startDate,
|
|
|
|
|
required this.endDate,
|
|
|
|
|
required this.onChanged,
|
|
|
|
|
required this.onDateRangeChanged,
|
2025-10-30 16:35:47 +07:00
|
|
|
required this.totalOrder,
|
2025-10-27 21:55:19 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return PageTitle(
|
|
|
|
|
title: title,
|
|
|
|
|
bottom: Container(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppColor.white,
|
|
|
|
|
border: Border(
|
|
|
|
|
bottom: BorderSide(color: AppColor.border, width: 1.0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
startDate.toFormattedDate() == endDate.toFormattedDate()
|
|
|
|
|
? startDate.toFormattedDate()
|
|
|
|
|
: '${startDate.toFormattedDate()} - ${endDate.toFormattedDate()}',
|
|
|
|
|
style: AppStyle.md.copyWith(fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
2025-10-30 16:35:47 +07:00
|
|
|
'$totalOrder Pesanan',
|
2025-10-27 21:55:19 +07:00
|
|
|
style: AppStyle.md.copyWith(fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SpaceHeight(16),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: AppTextFormField(
|
|
|
|
|
onChanged: onChanged,
|
|
|
|
|
label: 'Cari Pesanan',
|
|
|
|
|
showLabel: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SpaceWidth(12),
|
|
|
|
|
GestureDetector(
|
|
|
|
|
onTap: () => DateRangePickerModal.show(
|
|
|
|
|
context: context,
|
|
|
|
|
initialStartDate: startDate,
|
|
|
|
|
initialEndDate: endDate,
|
|
|
|
|
primaryColor: AppColor.primary,
|
|
|
|
|
onChanged: onDateRangeChanged,
|
|
|
|
|
),
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppColor.primary,
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
),
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.filter_list_outlined,
|
|
|
|
|
color: AppColor.white,
|
|
|
|
|
size: 24,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|