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): avoid_unnecessary_containers rule #152

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
5 changes: 0 additions & 5 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ linter:

directives_ordering: false

# In case of production should be set to true
avoid_print: false

avoid_unnecessary_containers: false

prefer_if_elements_to_conditional_expressions: false

avoid_function_literals_in_foreach_calls: false
Expand Down
2 changes: 1 addition & 1 deletion lib/services/database_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DatabaseServiceImpl implements DatabaseService {
try {
await Hive.initFlutter();
} catch (e) {
print('Hive Initialization Failed');
debugPrint('Hive Initialization Failed');
}

// Register Adapters for Hive
Expand Down
5 changes: 3 additions & 2 deletions lib/services/local_storage_service.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:mobile_app/enums/auth_type.dart';
import 'package:mobile_app/models/user.dart';
import 'package:shared_preferences/shared_preferences.dart';
Expand All @@ -24,12 +25,12 @@ class LocalStorageService {

dynamic _getFromDisk(String key) {
var value = _preferences.get(key);
print('LocalStorageService:_getFromDisk. key: $key value: $value');
debugPrint('LocalStorageService:_getFromDisk. key: $key value: $value');
return value;
}

void _saveToDisk<T>(String key, T content) {
print('LocalStorageService:_saveToDisk. key: $key value: $content');
debugPrint('LocalStorageService:_saveToDisk. key: $key value: $content');

if (content is String) {
_preferences.setString(key, content);
Expand Down
42 changes: 20 additions & 22 deletions lib/ui/views/about/about_privacy_policy_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,26 @@ class AboutPrivacyPolicyView extends StatelessWidget {
? Theme.of(context).textTheme.headline5
: Theme.of(context).textTheme.headline6;

return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
title != ''
? Text(
title,
style: style.copyWith(
fontWeight: FontWeight.w400,
color: CVTheme.primaryHeading(context),
),
textAlign: TextAlign.left,
)
: Container(),
RichText(
textAlign: TextAlign.justify,
text: TextSpan(
children: content,
),
)
],
),
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
title != ''
? Text(
title,
style: style.copyWith(
fontWeight: FontWeight.w400,
color: CVTheme.primaryHeading(context),
),
textAlign: TextAlign.left,
)
: Container(),
RichText(
textAlign: TextAlign.justify,
text: TextSpan(
children: content,
),
)
],
);
}

Expand Down
36 changes: 17 additions & 19 deletions lib/ui/views/about/about_tos_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,24 @@ class AboutTosView extends StatelessWidget {
@required String title,
@required List<TextSpan> content,
}) {
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context).textTheme.headline5.copyWith(
fontWeight: FontWeight.w400,
color: CVTheme.primaryHeading(context),
),
textAlign: TextAlign.left,
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context).textTheme.headline5.copyWith(
fontWeight: FontWeight.w400,
color: CVTheme.primaryHeading(context),
),
textAlign: TextAlign.left,
),
RichText(
textAlign: TextAlign.justify,
text: TextSpan(
children: content,
),
RichText(
textAlign: TextAlign.justify,
text: TextSpan(
children: content,
),
)
],
),
)
],
);
}

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 @@ -212,7 +212,7 @@ class _AddAssignmentViewState extends State<AddAssignmentView> {
_descriptionEditorText =
await _descriptionEditor.currentState.getText();
} on NoSuchMethodError {
print(
debugPrint(
'Handled html_editor error. NOTE: This should only throw during tests.');
_descriptionEditorText = '';
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/views/groups/components/assignment_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class _AssignmentCardState extends State<AssignmentCard> {
);
} else {
/// Add Not Submitted Button if _isProjectNotPresent & _isDeadlineOver
print('Not Submitted!');
debugPrint('Not Submitted!');
}
} else {
if (_projectId != null) {
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 @@ -191,7 +191,7 @@ class _UpdateAssignmentViewState extends State<UpdateAssignmentView> {
_descriptionEditorText =
await _descriptionEditor.currentState.getText();
} on NoSuchMethodError {
print(
debugPrint(
'Handled html_editor error. NOTE: This should only throw during tests.');
_descriptionEditorText = '';
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/views/ib/ib_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class _IbPageViewState extends State<IbPageView> {
await _hideButtonController.scrollToIndex(_slugMap[slug],
preferPosition: AutoScrollPosition.begin);
} else {
print('[IB]: $slug not present in map');
debugPrint('[IB]: $slug not present in map');
}
}

Expand Down
18 changes: 8 additions & 10 deletions lib/ui/views/projects/components/featured_project_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,14 @@ class _FeaturedProjectCardState extends State<FeaturedProjectCard> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Container(
child: Text(
widget.project.attributes.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.headline6.copyWith(
color: CVTheme.textColor(context),
),
),
child: Text(
widget.project.attributes.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.headline6.copyWith(
color: CVTheme.textColor(context),
),
),
),
CVPrimaryButton(
Expand Down