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 2 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
12 changes: 4 additions & 8 deletions lib/ui/components/cv_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,22 @@ class CVHeader extends StatelessWidget {
),
textAlign: TextAlign.center,
),
subtitle != null
? Text(
if (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(
) else Container(),
if (description != null) Container(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Text(
description,
style: Theme.of(context).textTheme.subtitle1,
textAlign: TextAlign.center,
),
)
: Container(),
) else Container(),
],
);
}
Expand Down
6 changes: 2 additions & 4 deletions lib/ui/components/cv_subheader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ class CVSubheader extends StatelessWidget {
),
textAlign: TextAlign.center,
),
subtitle != null
? Text(
if (subtitle != null) Text(
subtitle,
style: Theme.of(context).textTheme.subtitle1.copyWith(
fontWeight: FontWeight.w400,
color: CVTheme.textColor(context),
),
textAlign: TextAlign.center,
)
: Container(),
) 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
6 changes: 2 additions & 4 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,14 @@ class AboutPrivacyPolicyView extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
title != ''
? Text(
if (title != '') Text(
title,
style: style.copyWith(
fontWeight: FontWeight.w400,
color: CVTheme.primaryHeading(context),
),
textAlign: TextAlign.left,
)
: Container(),
) else Container(),
RichText(
textAlign: TextAlign.justify,
text: TextSpan(
Expand Down
6 changes: 2 additions & 4 deletions lib/ui/views/cv_landing_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ class _CVLandingViewState extends State<CVLandingView> {
iconData: Icons.account_balance,
),
),
_model.isLoggedIn
? Theme(
if (_model.isLoggedIn) Theme(
data: CVTheme.themeData(context),
child: ExpansionTile(
maintainState: true,
Expand Down Expand Up @@ -209,8 +208,7 @@ class _CVLandingViewState extends State<CVLandingView> {
),
],
),
)
: InkWell(
) else InkWell(
onTap: () => Get.offAndToNamed(LoginView.id),
child: CVDrawerTile(
title: AppLocalizations.of(context).login,
Expand Down
2 changes: 1 addition & 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,7 @@ class _AddAssignmentViewState extends State<AddAssignmentView> {
_buildDeadlineInput(),
_buildGradingScaleDropdown(),
_buildRestrictionsHeader(),
_isRestrictionEnabled ? _buildRestrictions() : Container(),
if (_isRestrictionEnabled) _buildRestrictions() else Container(),
_buildCreateButton(),
],
),
Expand Down
6 changes: 2 additions & 4 deletions lib/ui/views/groups/components/member_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@ class MemberCard extends StatelessWidget {
],
),
),
hasMentorAccess
? IconButton(
if (hasMentorAccess) IconButton(
icon: Icon(Icons.delete_outline),
color: CVTheme.red,
onPressed: onDeletePressed,
)
: Container()
) else Container()
],
),
);
Expand Down
2 changes: 1 addition & 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,7 @@ class _UpdateAssignmentViewState extends State<UpdateAssignmentView> {
_buildDescriptionInput(),
_buildDeadlineInput(),
_buildRestrictionsHeader(),
_isRestrictionEnabled ? _buildRestrictions() : Container(),
if (_isRestrictionEnabled) _buildRestrictions() else Container(),
_buildUpdateButton(),
],
),
Expand Down
6 changes: 2 additions & 4 deletions lib/ui/views/ib/components/ib_pop_quiz_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ class IbPopQuizButtonState extends State<IbPopQuizButton> {
widget.content,
style: TextStyle(color: _getTextColor(), fontSize: 16),
),
_isPressed
? Container(
if (_isPressed) Container(
height: 19,
width: 19,
decoration: BoxDecoration(
Expand All @@ -75,8 +74,7 @@ class IbPopQuizButtonState extends State<IbPopQuizButton> {
size: 16,
color: _getBorderColor(),
),
)
: Container(),
) else Container(),
],
),
),
Expand Down
6 changes: 2 additions & 4 deletions lib/ui/views/ib/ib_landing_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,11 @@ class _IbLandingViewState extends State<IbLandingView> {
: IbTheme.textColor(context),
),
),
!_model.isSuccess(_model.IB_FETCH_CHAPTERS)
? InkWell(
if (!_model.isSuccess(_model.IB_FETCH_CHAPTERS)) InkWell(
child: CVDrawerTile(
title: 'Loading...',
),
)
: _buildChapters(_model.chapters),
) else _buildChapters(_model.chapters),
],
),
Positioned(
Expand Down
6 changes: 2 additions & 4 deletions lib/ui/views/ib/ib_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -461,15 +461,13 @@ class _IbPageViewState extends State<IbPageView> {
),
),
),
widget.chapter.prev != null || widget.chapter.next != null
? Align(
if (widget.chapter.prev != null || widget.chapter.next != null) Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: _buildFloatingActionButtons(),
),
)
: Container(),
) else Container(),
],
);
},
Expand Down