Skip to content

Commit

Permalink
🐚 dart format lib -l 150
Browse files Browse the repository at this point in the history
  • Loading branch information
bannzai committed Nov 21, 2024
1 parent a1357a0 commit ab7d852
Show file tree
Hide file tree
Showing 77 changed files with 954 additions and 428 deletions.
6 changes: 5 additions & 1 deletion lib/components/atoms/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,11 @@ class AlertButton extends HookWidget {
children: [
Text(
text,
style: TextStyle(fontFamily: FontFamily.japanese, fontWeight: FontWeight.w600, fontSize: 14, color: (isProcessing.value || onPressed == null) ? TextColor.gray : TextColor.primary),
style: TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w600,
fontSize: 14,
color: (isProcessing.value || onPressed == null) ? TextColor.gray : TextColor.primary),
),
if (isProcessing.value) _Loading(),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import 'package:pilll/utils/datetime/day.dart';
// 予定されている生理日
// maxDateRangeCountは主にユニットテストの時に嬉しい引数になっているがプロダクションコードでもそのまま使用している
// ユースケースとして大体の未来のものを返せれば良いので厳密な計算結果が欲しいわけではないので動作確認とユニットテストをしやすい方式をとっている
List<DateRange> scheduledMenstruationDateRanges(PillSheetGroup? pillSheetGroup, Setting? setting, List<Menstruation> menstruations, [int maxDateRangeCount = 15]) {
List<DateRange> scheduledMenstruationDateRanges(PillSheetGroup? pillSheetGroup, Setting? setting, List<Menstruation> menstruations,
[int maxDateRangeCount = 15]) {
if (pillSheetGroup == null || setting == null) {
return [];
}
Expand All @@ -35,10 +36,12 @@ List<DateRange> scheduledMenstruationDateRanges(PillSheetGroup? pillSheetGroup,
final menstruationDateRanges = menstruations.map((e) => e.dateRange);
// `今日より前の生理予定日` と `すでに記録済みの生理予定日` はこのタイミングで除外する。scheduledMenstruationDateRangesを作成するタイミングだと後続のoffsetを含めた処理に影響が出る。
// 例えば現在2シートめでこのwhere句でフィルタリングしてしまうと、1シート目とoffsetを考慮した生理予定日が表示されないようになる
dateRanges = dateRanges.where((scheduledMenstruationRange) => !scheduledMenstruationRange.end.isBefore(today())).where((scheduledMenstruationRange) {
dateRanges =
dateRanges.where((scheduledMenstruationRange) => !scheduledMenstruationRange.end.isBefore(today())).where((scheduledMenstruationRange) {
// すでに記録されている生理については除外したものを予定されている生理とする
return menstruationDateRanges
.where((menstruationDateRange) => menstruationDateRange.inRange(scheduledMenstruationRange.begin) || menstruationDateRange.inRange(scheduledMenstruationRange.end))
.where((menstruationDateRange) =>
menstruationDateRange.inRange(scheduledMenstruationRange.begin) || menstruationDateRange.inRange(scheduledMenstruationRange.end))
.isEmpty;
}).toList();

Expand Down
9 changes: 6 additions & 3 deletions lib/components/organisms/calendar/week/week_calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,16 @@ void transitionWhenCalendarDayTapped(
if (diary == null) {
showModalBottomSheet(
context: context,
builder: (context) =>
DiaryOrScheduleSheet(showDiary: () => Navigator.of(context).push(DiaryPostPageRoute.route(date, null)), showSchedule: () => Navigator.of(context).push(SchedulePostPageRoute.route(date))),
builder: (context) => DiaryOrScheduleSheet(
showDiary: () => Navigator.of(context).push(DiaryPostPageRoute.route(date, null)),
showSchedule: () => Navigator.of(context).push(SchedulePostPageRoute.route(date))),
);
} else {
showModalBottomSheet(
context: context,
builder: (context) => DiaryOrScheduleSheet(showDiary: () => _showConfirmDiarySheet(context, diary), showSchedule: () => Navigator.of(context).push(SchedulePostPageRoute.route(date))),
builder: (context) => DiaryOrScheduleSheet(
showDiary: () => _showConfirmDiarySheet(context, diary),
showSchedule: () => Navigator.of(context).push(SchedulePostPageRoute.route(date))),
);
}
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ class SettingPillSheetView extends StatelessWidget {
}

if (pillSheetType.dosingPeriod < pillNumberInPillSheet) {
return (pillSheetType == PillSheetType.pillsheet_21 || pillSheetType == PillSheetType.pillsheet_24_rest_4) ? PillMarkType.rest : PillMarkType.fake;
return (pillSheetType == PillSheetType.pillsheet_21 || pillSheetType == PillSheetType.pillsheet_24_rest_4)
? PillMarkType.rest
: PillMarkType.fake;
}
return PillMarkType.normal;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class SettingMenstruationDynamicDescription extends StatelessWidget {
onTap: () => _showDurationModalSheet(context),
child: _duration(),
),
const Text(" 日間生理が続く", style: TextStyle(fontFamily: FontFamily.japanese, fontWeight: FontWeight.w300, fontSize: 14, color: TextColor.main)),
const Text(" 日間生理が続く",
style: TextStyle(fontFamily: FontFamily.japanese, fontWeight: FontWeight.w300, fontSize: 14, color: TextColor.main)),
],
)
],
Expand Down
3 changes: 2 additions & 1 deletion lib/entity/config.codegen.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ class _$ConfigImpl extends _Config {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ConfigImpl &&
(identical(other.minimumSupportedAppVersion, minimumSupportedAppVersion) || other.minimumSupportedAppVersion == minimumSupportedAppVersion));
(identical(other.minimumSupportedAppVersion, minimumSupportedAppVersion) ||
other.minimumSupportedAppVersion == minimumSupportedAppVersion));
}

@JsonKey(ignore: true)
Expand Down
6 changes: 4 additions & 2 deletions lib/entity/diary.codegen.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ class _$DiaryImpl extends _Diary {

@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, date, createdAt, physicalConditionStatus, const DeepCollectionEquality().hash(_physicalConditions), hasSex, memo);
int get hashCode =>
Object.hash(runtimeType, date, createdAt, physicalConditionStatus, const DeepCollectionEquality().hash(_physicalConditions), hasSex, memo);

@JsonKey(ignore: true)
@override
Expand All @@ -227,7 +228,8 @@ class _$DiaryImpl extends _Diary {

abstract class _Diary extends Diary {
const factory _Diary(
{@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) required final DateTime date,
{@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
required final DateTime date,
@JsonKey(fromJson: TimestampConverter.timestampToDateTime, toJson: TimestampConverter.dateTimeToTimestamp) required final DateTime? createdAt,
final PhysicalConditionStatus? physicalConditionStatus,
required final List<String> physicalConditions,
Expand Down
17 changes: 12 additions & 5 deletions lib/entity/diary_setting.codegen.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ mixin _$DiarySetting {
abstract class $DiarySettingCopyWith<$Res> {
factory $DiarySettingCopyWith(DiarySetting value, $Res Function(DiarySetting) then) = _$DiarySettingCopyWithImpl<$Res, DiarySetting>;
@useResult
$Res call({List<String> physicalConditions, @JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) DateTime createdAt});
$Res call(
{List<String> physicalConditions,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) DateTime createdAt});
}

/// @nodoc
Expand Down Expand Up @@ -69,11 +71,14 @@ abstract class _$$DiarySettingImplCopyWith<$Res> implements $DiarySettingCopyWit
factory _$$DiarySettingImplCopyWith(_$DiarySettingImpl value, $Res Function(_$DiarySettingImpl) then) = __$$DiarySettingImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({List<String> physicalConditions, @JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) DateTime createdAt});
$Res call(
{List<String> physicalConditions,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) DateTime createdAt});
}

/// @nodoc
class __$$DiarySettingImplCopyWithImpl<$Res> extends _$DiarySettingCopyWithImpl<$Res, _$DiarySettingImpl> implements _$$DiarySettingImplCopyWith<$Res> {
class __$$DiarySettingImplCopyWithImpl<$Res> extends _$DiarySettingCopyWithImpl<$Res, _$DiarySettingImpl>
implements _$$DiarySettingImplCopyWith<$Res> {
__$$DiarySettingImplCopyWithImpl(_$DiarySettingImpl _value, $Res Function(_$DiarySettingImpl) _then) : super(_value, _then);

@pragma('vm:prefer-inline')
Expand Down Expand Up @@ -101,7 +106,8 @@ class __$$DiarySettingImplCopyWithImpl<$Res> extends _$DiarySettingCopyWithImpl<
class _$DiarySettingImpl extends _DiarySetting with DiagnosticableTreeMixin {
const _$DiarySettingImpl(
{final List<String> physicalConditions = defaultPhysicalConditions,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) required this.createdAt})
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
required this.createdAt})
: _physicalConditions = physicalConditions,
super._();

Expand Down Expand Up @@ -163,7 +169,8 @@ class _$DiarySettingImpl extends _DiarySetting with DiagnosticableTreeMixin {
abstract class _DiarySetting extends DiarySetting {
const factory _DiarySetting(
{final List<String> physicalConditions,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) required final DateTime createdAt}) = _$DiarySettingImpl;
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
required final DateTime createdAt}) = _$DiarySettingImpl;
const _DiarySetting._() : super._();

factory _DiarySetting.fromJson(Map<String, dynamic> json) = _$DiarySettingImpl.fromJson;
Expand Down
18 changes: 12 additions & 6 deletions lib/entity/menstruation.codegen.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ abstract class _$$MenstruationImplCopyWith<$Res> implements $MenstruationCopyWit
}

