diff --git a/analysis_options.yaml b/analysis_options.yaml index 0fbdfe66..796ecda8 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -35,8 +35,6 @@ linter: non_constant_identifier_names: false - use_key_in_widget_constructors: false - constant_identifier_names: false prefer_typing_uninitialized_variables: false diff --git a/lib/main.dart b/lib/main.dart index 6376e97c..edf93abd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -19,10 +19,12 @@ Future main() async { // Init Hive await locator().init(); - runApp(CircuitVerseMobile()); + runApp(const CircuitVerseMobile()); } class CircuitVerseMobile extends StatelessWidget { + const CircuitVerseMobile({Key key}) : super(key: key); + // This widget is the root of CircuitVerse Mobile. @override Widget build(BuildContext context) { @@ -77,7 +79,7 @@ class CircuitVerseMobile extends StatelessWidget { debugShowCheckedModeBanner: false, onGenerateRoute: CVRouter.generateRoute, theme: ThemeProvider.themeOf(themeContext).data, - home: StartUpView(), + home: const StartUpView(), ), ), ), diff --git a/lib/ui/components/cv_tab_bar.dart b/lib/ui/components/cv_tab_bar.dart index 850634fc..db643ea6 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; - const CVTabBar({this.color, this.tabBar}); + const CVTabBar({Key key, this.color, this.tabBar}) : super(key: key); @override Size get preferredSize => tabBar.preferredSize; diff --git a/lib/ui/views/about/about_view.dart b/lib/ui/views/about/about_view.dart index 44597c50..5bcb96a2 100644 --- a/lib/ui/views/about/about_view.dart +++ b/lib/ui/views/about/about_view.dart @@ -16,6 +16,8 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class AboutView extends StatefulWidget { static const String id = 'about_view'; + const AboutView({Key key}) : super(key: key); + @override _AboutViewState createState() => _AboutViewState(); } diff --git a/lib/ui/views/authentication/forgot_password_view.dart b/lib/ui/views/authentication/forgot_password_view.dart index f2d4e077..1b2cd9b0 100644 --- a/lib/ui/views/authentication/forgot_password_view.dart +++ b/lib/ui/views/authentication/forgot_password_view.dart @@ -14,6 +14,8 @@ import 'package:mobile_app/viewmodels/authentication/forgot_password_viewmodel.d class ForgotPasswordView extends StatefulWidget { static const String id = 'forgot_password_view'; + + const ForgotPasswordView({Key key}) : super(key: key); @override _ForgotPasswordViewState createState() => _ForgotPasswordViewState(); } diff --git a/lib/ui/views/authentication/login_view.dart b/lib/ui/views/authentication/login_view.dart index b984e3e6..ae921854 100644 --- a/lib/ui/views/authentication/login_view.dart +++ b/lib/ui/views/authentication/login_view.dart @@ -16,6 +16,8 @@ import 'package:mobile_app/viewmodels/authentication/login_viewmodel.dart'; class LoginView extends StatefulWidget { static const String id = 'login_view'; + const LoginView({Key key}) : super(key: key); + @override _LoginViewState createState() => _LoginViewState(); } diff --git a/lib/ui/views/authentication/signup_view.dart b/lib/ui/views/authentication/signup_view.dart index 90396219..5a005be1 100644 --- a/lib/ui/views/authentication/signup_view.dart +++ b/lib/ui/views/authentication/signup_view.dart @@ -15,6 +15,8 @@ import 'package:mobile_app/viewmodels/authentication/signup_viewmodel.dart'; class SignupView extends StatefulWidget { static const String id = 'signup_view'; + const SignupView({Key key}) : super(key: key); + @override _SignupViewState createState() => _SignupViewState(); } diff --git a/lib/ui/views/base_view.dart b/lib/ui/views/base_view.dart index e9c510c0..66355158 100644 --- a/lib/ui/views/base_view.dart +++ b/lib/ui/views/base_view.dart @@ -10,11 +10,12 @@ class BaseView extends StatefulWidget { final T model; const BaseView({ + Key key, @required this.builder, this.onModelReady, this.onModelDestroy, this.model, - }); + }) : super(key: key); @override _BaseViewState createState() => _BaseViewState(); diff --git a/lib/ui/views/cv_landing_view.dart b/lib/ui/views/cv_landing_view.dart index 413f5ee0..d29c2688 100644 --- a/lib/ui/views/cv_landing_view.dart +++ b/lib/ui/views/cv_landing_view.dart @@ -25,6 +25,8 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class CVLandingView extends StatefulWidget { static const String id = 'cv_landing_view'; + const CVLandingView({Key key}) : super(key: key); + @override _CVLandingViewState createState() => _CVLandingViewState(); } @@ -35,13 +37,13 @@ class _CVLandingViewState extends State { int _selectedIndex = 0; final List _items = [ - HomeView(), + const HomeView(), const FeaturedProjectsView(showAppBar: false), - AboutView(), + const AboutView(), const ContributorsView(showAppBar: false), const TeachersView(showAppBar: false), const ProfileView(), - MyGroupsView(), + const MyGroupsView(), ]; void setSelectedIndexTo(int index) { diff --git a/lib/ui/views/groups/my_groups_view.dart b/lib/ui/views/groups/my_groups_view.dart index 0d18397b..225c7d07 100644 --- a/lib/ui/views/groups/my_groups_view.dart +++ b/lib/ui/views/groups/my_groups_view.dart @@ -17,6 +17,8 @@ import 'package:mobile_app/viewmodels/groups/my_groups_viewmodel.dart'; class MyGroupsView extends StatefulWidget { static const String id = 'my_groups_view'; + const MyGroupsView({Key key}) : super(key: key); + @override _MyGroupsViewState createState() => _MyGroupsViewState(); } diff --git a/lib/ui/views/groups/new_group_view.dart b/lib/ui/views/groups/new_group_view.dart index 1d545d78..071fd4f6 100644 --- a/lib/ui/views/groups/new_group_view.dart +++ b/lib/ui/views/groups/new_group_view.dart @@ -14,6 +14,8 @@ import 'package:mobile_app/viewmodels/groups/new_group_viewmodel.dart'; class NewGroupView extends StatefulWidget { static const String id = 'new_group_view'; + const NewGroupView({Key key}) : super(key: key); + @override _NewGroupViewState createState() => _NewGroupViewState(); } diff --git a/lib/ui/views/home/home_view.dart b/lib/ui/views/home/home_view.dart index 5a6e8a76..19556170 100644 --- a/lib/ui/views/home/home_view.dart +++ b/lib/ui/views/home/home_view.dart @@ -12,6 +12,8 @@ import 'package:mobile_app/viewmodels/home/home_viewmodel.dart'; class HomeView extends StatefulWidget { static const String id = 'home_view'; + const HomeView({Key key}) : super(key: key); + @override _HomeViewState createState() => _HomeViewState(); } diff --git a/lib/ui/views/ib/components/ib_pop_quiz.dart b/lib/ui/views/ib/components/ib_pop_quiz.dart index 60da8f72..828d196d 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; - const IbPopQuiz({this.context, this.questions}); + const IbPopQuiz({Key key, this.context, this.questions}) : super(key: key); 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 b0c62550..27c782fc 100644 --- a/lib/ui/views/ib/components/ib_pop_quiz_button.dart +++ b/lib/ui/views/ib/components/ib_pop_quiz_button.dart @@ -5,9 +5,10 @@ class IbPopQuizButton extends StatefulWidget { final bool isCorrect; const IbPopQuizButton({ + Key key, @required this.content, @required this.isCorrect, - }); + }) : super(key: key); @override IbPopQuizButtonState createState() => IbPopQuizButtonState(); diff --git a/lib/ui/views/ib/ib_landing_view.dart b/lib/ui/views/ib/ib_landing_view.dart index da2a1dff..13a2f818 100644 --- a/lib/ui/views/ib/ib_landing_view.dart +++ b/lib/ui/views/ib/ib_landing_view.dart @@ -12,6 +12,8 @@ import 'package:theme_provider/theme_provider.dart'; class IbLandingView extends StatefulWidget { static const String id = 'ib_landing_view'; + const IbLandingView({Key key}) : super(key: key); + @override _IbLandingViewState createState() => _IbLandingViewState(); } diff --git a/lib/ui/views/profile/edit_profile_view.dart b/lib/ui/views/profile/edit_profile_view.dart index a8df3724..be2270bc 100644 --- a/lib/ui/views/profile/edit_profile_view.dart +++ b/lib/ui/views/profile/edit_profile_view.dart @@ -15,6 +15,8 @@ import 'package:mobile_app/viewmodels/profile/edit_profile_viewmodel.dart'; class EditProfileView extends StatefulWidget { static const String id = 'edit_profile_view'; + const EditProfileView({Key key}) : super(key: key); + @override _EditProfileViewState createState() => _EditProfileViewState(); } diff --git a/lib/ui/views/startup_view.dart b/lib/ui/views/startup_view.dart index c1672eb5..ab60b387 100644 --- a/lib/ui/views/startup_view.dart +++ b/lib/ui/views/startup_view.dart @@ -3,6 +3,8 @@ import 'package:mobile_app/ui/views/base_view.dart'; import 'package:mobile_app/viewmodels/startup/startup_viewmodel.dart'; class StartUpView extends StatelessWidget { + const StartUpView({Key key}) : super(key: key); + @override Widget build(BuildContext context) { return BaseView( diff --git a/lib/utils/router.dart b/lib/utils/router.dart index 89d0f00e..6086b9b1 100644 --- a/lib/utils/router.dart +++ b/lib/utils/router.dart @@ -30,13 +30,13 @@ class CVRouter { static Route generateRoute(RouteSettings settings) { switch (settings.name) { case SignupView.id: - return MaterialPageRoute(builder: (_) => SignupView()); + return MaterialPageRoute(builder: (_) => const SignupView()); case LoginView.id: - return MaterialPageRoute(builder: (_) => LoginView()); + return MaterialPageRoute(builder: (_) => const LoginView()); case ForgotPasswordView.id: - return MaterialPageRoute(builder: (_) => ForgotPasswordView()); + return MaterialPageRoute(builder: (_) => const ForgotPasswordView()); case CVLandingView.id: - return MaterialPageRoute(builder: (_) => CVLandingView()); + return MaterialPageRoute(builder: (_) => const CVLandingView()); case TeachersView.id: return MaterialPageRoute(builder: (_) => const TeachersView()); case ContributorsView.id: @@ -56,7 +56,7 @@ class CVRouter { ), ); case EditProfileView.id: - return MaterialPageRoute(builder: (_) => EditProfileView()); + return MaterialPageRoute(builder: (_) => const EditProfileView()); case ProjectDetailsView.id: var _project = settings.arguments as Project; return MaterialPageRoute( @@ -72,7 +72,7 @@ class CVRouter { ), ); case MyGroupsView.id: - return MaterialPageRoute(builder: (_) => MyGroupsView()); + return MaterialPageRoute(builder: (_) => const MyGroupsView()); case GroupDetailsView.id: var group = settings.arguments as Group; return MaterialPageRoute( @@ -81,7 +81,7 @@ class CVRouter { ), ); case NewGroupView.id: - return MaterialPageRoute(builder: (_) => NewGroupView()); + return MaterialPageRoute(builder: (_) => const NewGroupView()); case EditGroupView.id: var group = settings.arguments as Group; return MaterialPageRoute( @@ -111,7 +111,7 @@ class CVRouter { ), ); case IbLandingView.id: - return MaterialPageRoute(builder: (_) => IbLandingView()); + return MaterialPageRoute(builder: (_) => const IbLandingView()); case ProjectPreviewFullScreen.id: var _project = settings.arguments as Project; return MaterialPageRoute( diff --git a/test/ui_tests/about/about_view_test.dart b/test/ui_tests/about/about_view_test.dart index 545285db..0525ee30 100644 --- a/test/ui_tests/about/about_view_test.dart +++ b/test/ui_tests/about/about_view_test.dart @@ -38,7 +38,7 @@ void main() { locale: const Locale('en'), onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: AboutView(), + home: const AboutView(), ), ); diff --git a/test/ui_tests/authentication/forgot_password_view_test.dart b/test/ui_tests/authentication/forgot_password_view_test.dart index 7f1a0896..a31c2d69 100644 --- a/test/ui_tests/authentication/forgot_password_view_test.dart +++ b/test/ui_tests/authentication/forgot_password_view_test.dart @@ -28,7 +28,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: ForgotPasswordView(), + home: const ForgotPasswordView(), ), ); diff --git a/test/ui_tests/authentication/login_view_test.dart b/test/ui_tests/authentication/login_view_test.dart index ca5890f2..e2ea46dc 100644 --- a/test/ui_tests/authentication/login_view_test.dart +++ b/test/ui_tests/authentication/login_view_test.dart @@ -30,7 +30,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: LoginView(), + home: const LoginView(), ), ); diff --git a/test/ui_tests/authentication/signup_view_test.dart b/test/ui_tests/authentication/signup_view_test.dart index a058a6d6..df0dea5f 100644 --- a/test/ui_tests/authentication/signup_view_test.dart +++ b/test/ui_tests/authentication/signup_view_test.dart @@ -28,7 +28,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: SignupView(), + home: const SignupView(), ), ); diff --git a/test/ui_tests/groups/my_groups_view_test.dart b/test/ui_tests/groups/my_groups_view_test.dart index 8b1bdc97..4e45995a 100644 --- a/test/ui_tests/groups/my_groups_view_test.dart +++ b/test/ui_tests/groups/my_groups_view_test.dart @@ -57,7 +57,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: MyGroupsView(), + home: const MyGroupsView(), ), ); diff --git a/test/ui_tests/groups/new_group_view_test.dart b/test/ui_tests/groups/new_group_view_test.dart index 1d796480..2fabf86a 100644 --- a/test/ui_tests/groups/new_group_view_test.dart +++ b/test/ui_tests/groups/new_group_view_test.dart @@ -31,7 +31,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: NewGroupView(), + home: const NewGroupView(), ), ); diff --git a/test/ui_tests/home/home_view_test.dart b/test/ui_tests/home/home_view_test.dart index 3d8711eb..8168c52c 100644 --- a/test/ui_tests/home/home_view_test.dart +++ b/test/ui_tests/home/home_view_test.dart @@ -28,7 +28,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: HomeView(), + home: const HomeView(), ), ); diff --git a/test/ui_tests/ib/ib_landing_view_test.dart b/test/ui_tests/ib/ib_landing_view_test.dart index 1f5690e3..6881fe1a 100644 --- a/test/ui_tests/ib/ib_landing_view_test.dart +++ b/test/ui_tests/ib/ib_landing_view_test.dart @@ -62,7 +62,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: IbLandingView(), + home: const IbLandingView(), ), ); diff --git a/test/ui_tests/profile/edit_profile_view_test.dart b/test/ui_tests/profile/edit_profile_view_test.dart index 9ce32808..16b75da5 100644 --- a/test/ui_tests/profile/edit_profile_view_test.dart +++ b/test/ui_tests/profile/edit_profile_view_test.dart @@ -42,7 +42,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: EditProfileView(), + home: const EditProfileView(), ), ); diff --git a/test/ui_tests/startup/startup_view_test.dart b/test/ui_tests/startup/startup_view_test.dart index 954c980f..9f3b5a06 100644 --- a/test/ui_tests/startup/startup_view_test.dart +++ b/test/ui_tests/startup/startup_view_test.dart @@ -29,7 +29,7 @@ void main() { locale: const Locale('en'), onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: StartUpView(), + home: const StartUpView(), ), );