From d0305c20bdedae8d9a26e6afb90416f030ec69c2 Mon Sep 17 00:00:00 2001 From: Manjot Singh Sidhu Date: Wed, 6 Oct 2021 20:17:12 +0530 Subject: [PATCH] fix(lints): single quote and const constructor rules (#150) Fix lint rules for these rules: * prefer_single_quotes * prefer_const_constructors Signed-off-by: Manjot Sidhu --- analysis_options.yaml | 4 +--- lib/ui/components/cv_flat_button.dart | 2 +- lib/ui/components/cv_tab_bar.dart | 2 +- lib/ui/components/cv_typeahead_field.dart | 2 +- lib/ui/views/base_view.dart | 2 +- lib/ui/views/ib/components/ib_pop_quiz.dart | 2 +- lib/ui/views/ib/components/ib_pop_quiz_button.dart | 2 +- lib/ui/views/ib/ib_page_view.dart | 2 +- 8 files changed, 8 insertions(+), 10 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 35ed56a8..3b3ebb78 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -65,6 +65,4 @@ linter: prefer_typing_uninitialized_variables: false - prefer_const_constructors_in_immutables: false - - prefer_single_quotes: false + prefer_const_constructors_in_immutables: true diff --git a/lib/ui/components/cv_flat_button.dart b/lib/ui/components/cv_flat_button.dart index 24b80a8c..f2f44379 100644 --- a/lib/ui/components/cv_flat_button.dart +++ b/lib/ui/components/cv_flat_button.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; class CVFlatButton extends StatefulWidget { - CVFlatButton({ + const CVFlatButton({ @required Key key, @required this.triggerFunction, @required this.buttonText, diff --git a/lib/ui/components/cv_tab_bar.dart b/lib/ui/components/cv_tab_bar.dart index e9e07e75..cb93d0f5 100644 --- a/lib/ui/components/cv_tab_bar.dart +++ b/lib/ui/components/cv_tab_bar.dart @@ -4,7 +4,7 @@ class CVTabBar extends StatelessWidget implements PreferredSizeWidget { final Color color; final TabBar tabBar; - CVTabBar({this.color, this.tabBar}); + const CVTabBar({this.color, this.tabBar}); @override Size get preferredSize => tabBar.preferredSize; diff --git a/lib/ui/components/cv_typeahead_field.dart b/lib/ui/components/cv_typeahead_field.dart index 55d97117..0671f1dc 100644 --- a/lib/ui/components/cv_typeahead_field.dart +++ b/lib/ui/components/cv_typeahead_field.dart @@ -25,7 +25,7 @@ class CVTypeAheadField extends StatelessWidget { /// When a [TextInputType] is not specified, it defaults to [TextInputType.text] /// /// When `maxLines` is not specified, it defaults to 1 - CVTypeAheadField({ + const CVTypeAheadField({ Key key, @required this.label, this.type = TextInputType.text, diff --git a/lib/ui/views/base_view.dart b/lib/ui/views/base_view.dart index dec64615..e9c510c0 100644 --- a/lib/ui/views/base_view.dart +++ b/lib/ui/views/base_view.dart @@ -9,7 +9,7 @@ class BaseView extends StatefulWidget { final Function(T) onModelDestroy; final T model; - BaseView({ + const BaseView({ @required this.builder, this.onModelReady, this.onModelDestroy, diff --git a/lib/ui/views/ib/components/ib_pop_quiz.dart b/lib/ui/views/ib/components/ib_pop_quiz.dart index 54928288..60da8f72 100644 --- a/lib/ui/views/ib/components/ib_pop_quiz.dart +++ b/lib/ui/views/ib/components/ib_pop_quiz.dart @@ -8,7 +8,7 @@ class IbPopQuiz extends StatelessWidget { final BuildContext context; final List questions; - IbPopQuiz({this.context, this.questions}); + const IbPopQuiz({this.context, this.questions}); Widget _buildQuestion(int questionNumber, IbPopQuizQuestion question) { var buttonsWidgets = []; diff --git a/lib/ui/views/ib/components/ib_pop_quiz_button.dart b/lib/ui/views/ib/components/ib_pop_quiz_button.dart index a420296c..10676c9c 100644 --- a/lib/ui/views/ib/components/ib_pop_quiz_button.dart +++ b/lib/ui/views/ib/components/ib_pop_quiz_button.dart @@ -4,7 +4,7 @@ class IbPopQuizButton extends StatefulWidget { final String content; final bool isCorrect; - IbPopQuizButton({ + const IbPopQuizButton({ @required this.content, @required this.isCorrect, }); diff --git a/lib/ui/views/ib/ib_page_view.dart b/lib/ui/views/ib/ib_page_view.dart index 205876b1..b9c310d0 100644 --- a/lib/ui/views/ib/ib_page_view.dart +++ b/lib/ui/views/ib/ib_page_view.dart @@ -38,7 +38,7 @@ class IbPageView extends StatefulWidget { final SetPageCallback setPage; final IbChapter chapter; - IbPageView({ + const IbPageView({ @required Key key, @required this.tocCallback, @required this.chapter,