Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lints): always_declare_return_types and prefer_if_elements_to_con… #153

Merged
merged 3 commits into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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