/// @nodoc
class __$$MenstruationImplCopyWithImpl<$Res> extends _$MenstruationCopyWithImpl<$Res, _$MenstruationImpl> implements _$$MenstruationImplCopyWith<$Res> {
class __$$MenstruationImplCopyWithImpl<$Res> extends _$MenstruationCopyWithImpl<$Res, _$MenstruationImpl>
implements _$$MenstruationImplCopyWith<$Res> {
__$$MenstruationImplCopyWithImpl(_$MenstruationImpl _value, $Res Function(_$MenstruationImpl) _then) : super(_value, _then);

@pragma('vm:prefer-inline')
Expand Down Expand Up @@ -161,10 +162,12 @@ class __$$MenstruationImplCopyWithImpl<$Res> extends _$MenstruationCopyWithImpl<
class _$MenstruationImpl extends _Menstruation {
const _$MenstruationImpl(
{@JsonKey(includeIfNull: false) this.id,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) required this.beginDate,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
required this.beginDate,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) required this.endDate,
@JsonKey(fromJson: TimestampConverter.timestampToDateTime, toJson: TimestampConverter.dateTimeToTimestamp) this.deletedAt,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) required this.createdAt,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
required this.createdAt,
this.healthKitSampleDataUUID})
: super._();

Expand Down Expand Up @@ -226,10 +229,13 @@ class _$MenstruationImpl extends _Menstruation {
abstract class _Menstruation extends Menstruation {
const factory _Menstruation(
{@JsonKey(includeIfNull: false) final String? id,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) required final DateTime beginDate,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) required final DateTime endDate,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
required final DateTime beginDate,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
required final DateTime endDate,
@JsonKey(fromJson: TimestampConverter.timestampToDateTime, toJson: TimestampConverter.dateTimeToTimestamp) final DateTime? deletedAt,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp) required final DateTime createdAt,
@JsonKey(fromJson: NonNullTimestampConverter.timestampToDateTime, toJson: NonNullTimestampConverter.dateTimeToTimestamp)
required final DateTime createdAt,
final String? healthKitSampleDataUUID}) = _$MenstruationImpl;
const _Menstruation._() : super._();

Expand Down
6 changes: 5 additions & 1 deletion lib/entity/package.codegen.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ class _$PackageImpl implements _Package {
}

abstract class _Package implements Package {
const factory _Package({required final String latestOS, required final String appName, required final String appVersion, required final String buildNumber}) = _$PackageImpl;
const factory _Package(
{required final String latestOS,
required final String appName,
required final String appVersion,
required final String buildNumber}) = _$PackageImpl;

factory _Package.fromJson(Map<String, dynamic> json) = _$PackageImpl.fromJson;

Expand Down
Loading

0 comments on commit ab7d852

Please sign in to comment.