Skip to content

Commit a1357a0

Browse files
committed
🐚 dart format lib -l 200
1 parent f2f68e9 commit a1357a0

File tree

277 files changed

+2851
-7409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+2851
-7409
lines changed

lib/app.dart

+5-11
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ class App extends StatelessWidget {
1818
Widget build(BuildContext context) {
1919
return MaterialApp(
2020
navigatorKey: navigatorKey,
21-
navigatorObservers: [
22-
FirebaseAnalyticsObserver(analytics: firebaseAnalytics)
23-
],
21+
navigatorObservers: [FirebaseAnalyticsObserver(analytics: firebaseAnalytics)],
2422
theme: ThemeData(
2523
useMaterial3: false,
2624
appBarTheme: const AppBarTheme(
@@ -55,8 +53,7 @@ class App extends StatelessWidget {
5553
headerBackgroundColor: PilllColors.primary,
5654
),
5755
switchTheme: SwitchThemeData(
58-
thumbColor: WidgetStateProperty.resolveWith<Color?>(
59-
(Set<WidgetState> states) {
56+
thumbColor: WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
6057
if (states.contains(WidgetState.disabled)) {
6158
return null;
6259
}
@@ -65,8 +62,7 @@ class App extends StatelessWidget {
6562
}
6663
return null;
6764
}),
68-
trackColor: WidgetStateProperty.resolveWith<Color?>(
69-
(Set<WidgetState> states) {
65+
trackColor: WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
7066
if (states.contains(WidgetState.disabled)) {
7167
return null;
7268
}
@@ -77,8 +73,7 @@ class App extends StatelessWidget {
7773
}),
7874
),
7975
radioTheme: RadioThemeData(
80-
fillColor: WidgetStateProperty.resolveWith<Color?>(
81-
(Set<WidgetState> states) {
76+
fillColor: WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
8277
if (states.contains(WidgetState.disabled)) {
8378
return null;
8479
}
@@ -90,8 +85,7 @@ class App extends StatelessWidget {
9085
}),
9186
),
9287
checkboxTheme: CheckboxThemeData(
93-
fillColor: WidgetStateProperty.resolveWith<Color?>(
94-
(Set<WidgetState> states) {
88+
fillColor: WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
9589
if (states.contains(WidgetState.disabled)) {
9690
return null;
9791
}

lib/components/atoms/button.dart

+6-20
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ class PrimaryButton extends HookWidget {
2222
alignment: Alignment.center,
2323
children: [
2424
ElevatedButton(
25-
style: ButtonStyle(
26-
backgroundColor: WidgetStateProperty.resolveWith((statuses) {
25+
style: ButtonStyle(backgroundColor: WidgetStateProperty.resolveWith((statuses) {
2726
if (statuses.contains(WidgetState.disabled)) {
2827
return PilllColors.lightGray;
2928
}
@@ -46,8 +45,7 @@ class PrimaryButton extends HookWidget {
4645
}
4746
},
4847
child: ConstrainedBox(
49-
constraints: const BoxConstraints(
50-
maxHeight: 44, minHeight: 44, minWidth: 180),
48+
constraints: const BoxConstraints(maxHeight: 44, minHeight: 44, minWidth: 180),
5149
child: Center(
5250
child: Text(text,
5351
style: const TextStyle(
@@ -82,8 +80,7 @@ class UndoButton extends HookWidget {
8280
alignment: Alignment.center,
8381
children: [
8482
ElevatedButton(
85-
style: ButtonStyle(
86-
backgroundColor: WidgetStateProperty.resolveWith((statuses) {
83+
style: ButtonStyle(backgroundColor: WidgetStateProperty.resolveWith((statuses) {
8784
if (statuses.contains(WidgetState.disabled)) {
8885
return PilllColors.lightGray;
8986
}
@@ -106,8 +103,7 @@ class UndoButton extends HookWidget {
106103
}
107104
},
108105
child: ConstrainedBox(
109-
constraints: const BoxConstraints(
110-
maxHeight: 44, minHeight: 44, minWidth: 180, maxWidth: 180),
106+
constraints: const BoxConstraints(maxHeight: 44, minHeight: 44, minWidth: 180, maxWidth: 180),
111107
child: Center(
112108
child: Text(text,
113109
style: const TextStyle(
@@ -213,11 +209,7 @@ class InconspicuousButton extends HookWidget {
213209
child: Stack(
214210
alignment: Alignment.center,
215211
children: [
216-
Text(text,
217-
style: TextStyle(
218-
color: isProcessing.value
219-
? TextColor.lightGray
220-
: TextColor.gray)),
212+
Text(text, style: TextStyle(color: isProcessing.value ? TextColor.lightGray : TextColor.gray)),
221213
if (isProcessing.value) _Loading(),
222214
],
223215
),
@@ -381,13 +373,7 @@ class AlertButton extends HookWidget {
381373
children: [
382374
Text(
383375
text,
384-
style: TextStyle(
385-
fontFamily: FontFamily.japanese,
386-
fontWeight: FontWeight.w600,
387-
fontSize: 14,
388-
color: (isProcessing.value || onPressed == null)
389-
? TextColor.gray
390-
: TextColor.primary),
376+
style: TextStyle(fontFamily: FontFamily.japanese, fontWeight: FontWeight.w600, fontSize: 14, color: (isProcessing.value || onPressed == null) ? TextColor.gray : TextColor.primary),
391377
),
392378
if (isProcessing.value) _Loading(),
393379
],

lib/components/atoms/color.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ abstract class PilllColors {
3535
static const Color duration = Color(0xFF6A7DA5);
3636
static final Color overlay = secondary.withAlpha(20);
3737

38-
static final Color modalBackground =
39-
const Color(0xFF333333).withAlpha((255 * 0.7).round());
38+
static final Color modalBackground = const Color(0xFF333333).withAlpha((255 * 0.7).round());
4039
static const Color white = Colors.white;
4140

4241
static Color get disabledSheet => PilllColors.pillSheet;

lib/components/molecules/diagonal_striped_line.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ class DiagonalStripedLine extends CustomPainter {
88
DiagonalStripedLine({required this.color, required this.isNecessaryBorder});
99
@override
1010
void paint(Canvas canvas, Size size) {
11-
canvas.drawRect(
12-
Rect.fromLTWH(0, 0, size.width, size.height), Paint()..color = color);
11+
canvas.drawRect(Rect.fromLTWH(0, 0, size.width, size.height), Paint()..color = color);
1312
if (!isNecessaryBorder) {
1413
return;
1514
}

lib/components/molecules/dots_page_indicator.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ class DotsIndicator extends AnimatedWidget {
2222
}
2323

2424
Widget _buildDot(int index) {
25-
final isSelected =
26-
index == (controller.page ?? controller.initialPage).round();
25+
final isSelected = index == (controller.page ?? controller.initialPage).round();
2726
return SizedBox(
2827
width: 25,
2928
child: Center(

lib/components/molecules/dotted_line.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class DottedLine extends StatelessWidget {
2626
width: double.infinity,
2727
height: 1,
2828
child: LayoutBuilder(builder: (context, constraints) {
29-
final dashAndDashGapCount = _calculateDashAndDashGapCount(
30-
min(constraints.maxWidth, lineLength));
29+
final dashAndDashGapCount = _calculateDashAndDashGapCount(min(constraints.maxWidth, lineLength));
3130

3231
return Wrap(
3332
direction: Axis.horizontal,

lib/components/molecules/indicator.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class Indicator extends StatelessWidget {
1919
);
2020
}
2121
return const Center(
22-
child: CircularProgressIndicator(
23-
valueColor: AlwaysStoppedAnimation(PilllColors.secondary)),
22+
child: CircularProgressIndicator(valueColor: AlwaysStoppedAnimation(PilllColors.secondary)),
2423
);
2524
}
2625
}

lib/components/molecules/select_circle.dart

+2-11
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,8 @@ class SelectCircle extends StatelessWidget {
1010
Widget build(BuildContext context) {
1111
return Stack(
1212
children: [
13-
SizedBox(
14-
width: 20,
15-
height: 20,
16-
child: SvgPicture.asset("images/circle.line.svg")),
17-
if (isSelected)
18-
Positioned(
19-
top: 5,
20-
left: 5,
21-
width: 10,
22-
height: 10,
23-
child: SvgPicture.asset("images/circle.fill.svg")),
13+
SizedBox(width: 20, height: 20, child: SvgPicture.asset("images/circle.line.svg")),
14+
if (isSelected) Positioned(top: 5, left: 5, width: 10, height: 10, child: SvgPicture.asset("images/circle.fill.svg")),
2415
],
2516
);
2617
}

lib/components/organisms/calendar/band/calendar_band_function.dart

+10-27
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ import 'package:pilll/utils/datetime/day.dart';
1111
// 予定されている生理日
1212
// maxDateRangeCountは主にユニットテストの時に嬉しい引数になっているがプロダクションコードでもそのまま使用している
1313
// ユースケースとして大体の未来のものを返せれば良いので厳密な計算結果が欲しいわけではないので動作確認とユニットテストをしやすい方式をとっている
14-
List<DateRange> scheduledMenstruationDateRanges(PillSheetGroup? pillSheetGroup,
15-
Setting? setting, List<Menstruation> menstruations,
16-
[int maxDateRangeCount = 15]) {
14+
List<DateRange> scheduledMenstruationDateRanges(PillSheetGroup? pillSheetGroup, Setting? setting, List<Menstruation> menstruations, [int maxDateRangeCount = 15]) {
1715
if (pillSheetGroup == null || setting == null) {
1816
return [];
1917
}
@@ -25,31 +23,22 @@ List<DateRange> scheduledMenstruationDateRanges(PillSheetGroup? pillSheetGroup,
2523
}
2624
assert(maxDateRangeCount > 0);
2725

28-
final scheduledMenstruationDateRanges =
29-
pillSheetGroup.menstruationDateRanges(setting: setting);
26+
final scheduledMenstruationDateRanges = pillSheetGroup.menstruationDateRanges(setting: setting);
3027
List<DateRange> dateRanges = scheduledMenstruationDateRanges;
31-
final pillSheetGroupTotalPillCount = pillSheetGroup.pillSheetTypes
32-
.fold(0, (p, e) => p + e.typeInfo.totalCount);
28+
final pillSheetGroupTotalPillCount = pillSheetGroup.pillSheetTypes.fold(0, (p, e) => p + e.typeInfo.totalCount);
3329
for (var i = 1; i <= maxDateRangeCount; i++) {
3430
final offset = pillSheetGroupTotalPillCount * i;
35-
final dateRangesWithOffset = scheduledMenstruationDateRanges
36-
.map((e) => DateRange(e.begin.addDays(offset), e.end.addDays(offset)))
37-
.toList();
31+
final dateRangesWithOffset = scheduledMenstruationDateRanges.map((e) => DateRange(e.begin.addDays(offset), e.end.addDays(offset))).toList();
3832
dateRanges = [...dateRanges, ...dateRangesWithOffset];
3933
}
4034

4135
final menstruationDateRanges = menstruations.map((e) => e.dateRange);
4236
// `今日より前の生理予定日` と `すでに記録済みの生理予定日` はこのタイミングで除外する。scheduledMenstruationDateRangesを作成するタイミングだと後続のoffsetを含めた処理に影響が出る。
4337
// 例えば現在2シートめでこのwhere句でフィルタリングしてしまうと、1シート目とoffsetを考慮した生理予定日が表示されないようになる
44-
dateRanges = dateRanges
45-
.where((scheduledMenstruationRange) =>
46-
!scheduledMenstruationRange.end.isBefore(today()))
47-
.where((scheduledMenstruationRange) {
38+
dateRanges = dateRanges.where((scheduledMenstruationRange) => !scheduledMenstruationRange.end.isBefore(today())).where((scheduledMenstruationRange) {
4839
// すでに記録されている生理については除外したものを予定されている生理とする
4940
return menstruationDateRanges
50-
.where((menstruationDateRange) =>
51-
menstruationDateRange.inRange(scheduledMenstruationRange.begin) ||
52-
menstruationDateRange.inRange(scheduledMenstruationRange.end))
41+
.where((menstruationDateRange) => menstruationDateRange.inRange(scheduledMenstruationRange.begin) || menstruationDateRange.inRange(scheduledMenstruationRange.end))
5342
.isEmpty;
5443
}).toList();
5544

@@ -61,16 +50,13 @@ List<DateRange> scheduledMenstruationDateRanges(PillSheetGroup? pillSheetGroup,
6150
}
6251
}
6352

64-
List<DateRange> nextPillSheetDateRanges(PillSheetGroup pillSheetGroup,
65-
[int maxDateRangeCount = 15]) {
53+
List<DateRange> nextPillSheetDateRanges(PillSheetGroup pillSheetGroup, [int maxDateRangeCount = 15]) {
6654
if (pillSheetGroup.pillSheets.isEmpty) {
6755
return [];
6856
}
6957
assert(maxDateRangeCount > 0);
7058

71-
final totalPillCount = pillSheetGroup.pillSheets
72-
.map((e) => e.pillSheetType.totalCount)
73-
.reduce((value, element) => value + element);
59+
final totalPillCount = pillSheetGroup.pillSheets.map((e) => e.pillSheetType.totalCount).reduce((value, element) => value + element);
7460
var dateRanges = <DateRange>[];
7561
for (int i = 0; i < maxDateRangeCount; i++) {
7662
final offset = totalPillCount * i;
@@ -89,8 +75,7 @@ List<DateRange> nextPillSheetDateRanges(PillSheetGroup pillSheetGroup,
8975
}
9076
}
9177

92-
int bandLength(
93-
DateRange range, CalendarBandModel bandModel, bool isLineBreaked) {
78+
int bandLength(DateRange range, CalendarBandModel bandModel, bool isLineBreaked) {
9479
return range
9580
.union(
9681
DateRange(
@@ -107,7 +92,5 @@ bool isNecessaryLineBreak(DateTime date, DateRange dateRange) {
10792
}
10893

10994
int offsetForStartPositionAtLine(DateTime begin, DateRange dateRange) {
110-
return isNecessaryLineBreak(begin, dateRange)
111-
? 0
112-
: daysBetween(dateRange.begin.date(), begin.date());
95+
return isNecessaryLineBreak(begin, dateRange) ? 0 : daysBetween(dateRange.begin.date(), begin.date());
11396
}

lib/components/organisms/calendar/band/calendar_band_model.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ class CalendarScheduledMenstruationBandModel extends CalendarBandModel {
1212

1313
class CalendarMenstruationBandModel extends CalendarBandModel {
1414
final Menstruation menstruation;
15-
CalendarMenstruationBandModel(this.menstruation)
16-
: super(menstruation.beginDate, menstruation.endDate);
15+
CalendarMenstruationBandModel(this.menstruation) : super(menstruation.beginDate, menstruation.endDate);
1716
}
1817

1918
class CalendarNextPillSheetBandModel extends CalendarBandModel {

lib/components/organisms/calendar/band/calendar_band_provider.dart

+6-18
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import 'package:pilll/provider/pill_sheet_group.dart';
66
import 'package:pilll/provider/setting.dart';
77
import 'package:riverpod/riverpod.dart';
88

9-
final calendarMenstruationBandListProvider =
10-
Provider<AsyncValue<List<CalendarMenstruationBandModel>>>((ref) {
9+
final calendarMenstruationBandListProvider = Provider<AsyncValue<List<CalendarMenstruationBandModel>>>((ref) {
1110
final allMenstruations = ref.watch(allMenstruationProvider);
1211

1312
if (allMenstruations is AsyncLoading) {
@@ -16,17 +15,14 @@ final calendarMenstruationBandListProvider =
1615

1716
try {
1817
return AsyncValue.data(
19-
allMenstruations.value!
20-
.map((menstruation) => CalendarMenstruationBandModel(menstruation))
21-
.toList(),
18+
allMenstruations.value!.map((menstruation) => CalendarMenstruationBandModel(menstruation)).toList(),
2219
);
2320
} catch (error, stackTrace) {
2421
return AsyncValue.error(error, stackTrace);
2522
}
2623
});
2724

28-
final calendarScheduledMenstruationBandListProvider = Provider.autoDispose<
29-
AsyncValue<List<CalendarScheduledMenstruationBandModel>>>((ref) {
25+
final calendarScheduledMenstruationBandListProvider = Provider.autoDispose<AsyncValue<List<CalendarScheduledMenstruationBandModel>>>((ref) {
3026
return AsyncValueGroup.group3(
3127
ref.watch(latestPillSheetGroupProvider),
3228
ref.watch(settingProvider),
@@ -36,16 +32,11 @@ final calendarScheduledMenstruationBandListProvider = Provider.autoDispose<
3632
t.$1,
3733
t.$2,
3834
t.$3,
39-
)
40-
.map((dateRange) => CalendarScheduledMenstruationBandModel(
41-
dateRange.begin, dateRange.end))
42-
.toList(),
35+
).map((dateRange) => CalendarScheduledMenstruationBandModel(dateRange.begin, dateRange.end)).toList(),
4336
);
4437
});
4538

46-
final calendarNextPillSheetBandListProvider =
47-
Provider.autoDispose<AsyncValue<List<CalendarNextPillSheetBandModel>>>(
48-
(ref) {
39+
final calendarNextPillSheetBandListProvider = Provider.autoDispose<AsyncValue<List<CalendarNextPillSheetBandModel>>>((ref) {
4940
final pillSheetGroup = ref.watch(latestPillSheetGroupProvider);
5041

5142
if (pillSheetGroup is AsyncLoading) {
@@ -59,10 +50,7 @@ final calendarNextPillSheetBandListProvider =
5950

6051
try {
6152
return AsyncValue.data(
62-
nextPillSheetDateRanges(pillSheetGroupValue, 15)
63-
.map((dateRange) =>
64-
CalendarNextPillSheetBandModel(dateRange.begin, dateRange.end))
65-
.toList(),
53+
nextPillSheetDateRanges(pillSheetGroupValue, 15).map((dateRange) => CalendarNextPillSheetBandModel(dateRange.begin, dateRange.end)).toList(),
6654
);
6755
} catch (error, stackTrace) {
6856
return AsyncValue.error(error, stackTrace);

lib/components/organisms/calendar/band/calendar_next_pill_sheet_band.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class CalendarNextPillSheetBand extends StatelessWidget {
2626
child: Stack(
2727
children: [
2828
CustomPaint(
29-
painter: DiagonalStripedLine(
30-
color: PilllColors.duration, isNecessaryBorder: false),
29+
painter: DiagonalStripedLine(color: PilllColors.duration, isNecessaryBorder: false),
3130
size: Size(width, CalendarBandConst.height),
3231
),
3332
Container(

lib/components/organisms/calendar/day/calendar_day_record.dart

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,15 @@ class CalendarDayRecord extends StatelessWidget {
3131
SvgPicture.asset(
3232
"images/laugh.svg",
3333
height: 10,
34-
colorFilter:
35-
const ColorFilter.mode(PilllColors.green, BlendMode.srcIn),
34+
colorFilter: const ColorFilter.mode(PilllColors.green, BlendMode.srcIn),
3635
),
3736
);
3837
case PhysicalConditionStatus.bad:
3938
widgets.add(
4039
SvgPicture.asset(
4140
"images/angry.svg",
4241
height: 10,
43-
colorFilter:
44-
const ColorFilter.mode(PilllColors.danger, BlendMode.srcIn),
42+
colorFilter: const ColorFilter.mode(PilllColors.danger, BlendMode.srcIn),
4543
),
4644
);
4745
}

0 commit comments

Comments
 (0)