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): multiple linter rules #149 #177

Closed
wants to merge 5 commits into from
Closed
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 @@ -8,8 +8,4 @@ linter:
# Util classes
avoid_classes_with_only_static_members: false

avoid_redundant_argument_values: false

non_constant_identifier_names: false

constant_identifier_names: false
4 changes: 2 additions & 2 deletions lib/services/database_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ enum DatabaseBox {
IB,
}

List<TypeAdapter> DatabaseAdapters = <TypeAdapter>[
List<TypeAdapter> databaseAdapters = <TypeAdapter>[
IbRawPageDataAdapter(),
];

Expand Down Expand Up @@ -38,7 +38,7 @@ class DatabaseServiceImpl implements DatabaseService {
}

// Register Adapters for Hive
for (var adapter in DatabaseAdapters) {
for (var adapter in databaseAdapters) {
Hive.registerAdapter(adapter);
}
}
Expand Down
10 changes: 5 additions & 5 deletions lib/services/ib_engine_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,19 @@ class IbEngineServiceImpl implements IbEngineService {
var toc = <IbTocItem>[];

for (var li in element.children) {
var eff_index = num ? index.toString() : String.fromCharCode(index);
var effIndex = num ? index.toString() : String.fromCharCode(index);
if (li.getElementsByTagName('ol').isNotEmpty) {
toc.add(
IbTocItem(
leading: '$eff_index.',
leading: '$effIndex.',
content: li.firstChild.text,
items: _parseToc(li.children[1], num: !num),
),
);
} else {
toc.add(
IbTocItem(
leading: '$eff_index.',
leading: '$effIndex.',
content: li.text,
),
);
Expand All @@ -191,7 +191,7 @@ class IbEngineServiceImpl implements IbEngineService {
var toc = <IbTocItem>[];

for (var li in element.children) {
var eff_index = num ? index.toString() : String.fromCharCode(index);
var effIndex = num ? index.toString() : String.fromCharCode(index);
var sublist = <IbTocItem>[];

for (var node in li.nodes) {
Expand All @@ -206,7 +206,7 @@ class IbEngineServiceImpl implements IbEngineService {

toc.add(
IbTocItem(
leading: '$eff_index.',
leading: '$effIndex.',
content: root ? li.nodes[0].text.trim() : li.text.trim(),
items: sublist.isNotEmpty ? sublist : null,
),
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/views/about/about_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class _AboutViewState extends State<AboutView> {
}

Widget _buildContributorsList() {
switch (_model.stateFor(_model.FETCH_CONTRIBUTORS)) {
switch (_model.stateFor(_model.fetchContributorsKey)) {
case ViewState.Success:
var _contributorsAvatars = <Widget>[];
for (var contributor in _model.cvContributors) {
Expand Down Expand Up @@ -78,7 +78,7 @@ class _AboutViewState extends State<AboutView> {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 32),
child: Text(
_model.errorMessageFor(_model.FETCH_CONTRIBUTORS),
_model.errorMessageFor(_model.fetchContributorsKey),
textAlign: TextAlign.center,
),
);
Expand Down
18 changes: 9 additions & 9 deletions lib/ui/views/authentication/components/auth_options_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,38 @@ class _AuthOptionsViewState extends State<AuthOptionsView> {
Future<void> onGoogleAuthPressed() async {
await _model.googleAuth(isSignUp: widget.isSignUp);

if (_model.isSuccess(_model.GOOGLE_OAUTH)) {
if (_model.isSuccess(_model.googleOAuthKey)) {
await Get.offAllNamed(CVLandingView.id);
} else if (_model.isError(_model.GOOGLE_OAUTH)) {
} else if (_model.isError(_model.googleOAuthKey)) {
SnackBarUtils.showDark(
'Google Authentication Error',
_model.errorMessageFor(_model.GOOGLE_OAUTH),
_model.errorMessageFor(_model.googleOAuthKey),
);
}
}

Future<void> onFacebookAuthPressed() async {
await _model.facebookAuth(isSignUp: widget.isSignUp);

if (_model.isSuccess(_model.FB_OAUTH)) {
if (_model.isSuccess(_model.fbOAuthKey)) {
await Get.offAllNamed(CVLandingView.id);
} else if (_model.isError(_model.FB_OAUTH)) {
} else if (_model.isError(_model.fbOAuthKey)) {
SnackBarUtils.showDark(
'Facebook Authentication Error',
_model.errorMessageFor(_model.FB_OAUTH),
_model.errorMessageFor(_model.fbOAuthKey),
);
}
}

Future<void> onGithubAuthPressed() async {
await _model.githubAuth(isSignUp: widget.isSignUp);

if (_model.isSuccess(_model.GITHUB_OAUTH)) {
if (_model.isSuccess(_model.githubOAuthKey)) {
await Get.offAllNamed(CVLandingView.id);
} else if (_model.isError(_model.GITHUB_OAUTH)) {
} else if (_model.isError(_model.githubOAuthKey)) {
SnackBarUtils.showDark(
'GitHub Authentication Error',
_model.errorMessageFor(_model.GITHUB_OAUTH),
_model.errorMessageFor(_model.githubOAuthKey),
);
}
}
Expand Down
10 changes: 5 additions & 5 deletions lib/ui/views/authentication/forgot_password_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class _ForgotPasswordViewState extends State<ForgotPasswordView> {
padding: const EdgeInsets.symmetric(horizontal: 16),
width: double.infinity,
child: CVPrimaryButton(
title: _model.isBusy(_model.SEND_RESET_INSTRUCTIONS)
title: _model.isBusy(_model.sendResetInstructionsKey)
? 'Sending..'
: 'SEND INSTRUCTIONS',
onPressed: _validateAndSubmit,
Expand Down Expand Up @@ -88,7 +88,7 @@ class _ForgotPasswordViewState extends State<ForgotPasswordView> {
var _dialogService = locator<DialogService>();

if (Validators.validateAndSaveForm(_formKey) &&
!_model.isBusy(_model.SEND_RESET_INSTRUCTIONS)) {
!_model.isBusy(_model.sendResetInstructionsKey)) {
FocusScope.of(context).requestFocus(FocusNode());

_dialogService.showCustomProgressDialog(title: 'Sending Instructions');
Expand All @@ -97,7 +97,7 @@ class _ForgotPasswordViewState extends State<ForgotPasswordView> {

_dialogService.popDialog();

if (_model.isSuccess(_model.SEND_RESET_INSTRUCTIONS)) {
if (_model.isSuccess(_model.sendResetInstructionsKey)) {
// show instructions sent snackbar
SnackBarUtils.showDark(
'Instructions Sent to $_email',
Expand All @@ -107,11 +107,11 @@ class _ForgotPasswordViewState extends State<ForgotPasswordView> {
// route back to previous screen
await Future.delayed(const Duration(seconds: 1));
Get.back();
} else if (_model.isError(_model.SEND_RESET_INSTRUCTIONS)) {
} else if (_model.isError(_model.sendResetInstructionsKey)) {
// show failure snackbar
SnackBarUtils.showDark(
'Error',
_model.errorMessageFor(_model.SEND_RESET_INSTRUCTIONS),
_model.errorMessageFor(_model.sendResetInstructionsKey),
);
_formKey.currentState.reset();
}
Expand Down
10 changes: 5 additions & 5 deletions lib/ui/views/authentication/login_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class _LoginViewState extends State<LoginView> {
padding: const EdgeInsets.symmetric(horizontal: 16),
width: double.infinity,
child: CVPrimaryButton(
title: _model.isBusy(_model.LOGIN) ? 'Authenticating..' : 'LOGIN',
title: _model.isBusy(_model.loginKey) ? 'Authenticating..' : 'LOGIN',
onPressed: _validateAndSubmit,
),
);
Expand Down Expand Up @@ -117,12 +117,12 @@ class _LoginViewState extends State<LoginView> {

Future<void> _validateAndSubmit() async {
if (Validators.validateAndSaveForm(_formKey) &&
!_model.isBusy(_model.LOGIN)) {
!_model.isBusy(_model.loginKey)) {
FocusScope.of(context).requestFocus(FocusNode());

await _model.login(_email, _password);

if (_model.isSuccess(_model.LOGIN)) {
if (_model.isSuccess(_model.loginKey)) {
// show login successful snackbar..
SnackBarUtils.showDark(
'Login Successful',
Expand All @@ -132,11 +132,11 @@ class _LoginViewState extends State<LoginView> {
// move to home view on successful login..
await Future.delayed(const Duration(seconds: 1));
await Get.offAllNamed(CVLandingView.id);
} else if (_model.isError(_model.LOGIN)) {
} else if (_model.isError(_model.loginKey)) {
// show failure snackbar..
SnackBarUtils.showDark(
'Error',
_model.errorMessageFor(_model.LOGIN),
_model.errorMessageFor(_model.loginKey),
);
_formKey.currentState.reset();
}
Expand Down
10 changes: 5 additions & 5 deletions lib/ui/views/authentication/signup_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class _SignupViewState extends State<SignupView> {
padding: const EdgeInsets.symmetric(horizontal: 16),
width: double.infinity,
child: CVPrimaryButton(
title: _signUpModel.isBusy(_signUpModel.SIGNUP)
title: _signUpModel.isBusy(_signUpModel.signupKey)
? 'Authenticating..'
: 'REGISTER',
onPressed: _validateAndSubmit,
Expand Down Expand Up @@ -118,12 +118,12 @@ class _SignupViewState extends State<SignupView> {

Future<void> _validateAndSubmit() async {
if (Validators.validateAndSaveForm(_formKey) &&
!_signUpModel.isBusy(_signUpModel.SIGNUP)) {
!_signUpModel.isBusy(_signUpModel.signupKey)) {
FocusScope.of(context).requestFocus(FocusNode());

await _signUpModel.signup(_name, _email, _password);

if (_signUpModel.isSuccess(_signUpModel.SIGNUP)) {
if (_signUpModel.isSuccess(_signUpModel.signupKey)) {
// show signup successful snackbar..
SnackBarUtils.showDark(
'Signup Successful',
Expand All @@ -135,11 +135,11 @@ class _SignupViewState extends State<SignupView> {
const Duration(seconds: 1),
);
await Get.offAllNamed(CVLandingView.id);
} else if (_signUpModel.isError(_signUpModel.SIGNUP)) {
} else if (_signUpModel.isError(_signUpModel.signupKey)) {
// show failure snackbar..
SnackBarUtils.showDark(
'Error',
_signUpModel.errorMessageFor(_signUpModel.SIGNUP),
_signUpModel.errorMessageFor(_signUpModel.signupKey),
);
_formKey.currentState.reset();
}
Expand Down
8 changes: 4 additions & 4 deletions lib/ui/views/groups/add_assignment_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class _AddAssignmentViewState extends State<AddAssignmentView> {
value: _restrictions.contains(name),
onChanged: (value) {
if (value) {
_restrictions.add((name));
_restrictions.add(name);
} else {
_restrictions.remove(name);
}
Expand Down Expand Up @@ -228,7 +228,7 @@ class _AddAssignmentViewState extends State<AddAssignmentView> {

_dialogService.popDialog();

if (_model.isSuccess(_model.ADD_ASSIGNMENT)) {
if (_model.isSuccess(_model.addAssignmentKey)) {
await Future.delayed(const Duration(seconds: 1));

// returns the added assignment..
Expand All @@ -239,11 +239,11 @@ class _AddAssignmentViewState extends State<AddAssignmentView> {
'Assignment Added',
'New assignment was successfully added.',
);
} else if (_model.isError(_model.ADD_ASSIGNMENT)) {
} else if (_model.isError(_model.addAssignmentKey)) {
// Show failure snackbar
SnackBarUtils.showDark(
'Error',
_model.errorMessageFor(_model.ADD_ASSIGNMENT),
_model.errorMessageFor(_model.addAssignmentKey),
);
_formKey.currentState.reset();
}
Expand Down
20 changes: 10 additions & 10 deletions lib/ui/views/groups/assignment_details_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ class _AssignmentDetailsViewState extends State<AssignmentDetailsView> {

_dialogService.popDialog();

if (_model.isSuccess(_model.ADD_GRADE)) {
if (_model.isSuccess(_model.addGradeKey)) {
SnackBarUtils.showDark(
'Project Graded Successfully',
'You have graded the project.',
);
} else if (_model.isError(_model.ADD_GRADE)) {
} else if (_model.isError(_model.addGradeKey)) {
SnackBarUtils.showDark(
'Error',
_model.errorMessageFor(_model.ADD_GRADE),
_model.errorMessageFor(_model.addGradeKey),
);
}
}
Expand All @@ -284,15 +284,15 @@ class _AssignmentDetailsViewState extends State<AssignmentDetailsView> {

_dialogService.popDialog();

if (_model.isSuccess(_model.UPDATE_GRADE)) {
if (_model.isSuccess(_model.updateGradeKey)) {
SnackBarUtils.showDark(
'Grade updated Successfully',
'Grade has been updated successfully.',
);
} else if (_model.isError(_model.UPDATE_GRADE)) {
} else if (_model.isError(_model.updateGradeKey)) {
SnackBarUtils.showDark(
'Error',
_model.errorMessageFor(_model.UPDATE_GRADE),
_model.errorMessageFor(_model.updateGradeKey),
);
}
}
Expand All @@ -311,17 +311,17 @@ class _AssignmentDetailsViewState extends State<AssignmentDetailsView> {

_dialogService.popDialog();

if (_model.isSuccess(_model.DELETE_GRADE)) {
if (_model.isSuccess(_model.deleteGradeKey)) {
SnackBarUtils.showDark(
'Grade Deleted',
'Grade has been removed successfully.',
);
_gradesController.clear();
_remarksController.clear();
} else if (_model.isError(_model.DELETE_GRADE)) {
} else if (_model.isError(_model.deleteGradeKey)) {
SnackBarUtils.showDark(
'Error',
_model.errorMessageFor(_model.DELETE_GRADE),
_model.errorMessageFor(_model.deleteGradeKey),
);
}
}
Expand Down Expand Up @@ -456,7 +456,7 @@ class _AssignmentDetailsViewState extends State<AssignmentDetailsView> {
json.decode(_attrs.restrictions).join(' , '),
),
const Divider(height: 32),
if (_model.isSuccess(_model.FETCH_ASSIGNMENT_DETAILS))
if (_model.isSuccess(_model.fetchAssignmentDetailsKey))
Column(
children: <Widget>[
_buildSubmissions(),
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/views/groups/edit_group_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ class _EditGroupViewState extends State<EditGroupView> {

_dialogService.popDialog();

if (_model.isSuccess(_model.UPDATE_GROUP)) {
if (_model.isSuccess(_model.updateGroupKey)) {
await Future.delayed(const Duration(seconds: 1));
Get.back(result: _model.updatedGroup);
SnackBarUtils.showDark(
'Group Updated',
'Group has been successfully updated.',
);
} else if (_model.isError(_model.UPDATE_GROUP)) {
} else if (_model.isError(_model.updateGroupKey)) {
SnackBarUtils.showDark(
'Error',
_model.errorMessageFor(_model.UPDATE_GROUP),
_model.errorMessageFor(_model.updateGroupKey),
);
}
}
Expand Down
Loading