Skip to content

Commit

Permalink
Merge pull request #388 from bannzai/bugfix/ui/appearance_taken_button
Browse files Browse the repository at this point in the history
Bugfix appearance record buttons
  • Loading branch information
bannzai committed Oct 3, 2021
2 parents 6438566 + 8f0f361 commit b3cc295
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RecordPageInformationHeader extends StatelessWidget {
name: "tapped_record_information_header");
if (activedPillSheet != null &&
pillSheetGroup != null &&
!pillSheetGroup.isDeleted) {
!pillSheetGroup.isDeactived) {
Navigator.of(context).push(
SettingTodayPillNumberPageRoute.route(
pillSheetGroup: pillSheetGroup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ class TodayTakenPillNumber extends StatelessWidget {
final activedPillSheet = this.pillSheetGroup?.activedPillSheet;
if (pillSheetGroup == null ||
activedPillSheet == null ||
pillSheetGroup.isDeactived ||
pillSheetGroup.isDeleted) {
pillSheetGroup.isDeactived) {
return Padding(
padding: EdgeInsets.only(top: 8),
child: Text("-",
Expand Down
6 changes: 3 additions & 3 deletions lib/domain/record/record_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class RecordPage extends HookWidget {
),
),
),
if (currentPillSheet != null)
if (currentPillSheet != null && !state.isDeactived)
Positioned(
bottom: 20,
child: RecordPageButton(currentPillSheet: currentPillSheet),
Expand All @@ -91,13 +91,13 @@ class RecordPage extends HookWidget {
RecordPageState state,
RecordPageStore store,
) {
if (state.pillSheetGroupIsHidden)
if (state.isDeactived)
return RecordPageAddingPillSheet(
context: context,
store: store,
setting: settingEntity,
);
if (!state.pillSheetGroupIsHidden)
if (!state.isDeactived)
return RecordPagePillSheetList(
state: state,
store: store,
Expand Down
6 changes: 2 additions & 4 deletions lib/domain/record/record_page_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ abstract class RecordPageState implements _$RecordPageState {
return pillSheetGroup?.activedPillSheet?.groupIndex ?? 0;
}

bool get pillSheetGroupIsHidden {
bool get isDeactived {
final pillSheetGroup = this.pillSheetGroup;
return pillSheetGroup == null ||
pillSheetGroup.isDeactived ||
pillSheetGroup.isDeleted;
return pillSheetGroup == null || pillSheetGroup.isDeactived;
}

bool get shouldShowTrial {
Expand Down
2 changes: 1 addition & 1 deletion lib/domain/settings/setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class SettingPage extends HookWidget {
_separator(),
if (activedPillSheet != null &&
pillSheetGroup != null &&
!pillSheetGroup.isDeleted) ...[
!pillSheetGroup.isDeactived) ...[
TodayPllNumberRow(
setting: setting,
pillSheetGroup: pillSheetGroup,
Expand Down
4 changes: 2 additions & 2 deletions lib/entity/pill_sheet_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ abstract class PillSheetGroup implements _$PillSheetGroup {
return passedPillCount + latestTakenPillSheet.lastTakenPillNumber;
}

bool get isDeactived => activedPillSheet == null;
bool get isDeleted => deletedAt != null;
bool get _isDeleted => deletedAt != null;
bool get isDeactived => activedPillSheet == null || _isDeleted;
}

0 comments on commit b3cc295

Please sign in to comment.