Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement user manual rest duration #392

Merged
merged 135 commits into from
Oct 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
bdfc613
:sparkles: Add RestDuration
bannzai Oct 9, 2021
e50d1bb
:memo: Missing name
bannzai Oct 9, 2021
7cdba8b
:recycle: Fix property
bannzai Oct 9, 2021
fb6eae2
:recycle: Refactor unnecessary explicit condition
bannzai Oct 9, 2021
06f6ee3
:shirt: fix indent
bannzai Oct 9, 2021
a72f1d9
:sparkles: add option widget
bannzai Oct 9, 2021
3c2ac7c
:sparkles: add function of record begin resting
bannzai Oct 9, 2021
60a471f
:shirt: fix indent
bannzai Oct 9, 2021
ac2704e
:recycle: Pass actived pill sheet data
bannzai Oct 9, 2021
75c3739
:recycle: adjustment outlined button parameters
bannzai Oct 9, 2021
0021801
:art: adjustment position
bannzai Oct 9, 2021
7c9dc76
:recycle: consider end rest duration
bannzai Oct 9, 2021
f889df6
:recycle: To array
bannzai Oct 9, 2021
f38db37
:recycle: fix to retrieve target rest duration
bannzai Oct 9, 2021
8b7401d
:recycle: Using restDurations
bannzai Oct 10, 2021
f4955b9
:recycle: Missing wording
bannzai Oct 10, 2021
ad4cdf7
:bug: using now
bannzai Oct 10, 2021
d4d8b66
:sparkles: add type of rest duration
bannzai Oct 10, 2021
e51e4c9
:memo: Fill pill sheet modified history kind widgets
bannzai Oct 10, 2021
5ed3246
:recycle: Rename value class
bannzai Oct 10, 2021
bbf0d72
:recycle: Rename case name
bannzai Oct 10, 2021
45e55df
:sparkles: add value property
bannzai Oct 10, 2021
ea3772b
:sparkels: fill began and ended rest duration
bannzai Oct 10, 2021
5bfecae
:recycle: Rename classes
bannzai Oct 10, 2021
c3e2f2d
:sparkles: add factory method of history value
bannzai Oct 10, 2021
67617e4
:sparkels: add history
bannzai Oct 10, 2021
34e404c
:bug: Bugfix for recorded history
bannzai Oct 10, 2021
a03fae5
:recycle: Rename to endedRestDuration
bannzai Oct 10, 2021
caf076a
:art: add images
bannzai Oct 10, 2021
0092a93
:sparkles: add dialog
bannzai Oct 10, 2021
242b791
:sparkles: show record page rest duration dialog
bannzai Oct 10, 2021
1287d3f
:memo: show snack bar
bannzai Oct 10, 2021
3a3b961
:recycle: Rename property
bannzai Oct 10, 2021
7101f46
:recycle: Using getter property
bannzai Oct 10, 2021
0a4a397
:recycle: add rest duration button
bannzai Oct 10, 2021
62f4486
:sparkles: add rest duration button
bannzai Oct 10, 2021
08375f4
:sparkles: add condition of in rest duration
bannzai Oct 10, 2021
3da74c4
:recycle: fix wording
bannzai Oct 10, 2021
79fa297
:sparkels: add wording condition
bannzai Oct 10, 2021
5c55c1b
:recycle: fix conditon
bannzai Oct 10, 2021
259f090
:memo: fix wording
bannzai Oct 10, 2021
62d9612
:shell: flutter pub run build_runner build --delete-conflicting-outputs
bannzai Oct 10, 2021
083c64b
:memo: defined current page index
bannzai Oct 10, 2021
fe6b774
:sparkles: add getter of focusedPillSheet
bannzai Oct 10, 2021
01eee05
:sparkles: watch page is changed from RecordPage
bannzai Oct 10, 2021
1790f30
:recycle: add early return for is not exists not taken duration
bannzai Oct 10, 2021
a91e378
:art: adjustment empty frame height
bannzai Oct 10, 2021
aa16cf8
Revert ":art: adjustment empty frame height"
bannzai Oct 10, 2021
e1c2022
Revert ":recycle: add early return for is not exists not taken duration"
bannzai Oct 10, 2021
d2bcbd2
Revert ":sparkles: watch page is changed from RecordPage"
bannzai Oct 10, 2021
0236178
Revert ":sparkles: add getter of focusedPillSheet"
bannzai Oct 10, 2021
0e9ebc0
Revert ":memo: defined current page index"
bannzai Oct 10, 2021
c08d813
Revert ":shell: flutter pub run build_runner build --delete-conflicti…
bannzai Oct 10, 2021
de93765
:recycle: var -> final
bannzai Oct 12, 2021
b30a9eb
:sparkles: add failrue test case
bannzai Oct 12, 2021
2bb1d72
:sparkles: add failrue test case
bannzai Oct 12, 2021
4f9f6aa
:recycle: fix tdd test case
bannzai Oct 12, 2021
6c8eaa7
:sparkles: add test case
bannzai Oct 12, 2021
3508160
:recycle: remove unnecessary dependency
bannzai Oct 12, 2021
6c918dd
:sparkels: add summarized rest duration
bannzai Oct 12, 2021
c574925
:sparkles: add test case
bannzai Oct 12, 2021
cefd3a0
:sparkles: add test case
bannzai Oct 12, 2021
3635b59
:sparkles: Using summarized rest duration
bannzai Oct 12, 2021
6e56db4
:sparkles: add utility method
bannzai Oct 12, 2021
aaced2f
:sparkles: add test caes
bannzai Oct 12, 2021
06d532d
:memo: fix indent
bannzai Oct 12, 2021
dff4498
:recycle: replace to new difference functions
bannzai Oct 12, 2021
03d4a7f
:recycle: fix missing stub
bannzai Oct 12, 2021
8146f7f
:recycle: fix missing stub
bannzai Oct 12, 2021
b42245f
:recycle: to function for summarized rest duration
bannzai Oct 12, 2021
f5273ed
:recycle: fix calculated lastTakenNumber
bannzai Oct 12, 2021
74bb888
Revert ":recycle: replace to new difference functions"
bannzai Oct 12, 2021
1ae32bb
:memo: missing calculation
bannzai Oct 12, 2021
5a22e3c
Revert "Revert ":recycle: replace to new difference functions""
bannzai Oct 12, 2021
475e93e
:recycle: avoid infinite loop
bannzai Oct 12, 2021
547c348
:recycle: missing spec
bannzai Oct 12, 2021
85f55ab
:recycle: missing stub
bannzai Oct 12, 2021
0b2b28b
:bug: missing to calculate
bannzai Oct 12, 2021
1423fa3
:sparkles: add to pillsheet type hasRestDuration property
bannzai Oct 12, 2021
2036a8d
:sparkles: add to group for hasPillSheetRestDuration
bannzai Oct 12, 2021
5369c54
:memo: control appearance
bannzai Oct 12, 2021
e77f527
:recycle: remove unnecessary condition and fix wording
bannzai Oct 12, 2021
d79165f
:recycle: rename property
bannzai Oct 12, 2021
68f4e83
:sparkles: add failure test case
bannzai Oct 12, 2021
e5a38e3
:recycle: refactor to receive discard dialog
bannzai Oct 16, 2021
57f74c4
:sparkels: call discard dialog
bannzai Oct 16, 2021
1127c4b
:recycle: Replace to new api for show discard dialog
bannzai Oct 16, 2021
4613101
:sparkles: add failure test case
bannzai Oct 22, 2021
d2942bc
:sparkles: fix test cases
bannzai Oct 22, 2021
e112bbf
:sparkles: add test case
bannzai Oct 22, 2021
e8afa55
:sparkles: add test case
bannzai Oct 22, 2021
4f7a322
:recycle: flush rest duration on modify today pill number
bannzai Oct 25, 2021
1af3365
:sparkles: add utility method of count of pill sheet total day
bannzai Oct 25, 2021
57b47b7
:recycle: fix passed pill sheet
bannzai Oct 25, 2021
2d19e94
Revert ":recycle: fix passed pill sheet"
bannzai Oct 25, 2021
5dac7b5
Revert ":sparkles: add utility method of count of pill sheet total day"
bannzai Oct 25, 2021
4c805b7
:recycle: Rename to summarizedPillSheetTypeTotalCountToPageIndex
bannzai Oct 25, 2021
baeecf1
:recycle: Rename to endedPillSheets
bannzai Oct 25, 2021
8befdb1
:recycle: remove ambigious property
bannzai Oct 25, 2021
b2e48c6
:sparkles: consider rest duration
bannzai Oct 25, 2021
1f5153f
:recycle: prepare named property
bannzai Oct 25, 2021
ccebf6f
:recycle: refactor modifyTodayPillNumber
bannzai Oct 25, 2021
d0bddd6
:recycle: remove unnecessary property
bannzai Oct 25, 2021
2390878
:recycle: remove unnecessary property
bannzai Oct 25, 2021
e82ba6f
:recycle: remove unnecessary property
bannzai Oct 25, 2021
14f2b29
:recycle: remove unnecessary property
bannzai Oct 25, 2021
f483593
:recycle: remove unnecessary property
bannzai Oct 25, 2021
3293305
:recycle: remove unnecessary property
bannzai Oct 25, 2021
0428cd8
:shirt: fix indent
bannzai Oct 25, 2021
180776a
:shirt: fix indent
bannzai Oct 25, 2021
0548164
:bug: missing calculated value
bannzai Oct 25, 2021
c57e22c
:bug: missing calculated value
bannzai Oct 25, 2021
4ff381c
:recycle: fix test case
bannzai Oct 25, 2021
0058cc0
:recycle: fix indent
bannzai Oct 26, 2021
e73a320
:sparkles: consider rest duration for appearance pill sheet date
bannzai Oct 26, 2021
021c9f3
:recycle: Refactoring to extract method
bannzai Oct 26, 2021
8d542b1
:sparkles: add test case
bannzai Oct 26, 2021
97116b4
:sparkels: add test case for pillSheet has restDuration
bannzai Oct 26, 2021
871a182
:sparkles: Consider lastTakenDate timing
bannzai Oct 27, 2021
ab7ec74
:recycle: WIP fix function
bannzai Oct 27, 2021
a5517ce
:recycle: WIP calculated last taken date
bannzai Oct 27, 2021
dece9a9
:recycle: fix test case
bannzai Oct 27, 2021
4ce40d0
:recycle: Remove unnecessary import
bannzai Oct 27, 2021
43237ac
:memo: fix condition
bannzai Oct 29, 2021
951b3c7
:recycle: fix dialog condition
bannzai Oct 29, 2021
c8ef57b
:recycle: fix calculated date function
bannzai Oct 29, 2021
f0f3248
:recycle: fix test case
bannzai Oct 29, 2021
3ede1f4
:recycle: fix calculated rest durations
bannzai Oct 29, 2021
48d79ff
:recycle: fix condition
bannzai Oct 29, 2021
dcb929a
:art: ignored ripple animations
bannzai Oct 29, 2021
f962bd4
:recycle: fix summarized rest duration
bannzai Oct 29, 2021
ad436b7
:recycle: fix test case
bannzai Oct 29, 2021
6d965b3
:recycle: fix test case
bannzai Oct 29, 2021
a650ec3
:recycle: remove unnecessary early return
bannzai Oct 30, 2021
da9dbf1
:memo: fix test caase
bannzai Oct 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions images/explain_rest_duration.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions lib/components/atoms/buttons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,26 @@ class InconspicuousButton extends StatelessWidget {

class PrimaryOutlinedButton extends StatelessWidget {
final String text;
final double fontSize;
final VoidCallback? onPressed;

const PrimaryOutlinedButton({
Key? key,
required this.onPressed,
required this.fontSize,
required this.text,
}) : super(key: key);

Widget build(BuildContext context) {
return OutlinedButton(
child: Container(
width: 204,
padding: EdgeInsets.only(top: 12, bottom: 12),
child: Center(
child: Text(
text,
style: TextStyle(
color: TextColor.main,
fontSize: 16,
fontSize: fontSize,
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w700,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/components/atoms/color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PilllColors {
static final Color saturday = HexColor.fromHex("7FB9E1");
static final Color weekday = HexColor.fromHex("7E7E7E");
static final Color enable = HexColor.fromHex('E56A45');
static final Color disable = HexColor.fromHex("F2F2F2");
static final Color disable = HexColor.fromHex("EAEAEA");
static final Color divider = HexColor.fromHex("9DAFBD");

static final Color bottomBar = HexColor.fromHex("FAFAFA");
Expand Down
2 changes: 1 addition & 1 deletion lib/components/atoms/text_color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TextColor {
static final Color white = Colors.white;
static final Color darkGray = HexColor.fromHex("000000").withAlpha(153);
static final Color gray = HexColor.fromHex("7E7E7E");
static final Color lightGray = HexColor.fromHex("CDCFD1");
static final Color lightGray = HexColor.fromHex("B1B1B1");
static final Color lightGray2 = HexColor.fromHex("666666");
static final Color noshime = HexColor.fromHex("3D4662");
static final Color primary = PilllColors.primary;
Expand Down
12 changes: 9 additions & 3 deletions lib/components/organisms/calendar/utility.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@ List<DateRange> scheduledOrInTheMiddleMenstruationDateRanges(
}
assert(maxPageCount > 0);

final totalPillCount = pillSheetGroup.pillSheets
.map((e) => e.pillSheetType.totalCount)
.reduce((value, element) => value + element);
final List<DateRange> dateRanges = [];
// 大体の数を計算
for (int i = 0; i < maxPageCount; i++) {
final offset = pillSheetGroup.totalPillCountIntoGroup * i;
final offset = totalPillCount * i;
for (int pageIndex = 0;
pageIndex < pillSheetGroup.pillSheets.length;
pageIndex++) {
final pillSheet = pillSheetGroup.pillSheets[pageIndex];
final pillSheetTypes =
pillSheetGroup.pillSheets.map((e) => e.pillSheetType).toList();
final passedCount = passedTotalCount(
final passedCount = summarizedPillSheetTypeTotalCountToPageIndex(
pillSheetTypes: pillSheetTypes, pageIndex: pageIndex);
final serializedTotalPillNumber =
passedCount + pillSheet.typeInfo.totalCount;
Expand Down Expand Up @@ -91,11 +94,14 @@ List<DateRange> nextPillSheetDateRanges(
assert(maxPageCount > 0);

// 大体の数を計算
final totalPillCount = pillSheetGroup.pillSheets
.map((e) => e.pillSheetType.totalCount)
.reduce((value, element) => value + element);
final count = max(maxPageCount, pillSheetGroup.pillSheets.length) /
pillSheetGroup.pillSheets.length;
return List.generate(count.toInt(), (groupPageIndex) {
return pillSheetGroup.pillSheets.map((pillSheet) {
final offset = groupPageIndex * pillSheetGroup.totalPillCountIntoGroup;
final offset = groupPageIndex * totalPillCount;
final begin = pillSheet.estimatedLastTakenDate.add(Duration(days: 1));
final end = begin.add(Duration(days: Weekday.values.length - 1));
return DateRange(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extension WeeklyCalendarStateCompoutedProperties on WeeklyCalendarState {
int offsetForStartPositionAtLine(DateTime begin) {
return isNecessaryLineBreak(begin)
? 0
: begin.date().difference(dateRange.begin.date()).inDays;
: daysBetween(dateRange.begin.date(), begin.date());
}

DateTime buildDate(Weekday weekday) {
Expand Down
49 changes: 14 additions & 35 deletions lib/components/page/discard_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,59 +1,41 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:pilll/components/atoms/buttons.dart';
import 'package:pilll/components/atoms/font.dart';
import 'package:pilll/components/atoms/text_color.dart';

class DiscardDialog extends StatelessWidget {
final String title;
final Widget message;
final String doneButtonText;
final Function() done;
final Function()? cancel;
final List<Widget> actions;

const DiscardDialog({
Key? key,
required this.title,
required this.message,
required this.doneButtonText,
required this.done,
this.cancel,
required this.actions,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final cancel = this.cancel;
return AlertDialog(
title: SvgPicture.asset("images/alert_24.svg", width: 24, height: 24),
content: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
if (title.isNotEmpty) ...[
Text(title, style: FontType.subTitle.merge(TextColorStyle.main)),
Text(
title,
style: FontType.subTitle.merge(TextColorStyle.main),
textAlign: TextAlign.center,
),
SizedBox(
height: 15,
),
],
message,
],
),
actions: <Widget>[
SecondaryButton(
text: "キャンセル",
onPressed: cancel != null
? () => cancel()
: () {
Navigator.of(context).pop();
},
),
SecondaryButton(
text: doneButtonText,
onPressed: () {
done();
Navigator.of(context).pop();
},
),
],
actions: actions,
);
}
}
Expand All @@ -62,18 +44,15 @@ showDiscardDialog(
BuildContext context, {
required String title,
required String message,
required VoidCallback done,
required String doneText,
VoidCallback? cancel,
required List<Widget> actions,
}) {
showDialog(
context: context,
builder: (context) => DiscardDialog(
title: title,
message:
Text(message, style: FontType.assisting.merge(TextColorStyle.main)),
doneButtonText: doneText,
done: done,
cancel: cancel),
title: title,
message:
Text(message, style: FontType.assisting.merge(TextColorStyle.main)),
actions: actions,
),
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
import 'package:pilll/components/atoms/font.dart';
import 'package:pilll/components/atoms/text_color.dart';
import 'package:pilll/domain/calendar/components/pill_sheet_modified_history/components/pill_sheet_modified_history_date_component.dart';
import 'package:pilll/entity/pill_sheet_modified_history_value.dart';

class PillSheetModifiedHistoryBeganRestDuration extends StatelessWidget {
final DateTime estimatedEventCausingDate;
final BeganRestDurationValue? value;

const PillSheetModifiedHistoryBeganRestDuration({
Key? key,
required this.value,
required this.estimatedEventCausingDate,
}) : super(key: key);

@override
Widget build(BuildContext context) {
final value = this.value;
if (value == null) {
return Container();
}
return Container(
child: Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Row(
children: [
PillSheetModifiedHistoryDate(
estimatedEventCausingDate: estimatedEventCausingDate,
effectivePillNumber:
PillSheetModifiedHistoryDateEffectivePillNumber.hyphen()),
Spacer(),
Container(
width: PillSheetModifiedHistoryTakenActionLayoutWidths.trailing,
child: Row(
children: [
Container(
child: Text(
"休薬開始",
style: TextStyle(
color: TextColor.main,
fontSize: 12,
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w400,
),
textAlign: TextAlign.start,
),
),
Spacer(),
],
),
),
],
),
),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
import 'package:pilll/components/atoms/font.dart';
import 'package:pilll/components/atoms/text_color.dart';
import 'package:pilll/domain/calendar/components/pill_sheet_modified_history/components/pill_sheet_modified_history_date_component.dart';
import 'package:pilll/entity/pill_sheet_modified_history_value.dart';

class PillSheetModifiedHistoryEndedRestDuration extends StatelessWidget {
final DateTime estimatedEventCausingDate;
final EndedRestDurationValue? value;

const PillSheetModifiedHistoryEndedRestDuration({
Key? key,
required this.estimatedEventCausingDate,
required this.value,
}) : super(key: key);

@override
Widget build(BuildContext context) {
final value = this.value;
if (value == null) {
return Container();
}
return Container(
child: Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Row(
children: [
PillSheetModifiedHistoryDate(
estimatedEventCausingDate: estimatedEventCausingDate,
effectivePillNumber:
PillSheetModifiedHistoryDateEffectivePillNumber.hyphen()),
Spacer(),
Container(
width: PillSheetModifiedHistoryTakenActionLayoutWidths.trailing,
child: Row(
children: [
Container(
child: Text(
"休薬終了",
style: TextStyle(
color: TextColor.main,
fontSize: 12,
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w400,
),
textAlign: TextAlign.start,
),
),
Spacer(),
],
),
),
],
),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,23 @@ class CalendarPillSheetModifiedHistoryCard extends StatelessWidget {
),
),
SizedBox(height: 15),
PrimaryOutlinedButton(
text: "くわしくみる",
onPressed: () {
if (state.trialDeadlineDate == null) {
showPremiumTrialModal(context, () {
showPremiumTrialCompleteModalPreDialog(
SizedBox(
width: 204,
child: PrimaryOutlinedButton(
text: "くわしくみる",
fontSize: 16,
onPressed: () {
if (state.trialDeadlineDate == null) {
showPremiumTrialModal(context, () {
showPremiumTrialCompleteModalPreDialog(
context);
});
} else {
showPremiumIntroductionSheet(
context);
});
} else {
showPremiumIntroductionSheet(context);
}
},
}
},
),
),
],
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:pilll/domain/calendar/components/pill_sheet_modified_history/components/pill_sheet_modified_history_automatically_recorded_last_taken_date_action.dart';
import 'package:pilll/domain/calendar/components/pill_sheet_modified_history/components/pill_sheet_modified_history_began_rest_duration.dart';
import 'package:pilll/domain/calendar/components/pill_sheet_modified_history/components/pill_sheet_modified_history_changed_pill_number_action.dart';
import 'package:pilll/domain/calendar/components/pill_sheet_modified_history/components/pill_sheet_modified_history_created_pill_sheet_action.dart';
import 'package:pilll/domain/calendar/components/pill_sheet_modified_history/components/pill_sheet_modified_history_deleted_pill_sheet_action.dart';
import 'package:pilll/domain/calendar/components/pill_sheet_modified_history/components/pill_sheet_modified_history_ended_rest_duration.dart';
import 'package:pilll/domain/calendar/components/pill_sheet_modified_history/components/pill_sheet_modified_history_ended_pill_sheet_action.dart';
import 'package:pilll/domain/calendar/components/pill_sheet_modified_history/components/pill_sheet_modified_history_monthly_header.dart';
import 'package:pilll/domain/calendar/components/pill_sheet_modified_history/components/pill_sheet_modified_history_revert_taken_pill_action.dart';
Expand Down Expand Up @@ -136,6 +138,18 @@ class CalendarPillSheetModifiedHistoryList extends StatelessWidget {
return PillSheetModifiedHistoryEndedPillSheetAction(
value: history.value.endedPillSheet,
);
case PillSheetModifiedActionType.beganRestDuration:
return PillSheetModifiedHistoryBeganRestDuration(
estimatedEventCausingDate:
history.estimatedEventCausingDate,
value: history.value.beganRestDurationValue,
);
case PillSheetModifiedActionType.endedRestDuration:
return PillSheetModifiedHistoryEndedRestDuration(
estimatedEventCausingDate:
history.estimatedEventCausingDate,
value: history.value.endedRestDurationValue,
);
}
};

Expand Down
4 changes: 2 additions & 2 deletions lib/domain/calendar/date_range.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ class DateRange {
final DateTime _end;
DateTime get begin => _begin.date();
DateTime get end => _end.date();
int get days => end.difference(begin).inDays;
int get days => daysBetween(begin, end);

DateRange(this._begin, this._end);

static bool isSameDay(DateTime a, DateTime b) =>
a.year == b.year && a.month == b.month && a.day == b.day;
bool inRange(DateTime date) =>
date.isAfter(begin) && date.isBefore(end) ||
(date.isAfter(begin) && date.isBefore(end)) ||
DateRange.isSameDay(date, begin) ||
DateRange.isSameDay(date, end);
DateRange union(DateRange range) {
Expand Down
Loading