From 80754a487ed8c2b4b40b6991e2132f73906ac420 Mon Sep 17 00:00:00 2001 From: Rosyid Date: Fri, 10 Nov 2023 18:21:42 +0700 Subject: [PATCH] update linter error --- app/analysis_options.yaml | 2 ++ .../main/presentation/pages/main_page.dart | 3 ++- .../presentation/pages/splash_screen.dart | 1 - .../pages/quiz_exercise_page.dart | 2 +- .../presentation/bloc/quiz_result_cubit.dart | 2 ++ .../presentation/pages/quiz_result_page.dart | 11 +++++----- .../presentation/bloc/quiz_start_cubit.dart | 2 +- .../presentation/bloc/quiz_start_state.dart | 2 -- .../presentation/pages/quiz_start_page.dart | 22 +++++++++---------- 9 files changed, 25 insertions(+), 22 deletions(-) diff --git a/app/analysis_options.yaml b/app/analysis_options.yaml index 003b5d5..cf6796c 100644 --- a/app/analysis_options.yaml +++ b/app/analysis_options.yaml @@ -55,6 +55,8 @@ linter: prefer_relative_imports: true prefer_if_elements_to_conditional_expressions: false cascade_invocations: false + require_trailing_commas: false + depend_on_referenced_packages: false # DO avoid print calls in production code. # # https://dart-lang.github.io/linter/lints/avoid_print.html diff --git a/app/lib/features/main/presentation/pages/main_page.dart b/app/lib/features/main/presentation/pages/main_page.dart index 832ccd1..502b0cc 100644 --- a/app/lib/features/main/presentation/pages/main_page.dart +++ b/app/lib/features/main/presentation/pages/main_page.dart @@ -48,7 +48,8 @@ class _MainPageState extends State { children: [ TextSpan( text: toBeginningOfSentenceCase( - '${useData?['name']}!'), + '${useData?['name']}!', + ), style: FontTheme.blackTitleBold(), ), ], diff --git a/app/lib/features/onboarding/presentation/pages/splash_screen.dart b/app/lib/features/onboarding/presentation/pages/splash_screen.dart index af6291c..ef7c291 100644 --- a/app/lib/features/onboarding/presentation/pages/splash_screen.dart +++ b/app/lib/features/onboarding/presentation/pages/splash_screen.dart @@ -18,7 +18,6 @@ class SplashScreen extends StatelessWidget { }, child: Scaffold( body: Column( - crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Padding( diff --git a/app/lib/features/quiz_exercise/presentation/pages/quiz_exercise_page.dart b/app/lib/features/quiz_exercise/presentation/pages/quiz_exercise_page.dart index bdffcfa..32399c2 100644 --- a/app/lib/features/quiz_exercise/presentation/pages/quiz_exercise_page.dart +++ b/app/lib/features/quiz_exercise/presentation/pages/quiz_exercise_page.dart @@ -4,7 +4,7 @@ part of '_pages.dart'; class QuizExercisePage extends StatefulWidget { final String? quizParticipantId; - QuizExercisePage({super.key, this.quizParticipantId}); + const QuizExercisePage({super.key, this.quizParticipantId}); @override State createState() => _QuizExercisePageState(); diff --git a/app/lib/features/quiz_result/presentation/bloc/quiz_result_cubit.dart b/app/lib/features/quiz_result/presentation/bloc/quiz_result_cubit.dart index 6ee6e34..a5a92d0 100644 --- a/app/lib/features/quiz_result/presentation/bloc/quiz_result_cubit.dart +++ b/app/lib/features/quiz_result/presentation/bloc/quiz_result_cubit.dart @@ -1,3 +1,5 @@ +// ignore_for_file: depend_on_referenced_packages + import 'dart:async'; import 'package:bloc/bloc.dart'; diff --git a/app/lib/features/quiz_result/presentation/pages/quiz_result_page.dart b/app/lib/features/quiz_result/presentation/pages/quiz_result_page.dart index 8d6f516..c327c89 100644 --- a/app/lib/features/quiz_result/presentation/pages/quiz_result_page.dart +++ b/app/lib/features/quiz_result/presentation/pages/quiz_result_page.dart @@ -1,9 +1,11 @@ +// ignore_for_file: lines_longer_than_80_chars + part of '_pages.dart'; class QuizResultPage extends StatefulWidget { final String? quizParticipantId; - QuizResultPage({super.key, this.quizParticipantId}); + const QuizResultPage({super.key, this.quizParticipantId}); @override State createState() => _QuizResultPageState(); @@ -24,7 +26,6 @@ class _QuizResultPageState extends State { Padding( padding: const EdgeInsets.all(32), child: Column( - crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( Assets.bebrasPandaiText, @@ -48,7 +49,7 @@ class _QuizResultPageState extends State { height: 20, ), Container( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), decoration: BoxDecoration( border: Border.all(), color: Colors.grey), child: Column( @@ -56,7 +57,7 @@ class _QuizResultPageState extends State { Text('Total Nilai: ${state.attempt.score}'), Text( 'benar: ${state.attempt.totalCorrect}, salah: ${state.attempt.totalIncorrect}'), - Text('MANTAP!!!') + const Text('MANTAP!!!') ], ), ), @@ -69,7 +70,7 @@ class _QuizResultPageState extends State { ); } if (state is QuizResultNotAvailable) { - return Text('Result not available'); + return const Text('Result not available'); } if (state is QuizResultFailed) { return Text(state.error); diff --git a/app/lib/features/quiz_start/presentation/bloc/quiz_start_cubit.dart b/app/lib/features/quiz_start/presentation/bloc/quiz_start_cubit.dart index c0dbdb3..1043cbc 100644 --- a/app/lib/features/quiz_start/presentation/bloc/quiz_start_cubit.dart +++ b/app/lib/features/quiz_start/presentation/bloc/quiz_start_cubit.dart @@ -34,7 +34,7 @@ class QuizStartCubit extends Cubit { } } - void setAgreement(bool value) { + void setAgreement({required bool value}) { agreement = value; emit(QuizStartSuccess( participation: participation, quiz: quiz, agreement: agreement)); diff --git a/app/lib/features/quiz_start/presentation/bloc/quiz_start_state.dart b/app/lib/features/quiz_start/presentation/bloc/quiz_start_state.dart index dbb4e9b..0c20aab 100644 --- a/app/lib/features/quiz_start/presentation/bloc/quiz_start_state.dart +++ b/app/lib/features/quiz_start/presentation/bloc/quiz_start_state.dart @@ -14,7 +14,6 @@ class QuizStartSuccess extends QuizStartState { {required this.participation, required this.quiz, required this.agreement}); - @override List get props => [participation, quiz, agreement]; } @@ -23,6 +22,5 @@ class QuizStartFailed extends QuizStartState { QuizStartFailed(this.error); - @override List get props => [error]; } diff --git a/app/lib/features/quiz_start/presentation/pages/quiz_start_page.dart b/app/lib/features/quiz_start/presentation/pages/quiz_start_page.dart index 804799e..a56e8be 100644 --- a/app/lib/features/quiz_start/presentation/pages/quiz_start_page.dart +++ b/app/lib/features/quiz_start/presentation/pages/quiz_start_page.dart @@ -1,9 +1,11 @@ +// ignore_for_file: lines_longer_than_80_chars + part of '_pages.dart'; class QuizStartPage extends StatefulWidget { final String? quizParticipantId; - QuizStartPage({super.key, this.quizParticipantId}); + const QuizStartPage({super.key, this.quizParticipantId}); @override State createState() => _QuizStartPageState(); @@ -40,7 +42,7 @@ class _QuizStartPageState extends State { if (state is QuizStartFailed) { return Text(state.error); } - return Text('OK'); + return const Text('OK'); }, ), ], @@ -58,11 +60,9 @@ class _QuizStartPageState extends State { Row( children: [ Expanded( - flex: 1, child: Container( padding: const EdgeInsets.all(16), - decoration: - BoxDecoration(border: Border.all(color: Colors.black)), + decoration: BoxDecoration(border: Border.all()), child: Column( children: [ Text(state.quiz.title), @@ -75,10 +75,10 @@ class _QuizStartPageState extends State { const SizedBox( height: 10, ), - Text('Peraturan'), - Text('Pra Tantangan'), - Text('1. 12312312312'), - Text('2. qwerqwrqrwf'), + const Text('Peraturan'), + const Text('Pra Tantangan'), + const Text('1. 12312312312'), + const Text('2. qwerqwrqrwf'), ], ), ), @@ -94,10 +94,10 @@ class _QuizStartPageState extends State { value: state.agreement, onChanged: (value) { if (value != null) { - context.read().setAgreement(value); + context.read().setAgreement(value: value); } }), - Flexible( + const Flexible( child: Text( 'Saya telah membaca peraturan & akan mengerjakan dengan jujur')) ],