report page

This commit is contained in:
efrilm
2025-11-01 04:11:29 +07:00
parent d111025aa6
commit 2f155a2f8d
12 changed files with 989 additions and 39 deletions
+34
View File
@@ -0,0 +1,34 @@
import 'package:bloc/bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
import '../../common/extension/extension.dart';
part 'report_event.dart';
part 'report_state.dart';
part 'report_bloc.freezed.dart';
@injectable
class ReportBloc extends Bloc<ReportEvent, ReportState> {
ReportBloc() : super(ReportState.initial()) {
on<ReportEvent>(_onReportEvent);
}
Future<void> _onReportEvent(ReportEvent event, Emitter<ReportState> emit) {
return event.map(
dateChanged: (e) async {
emit(
state.copyWith(
startDate: e.startDate,
endDate: e.endDate,
rangeDateFormatted:
'${e.startDate.toFormattedDate()} - ${e.endDate.toFormattedDate()}',
),
);
},
menuChanged: (e) async {
emit(state.copyWith(selectedMenu: e.index, title: e.title));
},
);
}
}