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

Flutter 3.10にした時のwarningを直す #896

Merged
merged 11 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class PillSheetGroupSelectPillSheetTypePage extends StatelessWidget {
controller: scrollController,
children: [
const SizedBox(height: 25),
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.start,
children: const [
children: [
SizedBox(width: 16),
Text(
"ピルの種類を選択",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class PillSheetTypeAddButton extends StatelessWidget {
child: Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(vertical: 13),
child: Row(
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
children: [
Icon(
Icons.add,
color: TextColor.noshime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class IntiialSettingPremiumTrialStartPage extends HookConsumerWidget {
child: Column(
children: [
const SizedBox(height: 1),
Column(
children: const [
const Column(
children: [
Text(
"\\ 通知から服用記録ができます /",
style: TextStyle(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:pilll/components/atoms/color.dart';
import 'package:pilll/components/atoms/font.dart';
import 'package:pilll/components/atoms/text_color.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ class AddPillSheetGroupEmptyFrame extends StatelessWidget {
"images/empty_frame.svg",
),
),
Center(
const Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
Icon(Icons.add, color: TextColor.noshime),
Text("ピルシートを追加",
style: TextStyle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class EndedPillSheet extends StatelessWidget {
child: Container(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
color: PilllColors.primary,
child: Center(
child: const Center(
child: Column(
children: const [
children: [
Text("ピルシートが終了しました",
style: TextStyle(
fontFamily: FontFamily.japanese,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class RecommendSignupAnnouncementBar extends HookConsumerWidget {
padding: EdgeInsets.zero,
),
const Spacer(),
Column(
children: const [
const Column(
children: [
Text(
"機種変更やスマホ紛失時に備えて\nアカウント登録しませんか?",
style: TextStyle(fontFamily: FontFamily.japanese, fontWeight: FontWeight.w700, fontSize: 12, color: TextColor.white),
Expand Down
1 change: 0 additions & 1 deletion lib/features/record/record_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ class RecordPage extends HookConsumerWidget {
}
}

// TODO: pillSheetGroup.activedPillSheet.restDurations を更新したときに画面が変更されるかを確認する。(timestampを使っていた部分のテスト)
class RecordPageBody extends HookConsumerWidget {
final PillSheetGroup? pillSheetGroup;
final Setting setting;
Expand Down
6 changes: 3 additions & 3 deletions lib/features/release_note/release_note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ class ReleaseNote extends StatelessWidget {
),
],
),
Padding(
padding: const EdgeInsets.only(top: 25, left: 25, right: 25),
const Padding(
padding: EdgeInsets.only(top: 25, left: 25, right: 25),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
children: [
Text(
'''
ホームウィジェットを追加できるようになりました。本日服用するピルの番号が一目でわかるようになっています
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class ChurnSurveyCompleteDialog extends StatelessWidget {
),
textAlign: TextAlign.center,
),
content: Column(
content: const Column(
mainAxisSize: MainAxisSize.min,
children: const [
children: [
Text(
"いただいた意見は今後の改善へと活用させていただきます。",
style: TextStyle(
Expand Down
4 changes: 2 additions & 2 deletions lib/features/settings/components/rows/health_care.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class HealthCareRow extends StatelessWidget {
Widget build(BuildContext context) {
return ListTile(
minVerticalPadding: 9,
title: Row(
children: const [
title: const Row(
children: [
Text("ヘルスケア連携",
style: TextStyle(
fontFamily: FontFamily.roboto,
Expand Down
4 changes: 2 additions & 2 deletions lib/features/settings/components/rows/quick_record.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class QuickRecordRow extends StatelessWidget {
Widget build(BuildContext context) {
return ListTile(
minVerticalPadding: 9,
title: Row(
children: const [
title: const Row(
children: [
Text("クイックレコード",
style: TextStyle(
fontFamily: FontFamily.roboto,
Expand Down
5 changes: 2 additions & 3 deletions lib/features/settings/setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,8 @@ class SettingPageBody extends StatelessWidget {
trialDeadlineDate: premiumAndTrial.trialDeadlineDate,
),
_separator(),
// TODO: Remove (Environment.isDevelopment)
if (premiumAndTrial.isPremium || (Environment.isDevelopment)) ...[
AboutChurn(),
if (premiumAndTrial.isPremium) ...[
const AboutChurn(),
_separator(),
],
],
Expand Down
8 changes: 4 additions & 4 deletions lib/features/store_review/pre_store_review_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ class _ThanksDialog extends StatelessWidget {
Icons.thumb_up,
color: PilllColors.primary,
),
content: Column(
content: const Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: const [
children: [
Text("ご協力ありがとうございます",
style: TextStyle(
fontFamily: FontFamily.japanese,
Expand Down Expand Up @@ -221,9 +221,9 @@ class _CompleteDialog extends StatelessWidget {
),
textAlign: TextAlign.center,
),
content: Column(
content: const Column(
mainAxisSize: MainAxisSize.min,
children: const [
children: [
Text(
"いただいた意見は今後の改善へと活用させていただきます。",
style: TextStyle(
Expand Down
1 change: 0 additions & 1 deletion lib/provider/menstruation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class BeginMenstruation {
}
}

// TODO: HealthKit系の処理がおかしい気がしたので下のコードから変えているのでテスト
final setMenstruationProvider = Provider((ref) => SetMenstruation(ref.watch(databaseProvider)));

class SetMenstruation {
Expand Down
6 changes: 3 additions & 3 deletions lib/utils/local_notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class RegisterReminderLocalNotification {
// - 休薬期間の通知のON/OFF
// - 休薬終了後
// - 初期設定完了後
// - FIXME: サインイン → HomePageで通知を登録しなおしているが、必要なエンティティの読み込みよりも先に行われる時がある。だが、ニッチなケースなので一回無視。何かアクションが起きたら登録しなおされるし
// - NOTE: サインイン → HomePageで通知を登録しなおしているが、必要なエンティティの読み込みよりも先に行われる時がある。だが、ニッチなケースなので一回無視。何かアクションが起きたら登録しなおされるし
// - 番号変更後
// - リマインダーの通知がOFF->ONになった時
// - 連番モードで服用日数の表示を変更した時
Expand Down Expand Up @@ -344,7 +344,7 @@ class RegisterReminderLocalNotification {
presentSound: true,
),
),
androidAllowWhileIdle: true,
androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle,
uiLocalNotificationDateInterpretation: UILocalNotificationDateInterpretation.absoluteTime,
);
} catch (e, st) {
Expand Down Expand Up @@ -457,7 +457,7 @@ extension ScheduleLocalNotificationService on LocalNotificationService {
sound: "becho.caf",
),
),
androidAllowWhileIdle: true,
androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle,
uiLocalNotificationDateInterpretation: UILocalNotificationDateInterpretation.absoluteTime,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ void main() {
Environment.isTest = true;
});
group("check count of pill mark line widget", () {
testWidgets('when selected 3 line pill sheet type',
(WidgetTester tester) async {
SupportedDeviceType.iPhone5SE2nd.binding(tester.binding.window);
testWidgets('when selected 3 line pill sheet type', (WidgetTester tester) async {
SupportedDeviceType.iPhone5SE2nd.binding(tester.view);

const weekdayLines =
PillSheetViewWeekdayLine(firstWeekday: Weekday.Sunday);
const weekdayLines = PillSheetViewWeekdayLine(firstWeekday: Weekday.Sunday);
const pillSheetType = PillSheetType.pillsheet_21_0;
final widget = PillSheetViewLayout(
weekdayLines: weekdayLines,
Expand All @@ -42,21 +40,18 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: SizedBox(
height: PillSheetViewLayout.calcHeight(
pillSheetType.numberOfLineInPillSheet, false),
height: PillSheetViewLayout.calcHeight(pillSheetType.numberOfLineInPillSheet, false),
child: widget,
),
),
);
await tester.pumpAndSettle(const Duration(milliseconds: 500));

expect(find.byWidgetPredicate((widget) => widget is _TestWidget),
findsNWidgets(3));
expect(find.byWidgetPredicate((widget) => widget is _TestWidget), findsNWidgets(3));
});
});
testWidgets('when selected 4 line pill sheet type',
(WidgetTester tester) async {
SupportedDeviceType.iPhone5SE2nd.binding(tester.binding.window);
testWidgets('when selected 4 line pill sheet type', (WidgetTester tester) async {
SupportedDeviceType.iPhone5SE2nd.binding(tester.view);

const weekdayLines = PillSheetViewWeekdayLine(firstWeekday: Weekday.Sunday);
const pillSheetType = PillSheetType.pillsheet_28_0;
Expand All @@ -70,15 +65,13 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: SizedBox(
height: PillSheetViewLayout.calcHeight(
pillSheetType.numberOfLineInPillSheet, false),
height: PillSheetViewLayout.calcHeight(pillSheetType.numberOfLineInPillSheet, false),
child: widget,
),
),
);
await tester.pumpAndSettle(const Duration(milliseconds: 500));

expect(find.byWidgetPredicate((widget) => widget is _TestWidget),
findsNWidgets(4));
expect(find.byWidgetPredicate((widget) => widget is _TestWidget), findsNWidgets(4));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ void main() {
Environment.isTest = true;
});
group("for check appearance pill mark types", () {
testWidgets('pill sheet types has rest duration',
(WidgetTester tester) async {
SupportedDeviceType.iPhone5SE2nd.binding(tester.binding.window);
testWidgets('pill sheet types has rest duration', (WidgetTester tester) async {
SupportedDeviceType.iPhone5SE2nd.binding(tester.view);

const pillSheetType = PillSheetType.pillsheet_21;
final widget = SettingPillSheetView(
Expand All @@ -39,15 +38,12 @@ void main() {
);
await tester.pumpAndSettle(const Duration(milliseconds: 500));

expect(find.byWidgetPredicate((widget) => widget is NormalPillMark),
findsNWidgets(21));
expect(find.byWidgetPredicate((widget) => widget is RestPillMark),
findsNWidgets(7));
expect(find.byWidgetPredicate((widget) => widget is NormalPillMark), findsNWidgets(21));
expect(find.byWidgetPredicate((widget) => widget is RestPillMark), findsNWidgets(7));
});

testWidgets('pill sheet types has fake duration',
(WidgetTester tester) async {
SupportedDeviceType.iPhone5SE2nd.binding(tester.binding.window);
testWidgets('pill sheet types has fake duration', (WidgetTester tester) async {
SupportedDeviceType.iPhone5SE2nd.binding(tester.view);

const pillSheetType = PillSheetType.pillsheet_28_4;
final widget = SettingPillSheetView(
Expand All @@ -66,15 +62,12 @@ void main() {
);
await tester.pumpAndSettle(const Duration(milliseconds: 500));

expect(find.byWidgetPredicate((widget) => widget is NormalPillMark),
findsNWidgets(24));
expect(find.byWidgetPredicate((widget) => widget is FakePillMark),
findsNWidgets(4));
expect(find.byWidgetPredicate((widget) => widget is NormalPillMark), findsNWidgets(24));
expect(find.byWidgetPredicate((widget) => widget is FakePillMark), findsNWidgets(4));
});

testWidgets('pill sheet types only normal type',
(WidgetTester tester) async {
SupportedDeviceType.iPhone5SE2nd.binding(tester.binding.window);
testWidgets('pill sheet types only normal type', (WidgetTester tester) async {
SupportedDeviceType.iPhone5SE2nd.binding(tester.view);

const pillSheetType = PillSheetType.pillsheet_28_0;
final widget = SettingPillSheetView(
Expand All @@ -93,14 +86,12 @@ void main() {
);
await tester.pumpAndSettle(const Duration(milliseconds: 500));

expect(find.byWidgetPredicate((widget) => widget is NormalPillMark),
findsNWidgets(27));
expect(find.byWidgetPredicate((widget) => widget is SelectedPillMark),
findsNWidgets(1));
expect(find.byWidgetPredicate((widget) => widget is NormalPillMark), findsNWidgets(27));
expect(find.byWidgetPredicate((widget) => widget is SelectedPillMark), findsNWidgets(1));
});

testWidgets('exists selected pill number', (WidgetTester tester) async {
SupportedDeviceType.iPhone5SE2nd.binding(tester.binding.window);
SupportedDeviceType.iPhone5SE2nd.binding(tester.view);

const pillSheetType = PillSheetType.pillsheet_28_0;
final widget = SettingPillSheetView(
Expand All @@ -119,8 +110,7 @@ void main() {
);
await tester.pumpAndSettle(const Duration(milliseconds: 500));

expect(find.byWidgetPredicate((widget) => widget is NormalPillMark),
findsNWidgets(28));
expect(find.byWidgetPredicate((widget) => widget is NormalPillMark), findsNWidgets(28));
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ void main() {
setUp(() {
TestWidgetsFlutterBinding.ensureInitialized();
SharedPreferences.setMockInitialValues({});
WidgetsBinding.instance.renderView.configuration = TestViewConfiguration(size: const Size(375.0, 667.0));
WidgetsBinding.instance.renderView.configuration = TestViewConfiguration.fromView(
view: WidgetsBinding.instance.platformDispatcher.views.single,
size: const Size(375.0, 667.0),
);
});
group("Appearance Next Sheet Label", () {
testWidgets('when showing 新しいシート開始 ▶︎', (WidgetTester tester) async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized();
SharedPreferences.setMockInitialValues({});

timezoneChannel.setMockMethodCallHandler((MethodCall methodCall) async {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(timezoneChannel, (MethodCall methodCall) async {
return 'Asia/Tokyo';
});
});

tearDown(() {
timezoneChannel.setMockMethodCallHandler(null);
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(timezoneChannel, null);
});
group("#selectedFirstPillSheetType", () {
test("when first selected", () {
Expand Down
4 changes: 2 additions & 2 deletions test/features/initial_setting/initial_setting_state_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized();
SharedPreferences.setMockInitialValues({});

timezoneChannel.setMockMethodCallHandler((MethodCall methodCall) async {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(timezoneChannel, (MethodCall methodCall) async {
return 'Asia/Tokyo';
});
});

tearDown(() {
timezoneChannel.setMockMethodCallHandler(null);
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(timezoneChannel, null);
});
group("#InitialSettingState.buildPillSheet", () {
test("it is builded pillSheet.gropuIndex == todayPillNumber.pageIndex ", () {
Expand Down
Loading
Loading