Skip to content

Commit

Permalink
fix(lints): fix multiple lint rules (#153)
Browse files Browse the repository at this point in the history
* fix(lints): always_declare_return_types and prefer_if_elements_to_conditional_expressions rules

* fix(lints): Remove always_declare_return_types and prefer_if_elements_to_conditional_expressions rules

* Formatted the code
  • Loading branch information
Neha62-lit authored Oct 8, 2021
1 parent 5849c2e commit c354531
Show file tree
Hide file tree
Showing 12 changed files with 137 additions and 126 deletions.
4 changes: 0 additions & 4 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 21 additions & 19 deletions lib/ui/components/cv_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
],
);
}
Expand Down
21 changes: 11 additions & 10 deletions lib/ui/components/cv_subheader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
],
);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/components/cv_typeahead_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
}
},
Expand Down
21 changes: 11 additions & 10 deletions lib/ui/views/about/about_privacy_policy_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
81 changes: 41 additions & 40 deletions lib/ui/views/cv_landing_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,49 +174,50 @@ class _CVLandingViewState extends State<CVLandingView> {
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: <Widget>[
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: <Widget>[
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(
Expand Down
5 changes: 4 additions & 1 deletion lib/ui/views/groups/add_assignment_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,10 @@ class _AddAssignmentViewState extends State<AddAssignmentView> {
_buildDeadlineInput(),
_buildGradingScaleDropdown(),
_buildRestrictionsHeader(),
_isRestrictionEnabled ? _buildRestrictions() : Container(),
if (_isRestrictionEnabled)
_buildRestrictions()
else
Container(),
_buildCreateButton(),
],
),
Expand Down
15 changes: 8 additions & 7 deletions lib/ui/views/groups/components/member_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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()
],
),
);
Expand Down
5 changes: 4 additions & 1 deletion lib/ui/views/groups/update_assignment_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ class _UpdateAssignmentViewState extends State<UpdateAssignmentView> {
_buildDescriptionInput(),
_buildDeadlineInput(),
_buildRestrictionsHeader(),
_isRestrictionEnabled ? _buildRestrictions() : Container(),
if (_isRestrictionEnabled)
_buildRestrictions()
else
Container(),
_buildUpdateButton(),
],
),
Expand Down
33 changes: 17 additions & 16 deletions lib/ui/views/ib/components/ib_pop_quiz_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,23 @@ class IbPopQuizButtonState extends State<IbPopQuizButton> {
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(),
],
),
),
Expand Down
15 changes: 8 additions & 7 deletions lib/ui/views/ib/ib_landing_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,14 @@ class _IbLandingViewState extends State<IbLandingView> {
: 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(
Expand Down
19 changes: 10 additions & 9 deletions lib/ui/views/ib/ib_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -461,15 +461,16 @@ class _IbPageViewState extends State<IbPageView> {
),
),
),
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(),
],
);
},
Expand Down

0 comments on commit c354531

Please sign in to comment.