Skip to content

Commit

Permalink
Merge pull request #608 from bannzai/fix/view/weekline-spec-after-res…
Browse files Browse the repository at this point in the history
…t-duration

Fix calc weekday
  • Loading branch information
bannzai authored Jun 4, 2022
2 parents 6b90533 + c208472 commit 2fb7695
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:pilll/components/atoms/color.dart';
import 'package:pilll/components/organisms/pill_sheet/pill_sheet_view_weekday_line.dart';
import 'package:pilll/domain/record/weekday_badge.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
Expand Down Expand Up @@ -33,7 +32,7 @@ class PillSheetViewLayout extends StatelessWidget {
return copied.first;
}

final PillSheetViewWeekdayLine? weekdayLines;
final Widget? weekdayLines;
final List<Widget> pillMarkLines;

const PillSheetViewLayout({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:pilll/analytics.dart';
import 'package:pilll/components/organisms/pill_mark/pill_mark.dart';
import 'package:pilll/components/organisms/pill_mark/pill_mark_line.dart';
Expand All @@ -15,6 +16,7 @@ import 'package:pilll/entity/pill_sheet_type.dart';
import 'package:pilll/entity/setting.codegen.dart';
import 'package:pilll/entity/weekday.dart';
import 'package:pilll/provider/premium_and_trial.codegen.dart';
import 'package:pilll/util/datetime/day.dart';

class RecordPagePillSheet extends StatelessWidget {
final PillSheetGroup pillSheetGroup;
Expand All @@ -37,10 +39,14 @@ class RecordPagePillSheet extends StatelessWidget {

@override
Widget build(BuildContext context) {
final weekdayDate = pillSheet.beginingDate.add(Duration(
days: summarizedRestDuration(
restDurations: pillSheet.restDurations, upperDate: today())));

return PillSheetViewLayout(
weekdayLines: PillSheetViewWeekdayLine(
firstWeekday:
WeekdayFunctions.weekdayFromDate(pillSheet.beginingDate)),
firstWeekday: WeekdayFunctions.weekdayFromDate(weekdayDate),
),
pillMarkLines: List.generate(
pillSheet.pillSheetType.numberOfLineInPillSheet,
(index) {
Expand Down

0 comments on commit 2fb7695

Please sign in to comment.