diff --git a/analysis_options.yaml b/analysis_options.yaml index 18978f25..ed253739 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -24,16 +24,12 @@ linter: leading_newlines_in_multiline_strings: false - always_declare_return_types: 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 - prefer_if_elements_to_conditional_expressions: false - avoid_function_literals_in_foreach_calls: false join_return_with_assignment: false diff --git a/lib/ui/components/cv_header.dart b/lib/ui/components/cv_header.dart index 01a8a7a6..190a2048 100644 --- a/lib/ui/components/cv_header.dart +++ b/lib/ui/components/cv_header.dart @@ -22,26 +22,28 @@ class CVHeader extends StatelessWidget { ), textAlign: TextAlign.center, ), - subtitle != null - ? Text( - subtitle, - style: Theme.of(context).textTheme.subtitle1.copyWith( - fontWeight: FontWeight.bold, - color: CVTheme.textColor(context), - ), - textAlign: TextAlign.center, - ) - : Container(), - description != null - ? Container( - padding: const EdgeInsets.symmetric(vertical: 16), - child: Text( - description, - style: Theme.of(context).textTheme.subtitle1, - textAlign: TextAlign.center, + if (subtitle != null) + Text( + subtitle, + style: Theme.of(context).textTheme.subtitle1.copyWith( + fontWeight: FontWeight.bold, + color: CVTheme.textColor(context), ), - ) - : Container(), + textAlign: TextAlign.center, + ) + else + Container(), + if (description != null) + Container( + padding: const EdgeInsets.symmetric(vertical: 16), + child: Text( + description, + style: Theme.of(context).textTheme.subtitle1, + textAlign: TextAlign.center, + ), + ) + else + Container(), ], ); } diff --git a/lib/ui/components/cv_subheader.dart b/lib/ui/components/cv_subheader.dart index 526cf917..1caa78d9 100644 --- a/lib/ui/components/cv_subheader.dart +++ b/lib/ui/components/cv_subheader.dart @@ -19,16 +19,17 @@ class CVSubheader extends StatelessWidget { ), textAlign: TextAlign.center, ), - subtitle != null - ? Text( - subtitle, - style: Theme.of(context).textTheme.subtitle1.copyWith( - fontWeight: FontWeight.w400, - color: CVTheme.textColor(context), - ), - textAlign: TextAlign.center, - ) - : Container(), + if (subtitle != null) + Text( + subtitle, + style: Theme.of(context).textTheme.subtitle1.copyWith( + fontWeight: FontWeight.w400, + color: CVTheme.textColor(context), + ), + textAlign: TextAlign.center, + ) + else + Container(), ], ); } diff --git a/lib/ui/components/cv_typeahead_field.dart b/lib/ui/components/cv_typeahead_field.dart index 0671f1dc..07491138 100644 --- a/lib/ui/components/cv_typeahead_field.dart +++ b/lib/ui/components/cv_typeahead_field.dart @@ -88,11 +88,11 @@ class CVTypeAheadField extends StatelessWidget { } //// If there is need of some other API Fetch add another if condition return [ - pattern == '' ? 'No suggestions found' : pattern, + if (pattern == '') 'No suggestions found' else pattern, ]; } catch (e) { return [ - pattern == '' ? 'No suggestions found' : pattern, + if (pattern == '') 'No suggestions found' else pattern, ]; } }, diff --git a/lib/ui/views/about/about_privacy_policy_view.dart b/lib/ui/views/about/about_privacy_policy_view.dart index 5a1150d8..3ad6e578 100644 --- a/lib/ui/views/about/about_privacy_policy_view.dart +++ b/lib/ui/views/about/about_privacy_policy_view.dart @@ -58,16 +58,17 @@ class AboutPrivacyPolicyView extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - title != '' - ? Text( - title, - style: style.copyWith( - fontWeight: FontWeight.w400, - color: CVTheme.primaryHeading(context), - ), - textAlign: TextAlign.left, - ) - : Container(), + if (title != '') + Text( + title, + style: style.copyWith( + fontWeight: FontWeight.w400, + color: CVTheme.primaryHeading(context), + ), + textAlign: TextAlign.left, + ) + else + Container(), RichText( textAlign: TextAlign.justify, text: TextSpan( diff --git a/lib/ui/views/cv_landing_view.dart b/lib/ui/views/cv_landing_view.dart index 2a8e93c1..d6afbde1 100644 --- a/lib/ui/views/cv_landing_view.dart +++ b/lib/ui/views/cv_landing_view.dart @@ -174,49 +174,50 @@ class _CVLandingViewState extends State { iconData: Icons.account_balance, ), ), - _model.isLoggedIn - ? Theme( - data: CVTheme.themeData(context), - child: ExpansionTile( - maintainState: true, - title: Text( - _model.currentUser.data.attributes.name ?? '', - style: Theme.of(context).textTheme.headline6.copyWith( - fontWeight: FontWeight.bold, - ), - ), - children: [ - InkWell( - onTap: () => setSelectedIndexTo(5), - child: CVDrawerTile( - title: AppLocalizations.of(context).profile, - iconData: FontAwesome5.user, - ), - ), - InkWell( - onTap: () => setSelectedIndexTo(6), - child: CVDrawerTile( - title: AppLocalizations.of(context).my_groups, - iconData: FontAwesome5.object_group, - ), - ), - InkWell( - onTap: onLogoutPressed, - child: CVDrawerTile( - title: AppLocalizations.of(context).logout, - iconData: FontAwesome.logout, - ), + if (_model.isLoggedIn) + Theme( + data: CVTheme.themeData(context), + child: ExpansionTile( + maintainState: true, + title: Text( + _model.currentUser.data.attributes.name ?? '', + style: Theme.of(context).textTheme.headline6.copyWith( + fontWeight: FontWeight.bold, ), - ], + ), + children: [ + InkWell( + onTap: () => setSelectedIndexTo(5), + child: CVDrawerTile( + title: AppLocalizations.of(context).profile, + iconData: FontAwesome5.user, + ), ), - ) - : InkWell( - onTap: () => Get.offAndToNamed(LoginView.id), - child: CVDrawerTile( - title: AppLocalizations.of(context).login, - iconData: FontAwesome.login, + InkWell( + onTap: () => setSelectedIndexTo(6), + child: CVDrawerTile( + title: AppLocalizations.of(context).my_groups, + iconData: FontAwesome5.object_group, + ), + ), + InkWell( + onTap: onLogoutPressed, + child: CVDrawerTile( + title: AppLocalizations.of(context).logout, + iconData: FontAwesome.logout, + ), ), - ) + ], + ), + ) + else + InkWell( + onTap: () => Get.offAndToNamed(LoginView.id), + child: CVDrawerTile( + title: AppLocalizations.of(context).login, + iconData: FontAwesome.login, + ), + ) ], ), Positioned( diff --git a/lib/ui/views/groups/add_assignment_view.dart b/lib/ui/views/groups/add_assignment_view.dart index ed51f984..39947d38 100644 --- a/lib/ui/views/groups/add_assignment_view.dart +++ b/lib/ui/views/groups/add_assignment_view.dart @@ -268,7 +268,10 @@ class _AddAssignmentViewState extends State { _buildDeadlineInput(), _buildGradingScaleDropdown(), _buildRestrictionsHeader(), - _isRestrictionEnabled ? _buildRestrictions() : Container(), + if (_isRestrictionEnabled) + _buildRestrictions() + else + Container(), _buildCreateButton(), ], ), diff --git a/lib/ui/views/groups/components/member_card.dart b/lib/ui/views/groups/components/member_card.dart index 7f15b4e1..18854a49 100644 --- a/lib/ui/views/groups/components/member_card.dart +++ b/lib/ui/views/groups/components/member_card.dart @@ -50,13 +50,14 @@ class MemberCard extends StatelessWidget { ], ), ), - hasMentorAccess - ? IconButton( - icon: Icon(Icons.delete_outline), - color: CVTheme.red, - onPressed: onDeletePressed, - ) - : Container() + if (hasMentorAccess) + IconButton( + icon: Icon(Icons.delete_outline), + color: CVTheme.red, + onPressed: onDeletePressed, + ) + else + Container() ], ), ); diff --git a/lib/ui/views/groups/update_assignment_view.dart b/lib/ui/views/groups/update_assignment_view.dart index 5c9a20cd..86b3741e 100644 --- a/lib/ui/views/groups/update_assignment_view.dart +++ b/lib/ui/views/groups/update_assignment_view.dart @@ -239,7 +239,10 @@ class _UpdateAssignmentViewState extends State { _buildDescriptionInput(), _buildDeadlineInput(), _buildRestrictionsHeader(), - _isRestrictionEnabled ? _buildRestrictions() : Container(), + if (_isRestrictionEnabled) + _buildRestrictions() + else + Container(), _buildUpdateButton(), ], ), 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 10676c9c..88e49bb4 100644 --- a/lib/ui/views/ib/components/ib_pop_quiz_button.dart +++ b/lib/ui/views/ib/components/ib_pop_quiz_button.dart @@ -61,22 +61,23 @@ class IbPopQuizButtonState extends State { widget.content, style: TextStyle(color: _getTextColor(), fontSize: 16), ), - _isPressed - ? Container( - height: 19, - width: 19, - decoration: BoxDecoration( - color: _getTextColor(), - borderRadius: BorderRadius.circular(50), - border: Border.all(color: _getBorderColor()), - ), - child: Icon( - getTheRightIcon(), - size: 16, - color: _getBorderColor(), - ), - ) - : Container(), + if (_isPressed) + Container( + height: 19, + width: 19, + decoration: BoxDecoration( + color: _getTextColor(), + borderRadius: BorderRadius.circular(50), + border: Border.all(color: _getBorderColor()), + ), + child: Icon( + getTheRightIcon(), + size: 16, + color: _getBorderColor(), + ), + ) + else + Container(), ], ), ), diff --git a/lib/ui/views/ib/ib_landing_view.dart b/lib/ui/views/ib/ib_landing_view.dart index 55535164..2a7756c7 100644 --- a/lib/ui/views/ib/ib_landing_view.dart +++ b/lib/ui/views/ib/ib_landing_view.dart @@ -159,13 +159,14 @@ class _IbLandingViewState extends State { : IbTheme.textColor(context), ), ), - !_model.isSuccess(_model.IB_FETCH_CHAPTERS) - ? InkWell( - child: CVDrawerTile( - title: 'Loading...', - ), - ) - : _buildChapters(_model.chapters), + if (!_model.isSuccess(_model.IB_FETCH_CHAPTERS)) + InkWell( + child: CVDrawerTile( + title: 'Loading...', + ), + ) + else + _buildChapters(_model.chapters), ], ), Positioned( diff --git a/lib/ui/views/ib/ib_page_view.dart b/lib/ui/views/ib/ib_page_view.dart index d620fcab..9a0bce7c 100644 --- a/lib/ui/views/ib/ib_page_view.dart +++ b/lib/ui/views/ib/ib_page_view.dart @@ -461,15 +461,16 @@ class _IbPageViewState extends State { ), ), ), - widget.chapter.prev != null || widget.chapter.next != null - ? Align( - alignment: Alignment.bottomCenter, - child: Padding( - padding: const EdgeInsets.all(16.0), - child: _buildFloatingActionButtons(), - ), - ) - : Container(), + if (widget.chapter.prev != null || widget.chapter.next != null) + Align( + alignment: Alignment.bottomCenter, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: _buildFloatingActionButtons(), + ), + ) + else + Container(), ], ); },