Skip to content

Commit

Permalink
Merge pull request #49 from PLADI-ALM/feat/PDA-16-booking-resource
Browse files Browse the repository at this point in the history
fix: 달력 내 선택 해제하는 경우 예외 처리
  • Loading branch information
ryr0121 authored Dec 1, 2023
2 parents d89e29e + d777a0b commit 149fbba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
6 changes: 0 additions & 6 deletions lib/View/booking/component/custom_range_calendar.dart
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:table_calendar/table_calendar.dart';

import '../../colors.dart';

typedef SetSelectedStartDate = void Function(DateTime? date);
typedef SetSelectedEndDate = void Function(DateTime? date);
typedef SetSelectedDate = void Function(DateTime date);
typedef ChangedDate = void Function(DateTime? start, DateTime? end);
typedef DidTapBookedDate = void Function(DateTime date);

class CustomRangeCalender extends StatefulWidget {
final SetSelectedDate selectDate;
final ChangedDate changedDate;
// final DidTapBookedDate didTapBookedDate;

final double? calendarDayHeight;
final List<String> bookedDayList;

const CustomRangeCalender({
required this.selectDate,
required this.changedDate,
// required this.didTapBookedDate,
required this.bookedDayList,
this.calendarDayHeight,
Key? key
Expand Down
29 changes: 15 additions & 14 deletions lib/View/booking/screen/booking_resource_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -332,27 +332,28 @@ class _BookingResourceScreenState extends State<BookingResourceScreen> {
}

void changedDate(DateTime? start, DateTime? end) {
setState(() {
startDate = (start == null) ? null : DateTime(start.year, start.month, start.day);
endDate = (end == null)
? DateTime(start!.year, start!.month, start!.day)
: DateTime(end.year, end.month, end.day);
if (start == null && end == null) {
setState(() {
startDate = null;
endDate = null;
});

print('start -> $start');
print('end -> $end');
});
} else {
setState(() {
startDate = (start == null) ? null : DateTime(start.year, start.month, start.day);
endDate = (end == null)
? DateTime(start!.year, start!.month, start!.day)
: DateTime(end.year, end.month, end.day);
});
}
}

void changedStartDate(DateTime? time) {
setState(() {
startDate = (time == null) ? null : DateTime(time.year, time.month, time.day);
});
setState(() { startDate = (time == null) ? null : DateTime(time.year, time.month, time.day); });
}

void changedEndDate(DateTime? time) {
setState(() {
endDate = (time == null) ? null : DateTime(time.year, time.month, time.day);
});
setState(() { endDate = (time == null) ? null : DateTime(time.year, time.month, time.day); });
}

void didTapResetTimeGridButton() {
Expand Down

0 comments on commit 149fbba

Please sign in to comment.