123456789101112131415161718192021222324252627282930313233343536 |
- import 'package:riverpod_annotation/riverpod_annotation.dart';
- import 'package:shared/utils/log_utils.dart';
- import 'facility_booking_state.dart';
- part 'facility_booking_view_model.g.dart';
- @riverpod
- class FacilityBookingViewModel extends _$FacilityBookingViewModel {
- @override
- FacilityBookingState build() {
- final state = FacilityBookingState(selectedDate: DateTime.now());
- initListener(state);
- ref.onDispose(() {
- onDispose(state);
- });
- return state;
- }
- //修改选中的时间
- void changeSelectedDate(DateTime dateTime) {
- state = state.copyWith(selectedDate: dateTime);
- Log.d("当前选中的日期:$dateTime");
- }
- void initListener(FacilityBookingState state) {
- }
- void onDispose(FacilityBookingState state) {
- Log.d("FacilityBookingViewModel - onDispose");
- }
- }
|