diff --git a/analysis_options.yaml b/analysis_options.yaml index 706f8b59..1c4405b8 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -19,15 +19,10 @@ linter: # Unnecessary use of this in constructors should not be done unnecessary_this: false - # source files name using lowercase_with_underscores - lowercase_with_underscores: true - leading_newlines_in_multiline_strings: false type_annotate_public_apis: false - #always_use_package_imports to make a quick navigation to particular files - always_use_package_imports: true - + directives_ordering: false avoid_function_literals_in_foreach_calls: false @@ -36,8 +31,6 @@ linter: prefer_const_literals_to_create_immutables: false - prefer_const_constructors: false - prefer_function_declarations_over_variables: false unnecessary_string_escapes: false @@ -46,12 +39,8 @@ linter: use_key_in_widget_constructors: false - prefer_const_declarations: false - constant_identifier_names: false sized_box_for_whitespace: false prefer_typing_uninitialized_variables: false - - prefer_const_constructors_in_immutables: true diff --git a/lib/ib_theme.dart b/lib/ib_theme.dart index 1e1695a4..4f07e78f 100644 --- a/lib/ib_theme.dart +++ b/lib/ib_theme.dart @@ -9,7 +9,7 @@ class IbTheme { primaryIconTheme: Theme.of(context).primaryIconTheme.copyWith( color: Colors.white, ), - appBarTheme: AppBarTheme( + appBarTheme: const AppBarTheme( foregroundColor: Colors.white, backgroundColor: IbTheme.primaryColor, ), diff --git a/lib/main.dart b/lib/main.dart index 348261bd..6376e97c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -41,7 +41,7 @@ class CircuitVerseMobile extends StatelessWidget { data: ThemeData( fontFamily: 'Poppins', brightness: Brightness.light, - textSelectionTheme: TextSelectionThemeData( + textSelectionTheme: const TextSelectionThemeData( cursorColor: CVTheme.primaryColor, ), appBarTheme: AppBarTheme( @@ -59,7 +59,7 @@ class CircuitVerseMobile extends StatelessWidget { data: ThemeData( fontFamily: 'Poppins', brightness: Brightness.dark, - textSelectionTheme: TextSelectionThemeData( + textSelectionTheme: const TextSelectionThemeData( cursorColor: CVTheme.primaryColor, ), ), diff --git a/lib/services/dialog_service.dart b/lib/services/dialog_service.dart index ac4899c5..90c9bdc7 100644 --- a/lib/services/dialog_service.dart +++ b/lib/services/dialog_service.dart @@ -17,7 +17,7 @@ class DialogService { ), title: Text( request.title, - style: TextStyle( + style: const TextStyle( fontWeight: FontWeight.bold, ), ), @@ -29,7 +29,7 @@ class DialogService { }, child: Text( request.buttonTitle, - style: TextStyle( + style: const TextStyle( fontWeight: FontWeight.bold, ), ), @@ -47,7 +47,7 @@ class DialogService { ), title: Text( request.title, - style: TextStyle( + style: const TextStyle( fontWeight: FontWeight.bold, ), ), @@ -59,7 +59,7 @@ class DialogService { }, child: Text( request.cancelTitle, - style: TextStyle( + style: const TextStyle( fontWeight: FontWeight.bold, ), ), @@ -70,7 +70,7 @@ class DialogService { }, child: Text( request.buttonTitle, - style: TextStyle( + style: const TextStyle( fontWeight: FontWeight.bold, ), ), @@ -92,12 +92,12 @@ class DialogService { child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - CircularProgressIndicator(), - SizedBox(width: 16), + const CircularProgressIndicator(), + const SizedBox(width: 16), Expanded( child: Text( request.title, - style: TextStyle(fontSize: 18), + style: const TextStyle(fontSize: 18), textAlign: TextAlign.center, maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/lib/ui/components/cv_add_icon_button.dart b/lib/ui/components/cv_add_icon_button.dart index 01aa4673..01c28b4a 100644 --- a/lib/ui/components/cv_add_icon_button.dart +++ b/lib/ui/components/cv_add_icon_button.dart @@ -10,7 +10,7 @@ class CVAddIconButton extends StatelessWidget { Widget build(BuildContext context) { return IconButton( padding: const EdgeInsets.all(0), - icon: Icon( + icon: const Icon( Icons.add_circle_outline, color: CVTheme.grey, size: 36, diff --git a/lib/ui/components/cv_social_card.dart b/lib/ui/components/cv_social_card.dart index d02c3e9b..2d287622 100644 --- a/lib/ui/components/cv_social_card.dart +++ b/lib/ui/components/cv_social_card.dart @@ -32,7 +32,7 @@ class CircuitVerseSocialCard extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ Image.asset(imagePath, width: 48), - SizedBox(width: 16), + const SizedBox(width: 16), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/ui/components/cv_tab_bar.dart b/lib/ui/components/cv_tab_bar.dart index cb93d0f5..850634fc 100644 --- a/lib/ui/components/cv_tab_bar.dart +++ b/lib/ui/components/cv_tab_bar.dart @@ -14,7 +14,7 @@ class CVTabBar extends StatelessWidget implements PreferredSizeWidget { return Container( decoration: BoxDecoration( color: color, - borderRadius: BorderRadius.vertical( + borderRadius: const BorderRadius.vertical( top: Radius.circular(4), ), ), diff --git a/lib/ui/views/about/about_tos_view.dart b/lib/ui/views/about/about_tos_view.dart index cc3ab25b..b0a230aa 100644 --- a/lib/ui/views/about/about_tos_view.dart +++ b/lib/ui/views/about/about_tos_view.dart @@ -25,7 +25,7 @@ class AboutTosView extends StatelessWidget { TextSpan _buildLink(String text, String link, {bool route = false}) { return TextSpan( - style: TextStyle( + style: const TextStyle( color: Colors.blue, fontFamily: 'Poppins', ), diff --git a/lib/ui/views/about/about_view.dart b/lib/ui/views/about/about_view.dart index 8756f544..44597c50 100644 --- a/lib/ui/views/about/about_view.dart +++ b/lib/ui/views/about/about_view.dart @@ -35,7 +35,7 @@ class _AboutViewState extends State { onPressed: () => Get.toNamed(AboutTosView.id), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), Expanded( child: CVPrimaryButton( title: AppLocalizations.of(context).privacy_policy, @@ -117,7 +117,7 @@ class _AboutViewState extends State { description: AppLocalizations.of(context).slack_channel, url: 'https://circuitverse.org/slack', ), - Divider(), + const Divider(), CVSubheader( title: AppLocalizations.of(context).contributors, subtitle: AppLocalizations.of(context).contributors_subtitle, diff --git a/lib/ui/views/authentication/components/auth_options_view.dart b/lib/ui/views/authentication/components/auth_options_view.dart index f1e7cfea..89b801dc 100644 --- a/lib/ui/views/authentication/components/auth_options_view.dart +++ b/lib/ui/views/authentication/components/auth_options_view.dart @@ -66,9 +66,9 @@ class _AuthOptionsViewState extends State { Padding( padding: const EdgeInsets.symmetric(horizontal: 32), child: Row(children: [ - Expanded(child: Divider(thickness: 1)), + const Expanded(child: Divider(thickness: 1)), Text(' Or ${widget.isSignUp ? 'SignUp' : 'Login'} with '), - Expanded(child: Divider(thickness: 1)), + const Expanded(child: Divider(thickness: 1)), ]), ), Row( @@ -78,7 +78,7 @@ class _AuthOptionsViewState extends State { onTap: onGoogleAuthPressed, child: Container( padding: const EdgeInsets.all(8), - decoration: BoxDecoration(shape: BoxShape.circle), + decoration: const BoxDecoration(shape: BoxShape.circle), child: Image.asset('assets/icons/google_icon.png', height: 40), ), @@ -87,7 +87,7 @@ class _AuthOptionsViewState extends State { onTap: onFacebookAuthPressed, child: Container( padding: const EdgeInsets.all(8), - decoration: BoxDecoration(shape: BoxShape.circle), + decoration: const BoxDecoration(shape: BoxShape.circle), child: Image.asset('assets/icons/facebook_icon.png', height: 40), ), @@ -96,8 +96,8 @@ class _AuthOptionsViewState extends State { onTap: onGithubAuthPressed, child: Container( padding: const EdgeInsets.all(8), - decoration: BoxDecoration(shape: BoxShape.circle), - child: Icon(FontAwesome5.github, size: 40), + decoration: const BoxDecoration(shape: BoxShape.circle), + child: const Icon(FontAwesome5.github, size: 40), ), ), ], diff --git a/lib/ui/views/authentication/forgot_password_view.dart b/lib/ui/views/authentication/forgot_password_view.dart index d59bc723..021d2369 100644 --- a/lib/ui/views/authentication/forgot_password_view.dart +++ b/lib/ui/views/authentication/forgot_password_view.dart @@ -69,7 +69,7 @@ class _ForgotPasswordViewState extends State { text: 'New User? ', style: Theme.of(context).textTheme.bodyText1, children: [ - TextSpan( + const TextSpan( text: 'Sign Up', style: TextStyle( color: CVTheme.primaryColorDark, @@ -102,7 +102,7 @@ class _ForgotPasswordViewState extends State { ); // route back to previous screen - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); Get.back(); } else if (_model.isError(_model.SEND_RESET_INSTRUCTIONS)) { // show failure snackbar @@ -126,14 +126,14 @@ class _ForgotPasswordViewState extends State { child: Column( children: [ _buildForgotPasswordImage(), - SizedBox(height: 8), + const SizedBox(height: 8), _buildEmailInput(), - SizedBox(height: 8), + const SizedBox(height: 8), _buildSendInstructionsButton(), - SizedBox(height: 8), + const SizedBox(height: 8), _buildNewUserSignUpComponent(), - SizedBox(height: 32), - AuthOptionsView( + const SizedBox(height: 32), + const AuthOptionsView( isSignUp: false, ), ], diff --git a/lib/ui/views/authentication/login_view.dart b/lib/ui/views/authentication/login_view.dart index d7deab06..b984e3e6 100644 --- a/lib/ui/views/authentication/login_view.dart +++ b/lib/ui/views/authentication/login_view.dart @@ -128,7 +128,7 @@ class _LoginViewState extends State { ); // move to home view on successful login.. - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); await Get.offAllNamed(CVLandingView.id); } else if (_model.isError(_model.LOGIN)) { // show failure snackbar.. @@ -152,16 +152,16 @@ class _LoginViewState extends State { child: Column( children: [ _buildLoginImage(), - SizedBox(height: 8), + const SizedBox(height: 8), _buildEmailInput(), _buildPasswordInput(), _buildForgotPasswordComponent(), - SizedBox(height: 16), + const SizedBox(height: 16), _buildLoginButton(), - SizedBox(height: 8), + const SizedBox(height: 8), _buildNewUserSignUpComponent(), - SizedBox(height: 32), - AuthOptionsView(isSignUp: false), + const SizedBox(height: 32), + const AuthOptionsView(isSignUp: false), ], ), ), diff --git a/lib/ui/views/authentication/signup_view.dart b/lib/ui/views/authentication/signup_view.dart index b1f12290..90396219 100644 --- a/lib/ui/views/authentication/signup_view.dart +++ b/lib/ui/views/authentication/signup_view.dart @@ -130,7 +130,7 @@ class _SignupViewState extends State { // move to home view on successful signup.. await Future.delayed( - Duration(seconds: 1), + const Duration(seconds: 1), ); await Get.offAllNamed(CVLandingView.id); } else if (_signUpModel.isError(_signUpModel.SIGNUP)) { @@ -155,16 +155,16 @@ class _SignupViewState extends State { child: Column( children: [ _buildSignUpImage(), - SizedBox(height: 8), + const SizedBox(height: 8), _buildNameInput(), _buildEmailInput(), _buildPasswordInput(), - SizedBox(height: 16), + const SizedBox(height: 16), _buildRegisterButton(), - SizedBox(height: 8), + const SizedBox(height: 8), _buildAlreadyRegisteredComponent(), - SizedBox(height: 32), - AuthOptionsView(isSignUp: true), + const SizedBox(height: 32), + const AuthOptionsView(isSignUp: true), ], ), ), diff --git a/lib/ui/views/contributors/components/contributors_donate_card.dart b/lib/ui/views/contributors/components/contributors_donate_card.dart index fa3c9aa5..b295a3fc 100644 --- a/lib/ui/views/contributors/components/contributors_donate_card.dart +++ b/lib/ui/views/contributors/components/contributors_donate_card.dart @@ -21,7 +21,7 @@ class ContributeDonateCard extends StatelessWidget { title, style: Theme.of(context).textTheme.headline6, ), - SizedBox(height: 10), + const SizedBox(height: 10), GestureDetector( onTap: () async { launchURL(url); @@ -29,12 +29,12 @@ class ContributeDonateCard extends StatelessWidget { child: Container( decoration: BoxDecoration( border: Border.all(color: Colors.black, width: 2), - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(8), ), color: Colors.white, boxShadow: [ - BoxShadow( + const BoxShadow( color: Colors.grey, blurRadius: 2.0, offset: Offset(2.0, 2.0), @@ -43,7 +43,7 @@ class ContributeDonateCard extends StatelessWidget { child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: ClipRRect( - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(8), ), child: Image.asset( diff --git a/lib/ui/views/contributors/contributors_view.dart b/lib/ui/views/contributors/contributors_view.dart index e236e47e..8fb8462b 100644 --- a/lib/ui/views/contributors/contributors_view.dart +++ b/lib/ui/views/contributors/contributors_view.dart @@ -19,32 +19,32 @@ class ContributorsView extends StatelessWidget { padding: const EdgeInsets.all(16), child: Column( children: [ - CVHeader( + const CVHeader( title: 'CONTRIBUTE', description: "CircuitVerse aims to be free forever and we promise that we won't run any ads! The project is open source and to ensure its continued development and maintenance we need your support.", ), - CircuitVerseSocialCard( + const CircuitVerseSocialCard( imagePath: 'assets/images/contribute/email.png', title: 'Email us at', description: 'support@circuitverse.org', url: 'mailto:support@circuitverse.org', ), - CircuitVerseSocialCard( + const CircuitVerseSocialCard( imagePath: 'assets/images/contribute/slack.png', title: 'Join and chat with us at', description: 'Slack channel', url: 'https://circuitverse.org/slack', ), - CircuitVerseSocialCard( + const CircuitVerseSocialCard( imagePath: 'assets/images/contribute/github.png', title: 'Contribute to open source', description: 'Github', url: 'https://github.com/CircuitVerse', ), - SizedBox(height: 32), - CVSubheader(title: 'How to Support ?'), - ContributeSupportCard( + const SizedBox(height: 32), + const CVSubheader(title: 'How to Support ?'), + const ContributeSupportCard( imagePath: 'assets/images/contribute/person.png', title: 'I am a Student', cardDescriptionList: [ @@ -53,7 +53,7 @@ class ContributorsView extends StatelessWidget { 'Introduce the platform to your buddie' ], ), - ContributeSupportCard( + const ContributeSupportCard( imagePath: 'assets/images/contribute/professor.png', title: 'I am a Teacher', cardDescriptionList: [ @@ -62,7 +62,7 @@ class ContributorsView extends StatelessWidget { 'Create exciting educational content using CircuitVerse' ], ), - ContributeSupportCard( + const ContributeSupportCard( imagePath: 'assets/images/contribute/person.png', title: 'I am a Developer', cardDescriptionList: [ @@ -71,14 +71,14 @@ class ContributorsView extends StatelessWidget { 'Find and fix bugs in the CircuitVerse projects' ], ), - SizedBox(height: 16), - ContributeDonateCard( + const SizedBox(height: 16), + const ContributeDonateCard( imagePath: 'assets/images/contribute/patreon-logo.png', title: 'Become a Patreon', url: 'https://www.patreon.com/CircuitVerse', ), - SizedBox(height: 16), - ContributeDonateCard( + const SizedBox(height: 16), + const ContributeDonateCard( imagePath: 'assets/images/contribute/paypal-logo.jpg', title: 'Donate through PayPal', url: 'https://www.paypal.me/satviksr', diff --git a/lib/ui/views/cv_landing_view.dart b/lib/ui/views/cv_landing_view.dart index d6afbde1..413f5ee0 100644 --- a/lib/ui/views/cv_landing_view.dart +++ b/lib/ui/views/cv_landing_view.dart @@ -36,11 +36,11 @@ class _CVLandingViewState extends State { final List _items = [ HomeView(), - FeaturedProjectsView(showAppBar: false), + const FeaturedProjectsView(showAppBar: false), AboutView(), - ContributorsView(showAppBar: false), - TeachersView(showAppBar: false), - ProfileView(), + const ContributorsView(showAppBar: false), + const TeachersView(showAppBar: false), + const ProfileView(), MyGroupsView(), ]; @@ -125,7 +125,7 @@ class _CVLandingViewState extends State { child: ExpansionTile( maintainState: true, title: ListTile( - contentPadding: EdgeInsets.all(0), + contentPadding: const EdgeInsets.all(0), leading: Icon( Icons.explore, color: CVTheme.drawerIcon(context), diff --git a/lib/ui/views/groups/add_assignment_view.dart b/lib/ui/views/groups/add_assignment_view.dart index 39947d38..48d32fde 100644 --- a/lib/ui/views/groups/add_assignment_view.dart +++ b/lib/ui/views/groups/add_assignment_view.dart @@ -64,9 +64,9 @@ class _AddAssignmentViewState extends State { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: DateTimeField( - key: Key('cv_assignment_deadline_field'), + key: const Key('cv_assignment_deadline_field'), format: DateFormat('yyyy-MM-dd HH:mm:ss'), - initialValue: DateTime.now().add(Duration(days: 7)), + initialValue: DateTime.now().add(const Duration(days: 7)), decoration: CVTheme.textFieldDecoration.copyWith( labelText: 'Deadline', ), @@ -97,7 +97,7 @@ class _AddAssignmentViewState extends State { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: DropdownButtonFormField( - key: Key('cv_assignment_grading_dropdown'), + key: const Key('cv_assignment_grading_dropdown'), decoration: CVTheme.textFieldDecoration.copyWith( labelText: 'Grading Scale', ), @@ -128,7 +128,7 @@ class _AddAssignmentViewState extends State { fontWeight: FontWeight.bold, ), ), - subtitle: Text('Enable elements restriction'), + subtitle: const Text('Enable elements restriction'), onChanged: (value) { setState(() { _isRestrictionEnabled = value; @@ -170,7 +170,7 @@ class _AddAssignmentViewState extends State { fontWeight: FontWeight.bold, ), ), - Divider(), + const Divider(), Wrap(children: components.map((e) => _buildCheckBox(e)).toList()), ], ), @@ -229,7 +229,7 @@ class _AddAssignmentViewState extends State { _dialogService.popDialog(); if (_model.isSuccess(_model.ADD_ASSIGNMENT)) { - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); // returns the added assignment.. Get.back(result: _model.addedAssignment); @@ -255,7 +255,7 @@ class _AddAssignmentViewState extends State { return BaseView( onModelReady: (model) => _model = model, builder: (context, model, child) => Scaffold( - appBar: AppBar(title: Text('Add Assignment')), + appBar: AppBar(title: const Text('Add Assignment')), body: SingleChildScrollView( padding: const EdgeInsets.symmetric(vertical: 16), child: Form( diff --git a/lib/ui/views/groups/assignment_details_view.dart b/lib/ui/views/groups/assignment_details_view.dart index 26f674b7..a7034f26 100644 --- a/lib/ui/views/groups/assignment_details_view.dart +++ b/lib/ui/views/groups/assignment_details_view.dart @@ -70,8 +70,8 @@ class _AssignmentDetailsViewState extends State { }, child: Row( children: [ - Icon(Icons.edit, color: Colors.white), - SizedBox(width: 8), + const Icon(Icons.edit, color: Colors.white), + const SizedBox(width: 8), Text( 'Edit', style: Theme.of(context).textTheme.headline6.copyWith( @@ -99,7 +99,7 @@ class _AssignmentDetailsViewState extends State { ), ), if (_recievedAssignment.attributes.hasMentorAccess) ...[ - SizedBox(width: 12), + const SizedBox(width: 12), _buildEditAssignmentButton(), ] ], @@ -116,13 +116,13 @@ class _AssignmentDetailsViewState extends State { children: [ TextSpan( text: '$title : ', - style: TextStyle(fontWeight: FontWeight.bold), + style: const TextStyle(fontWeight: FontWeight.bold), ), TextSpan( text: description.isEmpty || description == null ? 'N.A' : description, - style: TextStyle(fontSize: 18), + style: const TextStyle(fontSize: 18), ) ], ), @@ -147,7 +147,7 @@ class _AssignmentDetailsViewState extends State { data: _recievedAssignment.attributes.description ?? '', style: { 'body': Style( - fontSize: FontSize(18), + fontSize: const FontSize(18), ) }, ) @@ -209,7 +209,7 @@ class _AssignmentDetailsViewState extends State { ), ), ), - SizedBox(height: 16), + const SizedBox(height: 16), Container( width: MediaQuery.of(context).size.width, decoration: BoxDecoration( @@ -225,7 +225,7 @@ class _AssignmentDetailsViewState extends State { ) : _buildSubmissionAuthors(), ), - SizedBox(height: 4), + const SizedBox(height: 4), if (_model.focussedProject != null) AspectRatio( aspectRatio: 1.6, @@ -369,14 +369,14 @@ class _AssignmentDetailsViewState extends State { onFieldSubmitted: (_) => FocusScope.of(context).requestFocus(_gradeFocusNode), ), - SizedBox(height: 4), + const SizedBox(height: 4), CVTextField( label: 'Remarks', focusNode: _gradeFocusNode, controller: _remarksController, padding: const EdgeInsets.all(0), ), - SizedBox(height: 16), + const SizedBox(height: 16), Row( children: [ CVPrimaryButton( @@ -392,7 +392,7 @@ class _AssignmentDetailsViewState extends State { } }, ), - SizedBox(width: 16), + const SizedBox(width: 16), if (_submittedGrade != null) ElevatedButton( style: ElevatedButton.styleFrom( @@ -409,7 +409,7 @@ class _AssignmentDetailsViewState extends State { ) ], ), - SizedBox(height: 16), + const SizedBox(height: 16), Text(_recievedAssignment.gradingScaleHint), ], ), @@ -430,7 +430,7 @@ class _AssignmentDetailsViewState extends State { } }, builder: (context, model, child) => Scaffold( - appBar: AppBar(title: Text('Assignment Details')), + appBar: AppBar(title: const Text('Assignment Details')), body: Builder(builder: (context) { var _attrs = _recievedAssignment.attributes; var _remainingTime = _attrs.deadline.difference(DateTime.now()); @@ -439,7 +439,7 @@ class _AssignmentDetailsViewState extends State { padding: const EdgeInsets.all(16), children: [ _buildHeader(), - SizedBox(height: 16), + const SizedBox(height: 16), _buildDetailComponent('Name', _attrs.name), _buildDetailComponent( 'Deadline', @@ -455,12 +455,12 @@ class _AssignmentDetailsViewState extends State { 'Restricted Elements', json.decode(_attrs.restrictions).join(' , '), ), - Divider(height: 32), + const Divider(height: 32), if (_model.isSuccess(_model.FETCH_ASSIGNMENT_DETAILS)) Column( children: [ _buildSubmissions(), - SizedBox(height: 16), + const SizedBox(height: 16), _buildGrades(), ], ), diff --git a/lib/ui/views/groups/components/assignment_card.dart b/lib/ui/views/groups/components/assignment_card.dart index cdfbf63f..f743ffdf 100644 --- a/lib/ui/views/groups/components/assignment_card.dart +++ b/lib/ui/views/groups/components/assignment_card.dart @@ -34,7 +34,7 @@ class _AssignmentCardState extends State { children: [ TextSpan( text: '$title : ', - style: TextStyle(fontWeight: FontWeight.bold), + style: const TextStyle(fontWeight: FontWeight.bold), ), TextSpan( text: description, @@ -163,7 +163,7 @@ class _AssignmentCardState extends State { boxShadow: [ BoxShadow( color: CVTheme.boxShadow(context), - offset: Offset(0, 3), + offset: const Offset(0, 3), blurRadius: 2, ) ], @@ -188,7 +188,7 @@ class _AssignmentCardState extends State { 'Deadline', deadlineFormat.format(widget.assignment.attributes.deadline), ), - SizedBox(height: 8), + const SizedBox(height: 8), _buildAssignmentButtons(), ], ), diff --git a/lib/ui/views/groups/components/group_member_card.dart b/lib/ui/views/groups/components/group_member_card.dart index 91976753..f55ccc5f 100644 --- a/lib/ui/views/groups/components/group_member_card.dart +++ b/lib/ui/views/groups/components/group_member_card.dart @@ -16,7 +16,7 @@ class GroupMemberCard extends StatelessWidget { padding: const EdgeInsets.all(16), margin: const EdgeInsets.all(8), decoration: BoxDecoration( - border: Border( + border: const Border( left: BorderSide( width: 10, color: CVTheme.primaryColor, @@ -25,7 +25,7 @@ class GroupMemberCard extends StatelessWidget { boxShadow: [ BoxShadow( color: CVTheme.boxShadow(context), - offset: Offset(0, 3), + offset: const Offset(0, 3), blurRadius: 2, ), ], diff --git a/lib/ui/views/groups/components/group_mentor_card.dart b/lib/ui/views/groups/components/group_mentor_card.dart index 76170106..f739b25c 100644 --- a/lib/ui/views/groups/components/group_mentor_card.dart +++ b/lib/ui/views/groups/components/group_mentor_card.dart @@ -24,7 +24,7 @@ class _GroupMentorCardState extends State { padding: const EdgeInsets.all(16), margin: const EdgeInsets.all(8), decoration: BoxDecoration( - border: Border( + border: const Border( top: BorderSide( width: 10, color: CVTheme.primaryColor, @@ -33,7 +33,7 @@ class _GroupMentorCardState extends State { boxShadow: [ BoxShadow( color: CVTheme.boxShadow(context), - offset: Offset(0, 3), + offset: const Offset(0, 3), blurRadius: 2, ) ], diff --git a/lib/ui/views/groups/components/member_card.dart b/lib/ui/views/groups/components/member_card.dart index 18854a49..1c81cc7a 100644 --- a/lib/ui/views/groups/components/member_card.dart +++ b/lib/ui/views/groups/components/member_card.dart @@ -24,7 +24,7 @@ class MemberCard extends StatelessWidget { boxShadow: [ BoxShadow( color: CVTheme.boxShadow(context), - offset: Offset(0, 3), + offset: const Offset(0, 3), blurRadius: 2, ) ], @@ -52,7 +52,7 @@ class MemberCard extends StatelessWidget { ), if (hasMentorAccess) IconButton( - icon: Icon(Icons.delete_outline), + icon: const Icon(Icons.delete_outline), color: CVTheme.red, onPressed: onDeletePressed, ) diff --git a/lib/ui/views/groups/edit_group_view.dart b/lib/ui/views/groups/edit_group_view.dart index 317f658c..2db67e10 100644 --- a/lib/ui/views/groups/edit_group_view.dart +++ b/lib/ui/views/groups/edit_group_view.dart @@ -39,7 +39,7 @@ class _EditGroupViewState extends State { _dialogService.popDialog(); if (_model.isSuccess(_model.UPDATE_GROUP)) { - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); Get.back(result: _model.updatedGroup); SnackBarUtils.showDark( 'Group Updated', @@ -67,17 +67,17 @@ class _EditGroupViewState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - CVSubheader( + const CVSubheader( title: 'EDIT GROUP', subtitle: "You can update Group details here. Don't leave the Group Name blank.", ), - SizedBox(height: 16), + const SizedBox(height: 16), SvgPicture.asset( 'assets/images/group/edit_group.svg', height: 200, ), - SizedBox(height: 16), + const SizedBox(height: 16), CVTextField( padding: const EdgeInsets.all(0), label: 'Group Name', @@ -87,7 +87,7 @@ class _EditGroupViewState extends State { onSaved: (value) => _name = value.trim(), action: TextInputAction.done, ), - SizedBox(height: 16), + const SizedBox(height: 16), CVPrimaryButton( title: 'Save', onPressed: _validateAndSubmit, diff --git a/lib/ui/views/groups/group_details_view.dart b/lib/ui/views/groups/group_details_view.dart index b662a3fb..033456f7 100644 --- a/lib/ui/views/groups/group_details_view.dart +++ b/lib/ui/views/groups/group_details_view.dart @@ -61,8 +61,8 @@ class _GroupDetailsViewState extends State { }, child: Row( children: [ - Icon(Icons.edit, color: Colors.white), - SizedBox(width: 8), + const Icon(Icons.edit, color: Colors.white), + const SizedBox(width: 8), Text( 'Edit', style: Theme.of(context).textTheme.headline6.copyWith( @@ -91,7 +91,7 @@ class _GroupDetailsViewState extends State { ), ), if (_recievedGroup.isMentor) ...[ - SizedBox(width: 12), + const SizedBox(width: 12), _buildEditGroupButton(), ] ], @@ -152,7 +152,7 @@ class _GroupDetailsViewState extends State { title: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Add Group Members', style: TextStyle( fontWeight: FontWeight.bold, @@ -182,7 +182,7 @@ class _GroupDetailsViewState extends State { actions: [ TextButton( onPressed: () => Navigator.pop(context), - child: Text('CANCEL'), + child: const Text('CANCEL'), ), CVFlatButton( key: addButtonGlobalKey, @@ -356,13 +356,13 @@ class _GroupDetailsViewState extends State { _model.fetchGroupDetails(_recievedGroup.id); }, builder: (context, model, child) => Scaffold( - appBar: AppBar(title: Text('Group Details')), + appBar: AppBar(title: const Text('Group Details')), body: Builder(builder: (context) { var _items = []; _items.add(_buildHeader()); - _items.add(SizedBox(height: 36)); + _items.add(const SizedBox(height: 36)); _items.add( _buildSubHeader( @@ -383,7 +383,7 @@ class _GroupDetailsViewState extends State { }); } - _items.add(SizedBox(height: 36)); + _items.add(const SizedBox(height: 36)); _items.add( _buildSubHeader( diff --git a/lib/ui/views/groups/my_groups_view.dart b/lib/ui/views/groups/my_groups_view.dart index bf6e0ef7..0d18397b 100644 --- a/lib/ui/views/groups/my_groups_view.dart +++ b/lib/ui/views/groups/my_groups_view.dart @@ -112,7 +112,7 @@ class _MyGroupsViewState extends State { ), ); - _items.add(SizedBox(height: 24)); + _items.add(const SizedBox(height: 24)); _items.add(_buildSubHeader(title: 'Groups You Mentor')); @@ -136,7 +136,7 @@ class _MyGroupsViewState extends State { } } - _items.add(SizedBox(height: 24)); + _items.add(const SizedBox(height: 24)); _items.add(_buildSubHeader(title: "Groups You're in")); diff --git a/lib/ui/views/groups/new_group_view.dart b/lib/ui/views/groups/new_group_view.dart index 0a160931..1d545d78 100644 --- a/lib/ui/views/groups/new_group_view.dart +++ b/lib/ui/views/groups/new_group_view.dart @@ -35,7 +35,7 @@ class _NewGroupViewState extends State { _dialogService.popDialog(); if (_model.isSuccess(_model.ADD_GROUP)) { - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); Get.back(result: _model.newGroup); SnackBarUtils.showDark( 'Group Created', @@ -63,17 +63,17 @@ class _NewGroupViewState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - CVSubheader( + const CVSubheader( title: 'NEW GROUP', subtitle: 'Groups an be used by mentors to set projects for and give grades to students.', ), - SizedBox(height: 16), + const SizedBox(height: 16), SvgPicture.asset( 'assets/images/group/new_group.svg', height: 200, ), - SizedBox(height: 16), + const SizedBox(height: 16), CVTextField( padding: const EdgeInsets.all(0), label: 'Group Name', @@ -82,7 +82,7 @@ class _NewGroupViewState extends State { onSaved: (value) => _name = value.trim(), action: TextInputAction.done, ), - SizedBox(height: 16), + const SizedBox(height: 16), CVPrimaryButton( title: 'SAVE', onPressed: _validateAndSubmit, diff --git a/lib/ui/views/groups/update_assignment_view.dart b/lib/ui/views/groups/update_assignment_view.dart index 86b3741e..6ce9eced 100644 --- a/lib/ui/views/groups/update_assignment_view.dart +++ b/lib/ui/views/groups/update_assignment_view.dart @@ -68,7 +68,7 @@ class _UpdateAssignmentViewState extends State { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: DateTimeField( - key: Key('cv_assignment_deadline_field'), + key: const Key('cv_assignment_deadline_field'), format: DateFormat('yyyy-MM-dd HH:mm:ss'), initialValue: widget.assignment.attributes.deadline, decoration: CVTheme.textFieldDecoration.copyWith( @@ -108,7 +108,7 @@ class _UpdateAssignmentViewState extends State { fontWeight: FontWeight.bold, ), ), - subtitle: Text('Enable elements restriction'), + subtitle: const Text('Enable elements restriction'), onChanged: (value) { setState(() { _isRestrictionEnabled = value; @@ -149,7 +149,7 @@ class _UpdateAssignmentViewState extends State { fontWeight: FontWeight.bold, ), ), - Divider(), + const Divider(), Wrap(children: components.map((e) => _buildCheckBox(e)).toList()), ], ), @@ -207,7 +207,7 @@ class _UpdateAssignmentViewState extends State { _dialogService.popDialog(); if (_model.isSuccess(_model.UPDATE_ASSIGNMENT)) { - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); Get.back(result: _model.updatedAssignment); SnackBarUtils.showDark( 'Assignment Updated', @@ -227,7 +227,7 @@ class _UpdateAssignmentViewState extends State { return BaseView( onModelReady: (model) => _model = model, builder: (context, model, child) => Scaffold( - appBar: AppBar(title: Text('Update Assignment')), + appBar: AppBar(title: const Text('Update Assignment')), body: SingleChildScrollView( padding: const EdgeInsets.symmetric(vertical: 16), child: Form( diff --git a/lib/ui/views/home/home_view.dart b/lib/ui/views/home/home_view.dart index 43052faf..5a6e8a76 100644 --- a/lib/ui/views/home/home_view.dart +++ b/lib/ui/views/home/home_view.dart @@ -57,7 +57,7 @@ class _HomeViewState extends State { onPressed: () => Get.toNamed(TeachersView.id), isBodyText: true, ), - SizedBox(width: 16), + const SizedBox(width: 16), CVOutlineButton( title: 'For Contributors', isPrimaryDark: true, @@ -77,48 +77,48 @@ class _HomeViewState extends State { _buildHeader(), _buildHomePageSketch(), _buildTeachersAndContributorButtons(), - CVSubheader( + const CVSubheader( title: 'Features', subtitle: 'Design circuits quickly and easily with a modern and intuitive user interface with drag-and-drop, copy/paste, zoom and more.', ), - FeatureCard( + const FeatureCard( assetPath: 'assets/images/homepage/export-hd.png', cardHeading: 'Explore High Resolution Images', cardDescription: 'CircuitVerse can export high resolution images in multiple formats including SVG.', ), - FeatureCard( + const FeatureCard( assetPath: 'assets/images/homepage/combinational-analysis.png', cardHeading: 'Combinational Analysis', cardDescription: 'Automatically generate circuit based on truth table data. This is great to create complex logic circuits and can be easily be made into a subcircuit.', ), - FeatureCard( + const FeatureCard( assetPath: 'assets/images/homepage/embed.png', cardHeading: 'Embed in Blogs', cardDescription: 'Since CircuitVerse is built in HTML5, an iFrame can be generated for each project allowing the user to embed it almost anywhere.', ), - FeatureCard( + const FeatureCard( assetPath: 'assets/images/homepage/sub-circuit.png', cardHeading: 'Use Sub circuits', cardDescription: 'Create subcircuits once and use them repeatedly. This allows easier and more structured design.', ), - FeatureCard( + const FeatureCard( assetPath: 'assets/images/homepage/multi-bit-bus.png', cardHeading: 'Multi Bit Buses and components', cardDescription: 'CircuitVerse supports multi bit wires, this means circuit design is easier, faster and uncluttered.', ), - SizedBox(height: 16), - CVSubheader( + const SizedBox(height: 16), + const CVSubheader( title: 'Editor Picks', subtitle: 'These circuits have been hand-picked by our authors for their awesomeness', ), - FeaturedProjectsView(embed: true), + const FeaturedProjectsView(embed: true), CVOutlineButton( title: 'Explore More', isPrimaryDark: true, diff --git a/lib/ui/views/ib/builders/ib_headings_builder.dart b/lib/ui/views/ib/builders/ib_headings_builder.dart index b423f92e..1f1a61ed 100644 --- a/lib/ui/views/ib/builders/ib_headings_builder.dart +++ b/lib/ui/views/ib/builders/ib_headings_builder.dart @@ -33,7 +33,7 @@ class IbHeadingsBuilder extends MarkdownElementBuilder { controller: controller, index: index++, child: Padding( - padding: EdgeInsets.symmetric(vertical: 4.0), + padding: const EdgeInsets.symmetric(vertical: 4.0), child: widget, ), ); diff --git a/lib/ui/views/ib/builders/ib_interaction_builder.dart b/lib/ui/views/ib/builders/ib_interaction_builder.dart index c393099a..6ff53bcd 100644 --- a/lib/ui/views/ib/builders/ib_interaction_builder.dart +++ b/lib/ui/views/ib/builders/ib_interaction_builder.dart @@ -21,9 +21,9 @@ class IbInteractionBuilder extends MarkdownElementBuilder { future: model.fetchHtmlInteraction(id), builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.data is Failure) { - return Text('Error Loading Interaction'); + return const Text('Error Loading Interaction'); } else if (!snapshot.hasData) { - return Text('Loading Interaction...'); + return const Text('Loading Interaction...'); } var _textContent = snapshot.data.toString(); 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 88e49bb4..b0c62550 100644 --- a/lib/ui/views/ib/components/ib_pop_quiz_button.dart +++ b/lib/ui/views/ib/components/ib_pop_quiz_button.dart @@ -47,8 +47,8 @@ class IbPopQuizButtonState extends State { _isPressed = !_isPressed; }), child: Container( - margin: EdgeInsets.only(top: 5.0), - padding: EdgeInsets.all(10.0), + margin: const EdgeInsets.only(top: 5.0), + padding: const EdgeInsets.all(10.0), decoration: BoxDecoration( color: _isPressed ? _getBorderColor() : null, border: Border.all(color: _getBorderColor()), diff --git a/lib/ui/views/ib/ib_landing_view.dart b/lib/ui/views/ib/ib_landing_view.dart index 2a7756c7..da2a1dff 100644 --- a/lib/ui/views/ib/ib_landing_view.dart +++ b/lib/ui/views/ib/ib_landing_view.dart @@ -101,7 +101,7 @@ class _IbLandingViewState extends State { ? true : false, title: ListTile( - contentPadding: EdgeInsets.all(0), + contentPadding: const EdgeInsets.all(0), title: GestureDetector( onTap: () => setSelectedChapter(chapter), child: Text( @@ -149,7 +149,7 @@ class _IbLandingViewState extends State { color: IbTheme.textColor(context), ), ), - Divider(thickness: 1), + const Divider(thickness: 1), InkWell( onTap: () => setSelectedChapter(_homeChapter), child: CVDrawerTile( @@ -160,7 +160,7 @@ class _IbLandingViewState extends State { ), ), if (!_model.isSuccess(_model.IB_FETCH_CHAPTERS)) - InkWell( + const InkWell( child: CVDrawerTile( title: 'Loading...', ), @@ -212,7 +212,7 @@ class _IbLandingViewState extends State { child: Theme( data: IbTheme.getThemeData(context), child: Scaffold( - key: Key('IbLandingScaffold'), + key: const Key('IbLandingScaffold'), appBar: _buildAppBar(), drawer: _buildDrawer(model), body: PageTransitionSwitcher( diff --git a/lib/ui/views/ib/ib_page_view.dart b/lib/ui/views/ib/ib_page_view.dart index 9a0bce7c..ba930d70 100644 --- a/lib/ui/views/ib/ib_page_view.dart +++ b/lib/ui/views/ib/ib_page_view.dart @@ -75,7 +75,7 @@ class _IbPageViewState extends State { } Widget _buildDivider() { - return Padding( + return const Padding( padding: EdgeInsets.symmetric(vertical: 10), child: Divider( thickness: 1.5, @@ -145,7 +145,7 @@ class _IbPageViewState extends State { } Widget _buildMarkdown(IbMd data) { - final _selectable = false; + const _selectable = false; final _headingsBuilder = IbHeadingsBuilder( slugMap: _slugMap, controller: _hideButtonController, @@ -230,7 +230,7 @@ class _IbPageViewState extends State { } Widget _buildFooter() { - return Padding( + return const Padding( padding: EdgeInsets.symmetric(vertical: 4), child: Text( 'Copyright © 2021 Contributors to CircuitVerse. Distributed under a [CC-by-sa] license.', @@ -252,8 +252,8 @@ class _IbPageViewState extends State { {bool root = true, bool padding = true}) { if (!root) { return ListTile( - leading: Text(''), - visualDensity: !padding ? VisualDensity(vertical: -3) : null, + leading: const Text(''), + visualDensity: !padding ? const VisualDensity(vertical: -3) : null, contentPadding: EdgeInsets.symmetric(horizontal: padding ? 16.0 : 0.0), minLeadingWidth: 20, title: Text('$leading $content'), @@ -262,7 +262,7 @@ class _IbPageViewState extends State { } return ListTile( - visualDensity: !padding ? VisualDensity(vertical: -3) : null, + visualDensity: !padding ? const VisualDensity(vertical: -3) : null, contentPadding: EdgeInsets.symmetric(horizontal: padding ? 16.0 : 0.0), title: Text('$leading $content'), onTap: () async => _onTocListTileTap(content), @@ -350,14 +350,14 @@ class _IbPageViewState extends State { buttons.add( AnimatedOpacity( - duration: Duration(milliseconds: 500), + duration: const Duration(milliseconds: 500), opacity: _isFabsVisible ? 1.0 : 0.0, child: FloatingActionButton( heroTag: 'previousPage', mini: true, backgroundColor: Theme.of(context).primaryIconTheme.color, onPressed: () => widget.setPage(widget.chapter.prev), - child: Icon( + child: const Icon( Icons.arrow_back_rounded, color: IbTheme.primaryColor, ), @@ -373,14 +373,14 @@ class _IbPageViewState extends State { buttons.add( AnimatedOpacity( - duration: Duration(milliseconds: 500), + duration: const Duration(milliseconds: 500), opacity: _isFabsVisible ? 1.0 : 0.0, child: FloatingActionButton( heroTag: 'nextPage', mini: true, backgroundColor: Theme.of(context).primaryIconTheme.color, onPressed: () => widget.setPage(widget.chapter.next), - child: Icon( + child: const Icon( Icons.arrow_forward_rounded, color: IbTheme.primaryColor, ), diff --git a/lib/ui/views/profile/edit_profile_view.dart b/lib/ui/views/profile/edit_profile_view.dart index a6f48904..a8df3724 100644 --- a/lib/ui/views/profile/edit_profile_view.dart +++ b/lib/ui/views/profile/edit_profile_view.dart @@ -88,7 +88,7 @@ class _EditProfileViewState extends State { Widget _buildSubscribedField() { return CheckboxListTile( value: _subscribed, - title: Text('Subscribe to mails?'), + title: const Text('Subscribe to mails?'), onChanged: (value) => setState(() { _subscribed = value; }), @@ -107,7 +107,7 @@ class _EditProfileViewState extends State { _dialogService.popDialog(); if (_model.isSuccess(_model.UPDATE_PROFILE)) { - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); Get.back(result: _model.updatedUser); SnackBarUtils.showDark( 'Profile Updated', @@ -137,7 +137,7 @@ class _EditProfileViewState extends State { return BaseView( onModelReady: (model) => _model = model, builder: (context, model, child) => Scaffold( - appBar: AppBar(title: Text('Update Profile')), + appBar: AppBar(title: const Text('Update Profile')), body: SingleChildScrollView( padding: const EdgeInsets.symmetric(vertical: 16), child: Form( @@ -149,7 +149,7 @@ class _EditProfileViewState extends State { _buildCountryField(), _buildInstituteField(), _buildSubscribedField(), - SizedBox(height: 16), + const SizedBox(height: 16), _buildSaveDetailsButton(), ], ), diff --git a/lib/ui/views/profile/profile_view.dart b/lib/ui/views/profile/profile_view.dart index 81dfeb08..dc86516f 100644 --- a/lib/ui/views/profile/profile_view.dart +++ b/lib/ui/views/profile/profile_view.dart @@ -114,7 +114,7 @@ class _ProfileViewState extends State { return Card( shape: RoundedRectangleBorder( - side: BorderSide(color: CVTheme.lightGrey), + side: const BorderSide(color: CVTheme.lightGrey), borderRadius: BorderRadius.circular(4), ), child: Padding( @@ -167,7 +167,7 @@ class _ProfileViewState extends State { return Expanded( child: Card( shape: RoundedRectangleBorder( - side: BorderSide(color: CVTheme.lightGrey), + side: const BorderSide(color: CVTheme.lightGrey), borderRadius: BorderRadius.circular(4), ), child: DefaultTabController( @@ -175,7 +175,7 @@ class _ProfileViewState extends State { child: Scaffold( appBar: CVTabBar( color: CVTheme.lightGrey.withOpacity(0.2), - tabBar: TabBar( + tabBar: const TabBar( labelColor: Colors.white, unselectedLabelColor: Colors.black87, indicatorSize: TabBarIndicatorSize.tab, @@ -211,7 +211,7 @@ class _ProfileViewState extends State { builder: (context, model, child) => Scaffold( appBar: widget.userId != null ? AppBar( - title: Text('Profile'), + title: const Text('Profile'), centerTitle: true, ) : null, @@ -220,7 +220,7 @@ class _ProfileViewState extends State { child: Column( children: [ _buildProfileCard(), - SizedBox(height: 8), + const SizedBox(height: 8), _buildProjectsTabBar(), ], ), diff --git a/lib/ui/views/projects/components/featured_project_card.dart b/lib/ui/views/projects/components/featured_project_card.dart index c376b318..0cd4be5c 100644 --- a/lib/ui/views/projects/components/featured_project_card.dart +++ b/lib/ui/views/projects/components/featured_project_card.dart @@ -21,13 +21,13 @@ class _FeaturedProjectCardState extends State { return Container( decoration: BoxDecoration( border: Border.all(color: CVTheme.primaryColor), - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( topLeft: Radius.circular(4), topRight: Radius.circular(4), ), ), child: ClipRRect( - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( topLeft: Radius.circular(4), topRight: Radius.circular(4), ), @@ -48,7 +48,7 @@ class _FeaturedProjectCardState extends State { Widget _buildFooter() { return Container( padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12), - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Colors.transparent, borderRadius: BorderRadius.only( bottomLeft: Radius.circular(4), @@ -74,7 +74,7 @@ class _FeaturedProjectCardState extends State { ), CVPrimaryButton( title: 'View', - padding: EdgeInsets.all(2), + padding: const EdgeInsets.all(2), onPressed: widget.onViewPressed, ), ], diff --git a/lib/ui/views/projects/components/project_card.dart b/lib/ui/views/projects/components/project_card.dart index e5c15f24..ae045266 100644 --- a/lib/ui/views/projects/components/project_card.dart +++ b/lib/ui/views/projects/components/project_card.dart @@ -34,13 +34,13 @@ class _ProjectCardState extends State { decoration: BoxDecoration( color: widget.isHeaderFilled ? CVTheme.primaryColor : Colors.transparent, - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( topLeft: Radius.circular(4), topRight: Radius.circular(4), ), border: widget.isHeaderFilled ? null - : Border.fromBorderSide( + : const Border.fromBorderSide( BorderSide(color: CVTheme.primaryColor), ), ), @@ -64,7 +64,7 @@ class _ProjectCardState extends State { ), ), ), - SizedBox(width: 8), + const SizedBox(width: 8), _buildHeaderChip(widget.project.attributes.projectAccessType) ], ), @@ -75,13 +75,13 @@ class _ProjectCardState extends State { return Container( decoration: BoxDecoration( border: Border.all(color: CVTheme.primaryColor), - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( bottomLeft: Radius.circular(4), bottomRight: Radius.circular(4), ), ), child: ClipRRect( - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( bottomLeft: Radius.circular(4), bottomRight: Radius.circular(4), ), diff --git a/lib/ui/views/projects/edit_project_view.dart b/lib/ui/views/projects/edit_project_view.dart index ac959cb0..b56859df 100644 --- a/lib/ui/views/projects/edit_project_view.dart +++ b/lib/ui/views/projects/edit_project_view.dart @@ -128,7 +128,7 @@ class _EditProjectViewState extends State { _dialogService.popDialog(); if (_model.isSuccess(_model.UPDATE_PROJECT)) { - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); Get.back(result: _model.updatedProject); SnackBarUtils.showDark( 'Project Updated', @@ -170,7 +170,7 @@ class _EditProjectViewState extends State { _buildTagsInput(), _buildProjectAccessTypeInput(), _buildDescriptionInput(), - SizedBox(height: 16), + const SizedBox(height: 16), _buildUpdateProjectButton(), ], ), diff --git a/lib/ui/views/projects/featured_projects_view.dart b/lib/ui/views/projects/featured_projects_view.dart index c827be72..6f667692 100644 --- a/lib/ui/views/projects/featured_projects_view.dart +++ b/lib/ui/views/projects/featured_projects_view.dart @@ -61,7 +61,7 @@ class _FeaturedProjectsViewState extends State { _items.insert( 0, - CVHeader( + const CVHeader( title: 'Editor Picks', description: 'These circuits have been hand-picked by our authors for their awesomeness.', @@ -70,7 +70,7 @@ class _FeaturedProjectsViewState extends State { return Scaffold( appBar: widget.showAppBar - ? AppBar(title: Text('Featured Circuits')) + ? AppBar(title: const Text('Featured Circuits')) : null, body: SingleChildScrollView( padding: const EdgeInsets.all(16), diff --git a/lib/ui/views/projects/project_details_view.dart b/lib/ui/views/projects/project_details_view.dart index 36638ae6..2f6ed0e4 100644 --- a/lib/ui/views/projects/project_details_view.dart +++ b/lib/ui/views/projects/project_details_view.dart @@ -62,7 +62,7 @@ class _ProjectDetailsViewState extends State { padding: const EdgeInsets.symmetric(horizontal: 8), child: IconButton( onPressed: onShareButtonPressed, - icon: Icon(Icons.share), + icon: const Icon(Icons.share), tooltip: 'Share', ), ); @@ -80,7 +80,7 @@ class _ProjectDetailsViewState extends State { alignment: Alignment.bottomRight, children: [ PhotoView.customChild( - backgroundDecoration: BoxDecoration( + backgroundDecoration: const BoxDecoration( color: Colors.white, ), initialScale: 1.0, @@ -102,7 +102,7 @@ class _ProjectDetailsViewState extends State { arguments: _recievedProject, ); }, - icon: Icon( + icon: const Icon( Icons.fullscreen, color: Colors.white, ), @@ -117,7 +117,7 @@ class _ProjectDetailsViewState extends State { Widget _buildStarsComponent() { return Row( children: [ - Icon(Icons.star, color: Colors.yellow, size: 18), + const Icon(Icons.star, color: Colors.yellow, size: 18), Text(' ${_model.starCount} Stars'), ], ); @@ -126,7 +126,7 @@ class _ProjectDetailsViewState extends State { Widget _buildViewsComponent() { return Row( children: [ - Icon(Icons.visibility, size: 18), + const Icon(Icons.visibility, size: 18), Text(' ${_recievedProject.attributes.view} Views'), ], ); @@ -153,12 +153,12 @@ class _ProjectDetailsViewState extends State { return Column( children: [ _buildProjectHeader(_recievedProject.attributes.name), - SizedBox(height: 4), + const SizedBox(height: 4), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ _buildStarsComponent(), - SizedBox(width: 8), + const SizedBox(width: 8), _buildViewsComponent(), ], ), @@ -175,11 +175,11 @@ class _ProjectDetailsViewState extends State { children: [ TextSpan( text: '$heading : ', - style: TextStyle(fontWeight: FontWeight.bold), + style: const TextStyle(fontWeight: FontWeight.bold), ), TextSpan( text: description, - style: TextStyle(fontSize: 18), + style: const TextStyle(fontSize: 18), ) ], ), @@ -194,7 +194,7 @@ class _ProjectDetailsViewState extends State { text: TextSpan( style: Theme.of(context).textTheme.headline6.copyWith(fontSize: 18), children: [ - TextSpan( + const TextSpan( text: 'Author : ', style: TextStyle(fontWeight: FontWeight.bold), ), @@ -203,7 +203,7 @@ class _ProjectDetailsViewState extends State { ..onTap = () => Get.toNamed(ProfileView.id, arguments: _recievedProject.relationships.author.data.id), text: _recievedProject.attributes.authorName, - style: TextStyle( + style: const TextStyle( fontSize: 18, decoration: TextDecoration.underline, color: CVTheme.primaryColor, @@ -231,7 +231,7 @@ class _ProjectDetailsViewState extends State { ), Html( data: _recievedProject.attributes.description ?? '', - style: {'body': Style(fontSize: FontSize(18))}, + style: {'body': Style(fontSize: const FontSize(18))}, ) ], ), @@ -278,7 +278,7 @@ class _ProjectDetailsViewState extends State { mainAxisSize: MainAxisSize.min, children: [ Image.asset('assets/icons/fork_project.png', width: 12), - SizedBox(width: 4), + const SizedBox(width: 4), Text( 'Fork', style: Theme.of(context).textTheme.subtitle1.copyWith( @@ -361,7 +361,7 @@ class _ProjectDetailsViewState extends State { title: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Add Collaborators', style: TextStyle( fontWeight: FontWeight.bold, @@ -395,7 +395,7 @@ class _ProjectDetailsViewState extends State { actions: [ TextButton( onPressed: () => Navigator.pop(context), - child: Text('CANCEL'), + child: const Text('CANCEL'), ), CVFlatButton( key: addButtonGlobalKey, @@ -414,8 +414,8 @@ class _ProjectDetailsViewState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon(Icons.add), - Text('Add A Collaborator'), + const Icon(Icons.add), + const Text('Add A Collaborator'), ], ), ); @@ -443,8 +443,8 @@ class _ProjectDetailsViewState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon(Icons.edit, size: 16), - SizedBox(width: 4), + const Icon(Icons.edit, size: 16), + const SizedBox(width: 4), Text('Edit', style: Theme.of(context).textTheme.subtitle1), ], ), @@ -493,8 +493,8 @@ class _ProjectDetailsViewState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon(Icons.delete, size: 16), - SizedBox(width: 4), + const Icon(Icons.delete, size: 16), + const SizedBox(width: 4), Text('Delete', style: Theme.of(context).textTheme.subtitle1), ], ), @@ -553,7 +553,7 @@ class _ProjectDetailsViewState extends State { if (_model.project.hasAuthorAccess) IconButton( padding: const EdgeInsets.all(0), - icon: Icon(Icons.delete_outline), + icon: const Icon(Icons.delete_outline), color: CVTheme.red, onPressed: () => onDeleteCollaboratorPressed(collaborator), ), @@ -576,7 +576,7 @@ class _ProjectDetailsViewState extends State { }, builder: (context, model, child) => Scaffold( appBar: AppBar( - title: Text('Project Details'), + title: const Text('Project Details'), actions: [ _buildShareActionButton(), ], @@ -588,7 +588,7 @@ class _ProjectDetailsViewState extends State { // Adds project preview.. _items.add(_buildProjectPreview()); - _items.add(SizedBox(height: 16)); + _items.add(const SizedBox(height: 16)); // Adds Project Name, Star & View count.. _items.add(_buildProjectNameHeader()); @@ -606,7 +606,7 @@ class _ProjectDetailsViewState extends State { _projectAttrs.projectAccessType, ), _buildProjectDescription(), - Divider(height: 32), + const Divider(height: 32), Wrap( spacing: 8, crossAxisAlignment: WrapCrossAlignment.center, @@ -620,7 +620,7 @@ class _ProjectDetailsViewState extends State { _buildAddCollaboratorsButton(), ], ), - Divider(height: 32), + const Divider(height: 32), if (_recievedProject.hasAuthorAccess) Wrap( spacing: 8, @@ -636,7 +636,7 @@ class _ProjectDetailsViewState extends State { if (_model.isSuccess(_model.FETCH_PROJECT_DETAILS) && _model.collaborators.isNotEmpty) { - _items.add(Divider()); + _items.add(const Divider()); _items.add(_buildProjectHeader('Collaborators')); diff --git a/lib/ui/views/projects/project_preview_fullscreen_view.dart b/lib/ui/views/projects/project_preview_fullscreen_view.dart index b5e6f1f8..0e373950 100644 --- a/lib/ui/views/projects/project_preview_fullscreen_view.dart +++ b/lib/ui/views/projects/project_preview_fullscreen_view.dart @@ -17,7 +17,7 @@ class ProjectPreviewFullScreen extends StatelessWidget { ), body: Center( child: PhotoView.customChild( - backgroundDecoration: BoxDecoration( + backgroundDecoration: const BoxDecoration( color: Colors.white, ), initialScale: 1.0, diff --git a/lib/ui/views/startup_view.dart b/lib/ui/views/startup_view.dart index 3811f2e2..c1672eb5 100644 --- a/lib/ui/views/startup_view.dart +++ b/lib/ui/views/startup_view.dart @@ -13,7 +13,7 @@ class StartUpView extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 42), child: Image.asset( 'assets/images/landing/cv_full_logo.png', - key: Key('cv_startup_logo'), + key: const Key('cv_startup_logo'), ), ), ), diff --git a/lib/ui/views/teachers/teachers_view.dart b/lib/ui/views/teachers/teachers_view.dart index 37c6ea43..b80e222e 100644 --- a/lib/ui/views/teachers/teachers_view.dart +++ b/lib/ui/views/teachers/teachers_view.dart @@ -17,31 +17,31 @@ class TeachersView extends StatelessWidget { padding: const EdgeInsets.all(16), child: Column( children: [ - CVHeader( + const CVHeader( title: 'TEACHERS', description: 'CircuitVerse has been designed to be very easy to use in class. The platform has features to assist teachers in class and assignments.', ), - CVSubheader(title: 'Benefits'), - TeachersCard( + const CVSubheader(title: 'Benefits'), + const TeachersCard( assetPath: 'assets/images/teachers/groups.png', cardHeading: 'Create Groups and add your students', cardDescription: 'You can create groups and add your students to them! If students are already registered with CircuitVerse they will be added automatically. If they are not registered with CircuitVerse yet, an invitation will be sent to register. Once they register, they will be added automatically.', ), - TeachersCard( + const TeachersCard( assetPath: 'assets/images/teachers/assignment.png', cardHeading: 'Post Assignments', cardDescription: 'To create an assignment, simply click an add new assignment button. Give the details of the assignment and the deadline. The assignment will automatically close at deadline. Students cannot continue their assignment unless the teacher reopens the assignment again.', ), - TeachersCard( + const TeachersCard( assetPath: 'assets/images/teachers/grading.png', cardHeading: 'Grading assignments', cardDescription: 'Grade assignments very easily with the in build preview. Simply select the student, to his/her assignment work.', ), - TeachersCard( + const TeachersCard( assetPath: 'assets/images/teachers/embed.png', cardHeading: 'Use Interactive Circuits in your Blogs, Study Materials or PowerPoint presentations', diff --git a/lib/utils/router.dart b/lib/utils/router.dart index 62bd8d52..89d0f00e 100644 --- a/lib/utils/router.dart +++ b/lib/utils/router.dart @@ -38,15 +38,16 @@ class CVRouter { case CVLandingView.id: return MaterialPageRoute(builder: (_) => CVLandingView()); case TeachersView.id: - return MaterialPageRoute(builder: (_) => TeachersView()); + return MaterialPageRoute(builder: (_) => const TeachersView()); case ContributorsView.id: - return MaterialPageRoute(builder: (_) => ContributorsView()); + return MaterialPageRoute(builder: (_) => const ContributorsView()); case AboutTosView.id: - return MaterialPageRoute(builder: (_) => AboutTosView()); + return MaterialPageRoute(builder: (_) => const AboutTosView()); case AboutPrivacyPolicyView.id: - return MaterialPageRoute(builder: (_) => AboutPrivacyPolicyView()); + return MaterialPageRoute( + builder: (_) => const AboutPrivacyPolicyView()); case FeaturedProjectsView.id: - return MaterialPageRoute(builder: (_) => FeaturedProjectsView()); + return MaterialPageRoute(builder: (_) => const FeaturedProjectsView()); case ProfileView.id: var _userId = settings.arguments as String; return MaterialPageRoute( diff --git a/lib/viewmodels/startup/startup_viewmodel.dart b/lib/viewmodels/startup/startup_viewmodel.dart index 12e5d52b..5b7045af 100644 --- a/lib/viewmodels/startup/startup_viewmodel.dart +++ b/lib/viewmodels/startup/startup_viewmodel.dart @@ -4,7 +4,7 @@ import 'package:mobile_app/viewmodels/base_viewmodel.dart'; class StartUpViewModel extends BaseModel { Future handleStartUpLogic() async { - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); await Get.offAllNamed(CVLandingView.id); } } diff --git a/test/service_tests/contributors_api_test.dart b/test/service_tests/contributors_api_test.dart index 7da7037e..ab6b30db 100644 --- a/test/service_tests/contributors_api_test.dart +++ b/test/service_tests/contributors_api_test.dart @@ -27,7 +27,7 @@ void main() { test('When called & http client throws Exceptions', () async { var _contributorsApi = HttpContributorsApi(); - ApiUtils.client = MockClient((_) => throw FormatException('')); + ApiUtils.client = MockClient((_) => throw const FormatException('')); expect(_contributorsApi.fetchContributors(), throwsA(isInstanceOf())); diff --git a/test/service_tests/ib_api_test.dart b/test/service_tests/ib_api_test.dart index 7b28b7cd..70722d3c 100644 --- a/test/service_tests/ib_api_test.dart +++ b/test/service_tests/ib_api_test.dart @@ -44,7 +44,7 @@ void main() { var _ibApi = HttpIbApi(); - ApiUtils.client = MockClient((_) => throw FormatException('')); + ApiUtils.client = MockClient((_) => throw const FormatException('')); expect(_ibApi.fetchApiPage(), throwsA(isInstanceOf())); ApiUtils.client = MockClient((_) => throw Exception('')); @@ -65,7 +65,7 @@ void main() { test('When called & http client throws Exceptions', () async { var _ibApi = HttpIbApi(); - ApiUtils.client = MockClient((_) => throw FormatException('')); + ApiUtils.client = MockClient((_) => throw const FormatException('')); expect(_ibApi.fetchRawPageData(), throwsA(isInstanceOf())); ApiUtils.client = MockClient((_) => throw Exception('')); diff --git a/test/service_tests/users_api_test.dart b/test/service_tests/users_api_test.dart index bcb8887d..fb67f810 100644 --- a/test/service_tests/users_api_test.dart +++ b/test/service_tests/users_api_test.dart @@ -39,7 +39,7 @@ void main() { expect(_usersApi.login('test@test.com', 'test'), throwsA(isInstanceOf())); - ApiUtils.client = MockClient((_) => throw FormatException('')); + ApiUtils.client = MockClient((_) => throw const FormatException('')); expect(_usersApi.login('test@test.com', 'test'), throwsA(isInstanceOf())); @@ -66,7 +66,7 @@ void main() { expect(_usersApi.signup('test', 'test@test.com', 'test'), throwsA(isInstanceOf())); - ApiUtils.client = MockClient((_) => throw FormatException('')); + ApiUtils.client = MockClient((_) => throw const FormatException('')); expect(_usersApi.signup('test', 'test@test.com', 'test'), throwsA(isInstanceOf())); @@ -94,7 +94,7 @@ void main() { expect(_usersApi.oauthLogin(accessToken: 'token', provider: 'test'), throwsA(isInstanceOf())); - ApiUtils.client = MockClient((_) => throw FormatException('')); + ApiUtils.client = MockClient((_) => throw const FormatException('')); expect(_usersApi.oauthLogin(accessToken: 'token', provider: 'test'), throwsA(isInstanceOf())); @@ -122,7 +122,7 @@ void main() { expect(_usersApi.oauthSignup(accessToken: 'token', provider: 'test'), throwsA(isInstanceOf())); - ApiUtils.client = MockClient((_) => throw FormatException('')); + ApiUtils.client = MockClient((_) => throw const FormatException('')); expect(_usersApi.oauthSignup(accessToken: 'token', provider: 'test'), throwsA(isInstanceOf())); @@ -145,7 +145,7 @@ void main() { test('When called & http client throws Exceptions', () async { var _usersApi = HttpUsersApi(); - ApiUtils.client = MockClient((_) => throw FormatException('')); + ApiUtils.client = MockClient((_) => throw const FormatException('')); expect(_usersApi.fetchUser('1'), throwsA(isInstanceOf())); ApiUtils.client = MockClient((_) => throw NotFoundException('')); @@ -169,7 +169,7 @@ void main() { test('When called & http client throws Exceptions', () async { var _usersApi = HttpUsersApi(); - ApiUtils.client = MockClient((_) => throw FormatException('')); + ApiUtils.client = MockClient((_) => throw const FormatException('')); expect(_usersApi.fetchCurrentUser(), throwsA(isInstanceOf())); ApiUtils.client = MockClient((_) => throw Exception('')); @@ -197,7 +197,7 @@ void main() { when(_localStorage.currentUser).thenReturn(User.fromJson(mockUser)); var _usersApi = HttpUsersApi(); - ApiUtils.client = MockClient((_) => throw FormatException('')); + ApiUtils.client = MockClient((_) => throw const FormatException('')); expect(_usersApi.updateProfile('Test User', 'Gurukul', 'India', true), throwsA(isInstanceOf())); @@ -224,7 +224,7 @@ void main() { expect(_usersApi.sendResetPasswordInstructions('test@test.com'), throwsA(isInstanceOf())); - ApiUtils.client = MockClient((_) => throw FormatException('')); + ApiUtils.client = MockClient((_) => throw const FormatException('')); expect(_usersApi.sendResetPasswordInstructions('test@test.com'), throwsA(isInstanceOf())); diff --git a/test/setup/test_helpers.dart b/test/setup/test_helpers.dart index 70bb52bb..acff746c 100644 --- a/test/setup/test_helpers.dart +++ b/test/setup/test_helpers.dart @@ -31,7 +31,7 @@ import 'package:mobile_app/viewmodels/projects/featured_projects_viewmodel.dart' import 'package:mobile_app/viewmodels/projects/project_details_viewmodel.dart'; import 'package:mockito/mockito.dart'; -Function deepEq = DeepCollectionEquality().equals; +Function deepEq = const DeepCollectionEquality().equals; class NavigatorObserverMock extends Mock implements NavigatorObserver {} diff --git a/test/ui_tests/about/about_privacy_policy_view_test.dart b/test/ui_tests/about/about_privacy_policy_view_test.dart index 8ea38b1b..d0e3a60d 100644 --- a/test/ui_tests/about/about_privacy_policy_view_test.dart +++ b/test/ui_tests/about/about_privacy_policy_view_test.dart @@ -25,10 +25,10 @@ void main() { await tester.pumpWidget( GetMaterialApp( localizationsDelegates: AppLocalizations.localizationsDelegates, - locale: Locale('en'), + locale: const Locale('en'), onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: AboutPrivacyPolicyView(), + home: const AboutPrivacyPolicyView(), ), ); diff --git a/test/ui_tests/about/about_tos_view_test.dart b/test/ui_tests/about/about_tos_view_test.dart index be06c770..8cda49c2 100644 --- a/test/ui_tests/about/about_tos_view_test.dart +++ b/test/ui_tests/about/about_tos_view_test.dart @@ -25,10 +25,10 @@ void main() { await tester.pumpWidget( GetMaterialApp( localizationsDelegates: AppLocalizations.localizationsDelegates, - locale: Locale('en'), + locale: const Locale('en'), onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: AboutTosView(), + home: const AboutTosView(), ), ); diff --git a/test/ui_tests/about/about_view_test.dart b/test/ui_tests/about/about_view_test.dart index 9f7d6452..545285db 100644 --- a/test/ui_tests/about/about_view_test.dart +++ b/test/ui_tests/about/about_view_test.dart @@ -35,7 +35,7 @@ void main() { await tester.pumpWidget( GetMaterialApp( localizationsDelegates: AppLocalizations.localizationsDelegates, - locale: Locale('en'), + locale: const Locale('en'), onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], home: AboutView(), diff --git a/test/ui_tests/contributors/contributors_view_test.dart b/test/ui_tests/contributors/contributors_view_test.dart index 9983464c..028cb928 100644 --- a/test/ui_tests/contributors/contributors_view_test.dart +++ b/test/ui_tests/contributors/contributors_view_test.dart @@ -23,7 +23,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: ContributorsView(), + home: const ContributorsView(), ), ); diff --git a/test/ui_tests/groups/add_assignment_view_test.dart b/test/ui_tests/groups/add_assignment_view_test.dart index 5922c2e9..e5a8b339 100644 --- a/test/ui_tests/groups/add_assignment_view_test.dart +++ b/test/ui_tests/groups/add_assignment_view_test.dart @@ -33,7 +33,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: AddAssignmentView(), + home: const AddAssignmentView(), ), ); @@ -54,9 +54,9 @@ void main() { } else if (widget is CVHtmlEditor) { return true; } else if (widget is DateTimeField) { - return widget.key == Key('cv_assignment_deadline_field'); + return widget.key == const Key('cv_assignment_deadline_field'); } else if (widget is DropdownButtonFormField) { - return widget.key == Key('cv_assignment_grading_dropdown'); + return widget.key == const Key('cv_assignment_grading_dropdown'); } else if (widget is CheckboxListTile) { return true; } @@ -106,7 +106,7 @@ void main() { widget.onPressed(); await tester.pumpAndSettle(); - await tester.pump(Duration(seconds: 5)); + await tester.pump(const Duration(seconds: 5)); // Verify Dialog Service is called to show Dialog of Updating verify(_dialogService.showCustomProgressDialog(title: anyNamed('title'))) diff --git a/test/ui_tests/groups/assignment_details_view_test.dart b/test/ui_tests/groups/assignment_details_view_test.dart index 54d8dfa9..d2d54455 100644 --- a/test/ui_tests/groups/assignment_details_view_test.dart +++ b/test/ui_tests/groups/assignment_details_view_test.dart @@ -65,8 +65,8 @@ void main() { await tester.pumpAndSettle(); // Scroll - final gesture = await tester.startGesture(Offset(0, 300)); - await gesture.moveBy(Offset(0, 900)); + final gesture = await tester.startGesture(const Offset(0, 300)); + await gesture.moveBy(const Offset(0, 900)); await tester.pump(); // Finds Author Name and Assignment name who submitted diff --git a/test/ui_tests/groups/edit_group_view_test.dart b/test/ui_tests/groups/edit_group_view_test.dart index 53a82f6d..016ea75e 100644 --- a/test/ui_tests/groups/edit_group_view_test.dart +++ b/test/ui_tests/groups/edit_group_view_test.dart @@ -88,7 +88,7 @@ void main() { await tester.tap(find.widgetWithText(CVPrimaryButton, 'Save')); await tester.pumpAndSettle(); - await tester.pump(Duration(seconds: 5)); + await tester.pump(const Duration(seconds: 5)); // Verify Dialog Service is called to show Dialog of Updating verify(_dialogService.showCustomProgressDialog(title: anyNamed('title'))) diff --git a/test/ui_tests/groups/new_group_view_test.dart b/test/ui_tests/groups/new_group_view_test.dart index b81e7390..1d796480 100644 --- a/test/ui_tests/groups/new_group_view_test.dart +++ b/test/ui_tests/groups/new_group_view_test.dart @@ -84,7 +84,7 @@ void main() { await tester.tap(find.widgetWithText(CVPrimaryButton, 'SAVE')); await tester.pumpAndSettle(); - await tester.pump(Duration(seconds: 5)); + await tester.pump(const Duration(seconds: 5)); // Verify Dialog Service is called to show Dialog of Updating verify(_dialogService.showCustomProgressDialog(title: anyNamed('title'))) diff --git a/test/ui_tests/groups/update_assignment_view_test.dart b/test/ui_tests/groups/update_assignment_view_test.dart index 560a03b7..0572b668 100644 --- a/test/ui_tests/groups/update_assignment_view_test.dart +++ b/test/ui_tests/groups/update_assignment_view_test.dart @@ -59,7 +59,7 @@ void main() { } else if (widget is CVHtmlEditor) { return true; } else if (widget is DateTimeField) { - return widget.key == Key('cv_assignment_deadline_field'); + return widget.key == const Key('cv_assignment_deadline_field'); } else if (widget is CheckboxListTile) { return true; } @@ -109,7 +109,7 @@ void main() { widget.onPressed(); await tester.pumpAndSettle(); - await tester.pump(Duration(seconds: 5)); + await tester.pump(const Duration(seconds: 5)); // Verify Dialog Service is called to show Dialog of Updating verify(_dialogService.showCustomProgressDialog(title: anyNamed('title'))) diff --git a/test/ui_tests/profile/edit_profile_view_test.dart b/test/ui_tests/profile/edit_profile_view_test.dart index 6c22d575..9ce32808 100644 --- a/test/ui_tests/profile/edit_profile_view_test.dart +++ b/test/ui_tests/profile/edit_profile_view_test.dart @@ -101,7 +101,7 @@ void main() { await tester.tap(find.widgetWithText(CVPrimaryButton, 'Save Details')); await tester.pumpAndSettle(); - await tester.pump(Duration(seconds: 5)); + await tester.pump(const Duration(seconds: 5)); // Verify Dialog Service is called to show Dialog of Updating verify(_dialogService.showCustomProgressDialog(title: anyNamed('title'))) diff --git a/test/ui_tests/profile/profile_view_test.dart b/test/ui_tests/profile/profile_view_test.dart index 7178c8c9..c60eb9c2 100644 --- a/test/ui_tests/profile/profile_view_test.dart +++ b/test/ui_tests/profile/profile_view_test.dart @@ -57,7 +57,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: ProfileView(), + home: const ProfileView(), ), ); diff --git a/test/ui_tests/profile/user_favourites_view_test.dart b/test/ui_tests/profile/user_favourites_view_test.dart index be4eb7a4..225408e9 100644 --- a/test/ui_tests/profile/user_favourites_view_test.dart +++ b/test/ui_tests/profile/user_favourites_view_test.dart @@ -47,7 +47,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: Scaffold( + home: const Scaffold( body: UserFavouritesView(), ), ), diff --git a/test/ui_tests/profile/user_projects_view_test.dart b/test/ui_tests/profile/user_projects_view_test.dart index 93d667b9..1cf2751a 100644 --- a/test/ui_tests/profile/user_projects_view_test.dart +++ b/test/ui_tests/profile/user_projects_view_test.dart @@ -46,7 +46,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: Scaffold( + home: const Scaffold( body: UserProjectsView(), ), ), diff --git a/test/ui_tests/projects/featured_projects_view_test.dart b/test/ui_tests/projects/featured_projects_view_test.dart index c8b2b679..b49775a6 100644 --- a/test/ui_tests/projects/featured_projects_view_test.dart +++ b/test/ui_tests/projects/featured_projects_view_test.dart @@ -48,7 +48,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: FeaturedProjectsView(), + home: const FeaturedProjectsView(), ), ); diff --git a/test/ui_tests/startup/startup_view_test.dart b/test/ui_tests/startup/startup_view_test.dart index 61f2743e..954c980f 100644 --- a/test/ui_tests/startup/startup_view_test.dart +++ b/test/ui_tests/startup/startup_view_test.dart @@ -26,7 +26,7 @@ void main() { await tester.pumpWidget( GetMaterialApp( localizationsDelegates: AppLocalizations.localizationsDelegates, - locale: Locale('en'), + locale: const Locale('en'), onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], home: StartUpView(), @@ -42,14 +42,14 @@ void main() { (WidgetTester tester) async { await _pumpStartUpView(tester); - expect(find.byKey(Key('cv_startup_logo')), findsOneWidget); - await tester.pumpAndSettle(Duration(seconds: 1)); + expect(find.byKey(const Key('cv_startup_logo')), findsOneWidget); + await tester.pumpAndSettle(const Duration(seconds: 1)); }); testWidgets('HomeView is pushed over StartUpView after 1 second', (WidgetTester tester) async { await _pumpStartUpView(tester); - await tester.pumpAndSettle(Duration(seconds: 1)); + await tester.pumpAndSettle(const Duration(seconds: 1)); verify(mockObserver.didPush(any, any)); expect(find.byType(CVLandingView), findsOneWidget); diff --git a/test/ui_tests/teachers/teachers_view_test.dart b/test/ui_tests/teachers/teachers_view_test.dart index a5e4f03b..70ccef5e 100644 --- a/test/ui_tests/teachers/teachers_view_test.dart +++ b/test/ui_tests/teachers/teachers_view_test.dart @@ -21,7 +21,7 @@ void main() { GetMaterialApp( onGenerateRoute: CVRouter.generateRoute, navigatorObservers: [mockObserver], - home: TeachersView(), + home: const TeachersView(), ), ); diff --git a/test/utils_tests/api_utils_test.dart b/test/utils_tests/api_utils_test.dart index 984a6593..713e6a48 100644 --- a/test/utils_tests/api_utils_test.dart +++ b/test/utils_tests/api_utils_test.dart @@ -16,7 +16,7 @@ void main() { tearDown(() => unregisterServices()); test('When http method called & raises SocketException', () { - ApiUtils.client = MockClient((_) => throw SocketException('')); + ApiUtils.client = MockClient((_) => throw const SocketException('')); expect(() => ApiUtils.get('/'), throwsA(isInstanceOf())); expect(() => ApiUtils.post('/'), throwsA(isInstanceOf())); @@ -26,7 +26,7 @@ void main() { }); test('When http method called & raises HttpException', () { - ApiUtils.client = MockClient((_) => throw HttpException('')); + ApiUtils.client = MockClient((_) => throw const HttpException('')); expect(() => ApiUtils.get('/'), throwsA(isInstanceOf())); expect(() => ApiUtils.post('/'), throwsA(isInstanceOf()));