Skip to content

Commit

Permalink
sort constructors first again (#171)
Browse files Browse the repository at this point in the history
* Fixed sort_constructors_first

* Fixed sort_constructors_first again

* formated files

* Update analysis_options.yaml
  • Loading branch information
M-A-D-A-R-A authored Nov 22, 2021
1 parent d2e43ed commit 051c308
Show file tree
Hide file tree
Showing 84 changed files with 524 additions and 568 deletions.
3 changes: 0 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ analyzer:

linter:
rules:
# Make constructors the first thing in every class
sort_constructors_first: false

# Use parameter order as in json response
always_put_required_named_parameters_first: false

Expand Down
15 changes: 7 additions & 8 deletions lib/models/add_collaborator_response.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
class AddCollaboratorsResponse {
factory AddCollaboratorsResponse.fromJson(Map<String, dynamic> json) =>
AddCollaboratorsResponse(
added: List<String>.from(json['added'].map((x) => x)),
existing: List<String>.from(json['existing'].map((x) => x)),
invalid: List<String>.from(json['invalid'].map((x) => x)),
);

AddCollaboratorsResponse({
this.added,
this.existing,
this.invalid,
});

List<String> added;
List<String> existing;
List<String> invalid;

factory AddCollaboratorsResponse.fromJson(Map<String, dynamic> json) =>
AddCollaboratorsResponse(
added: List<String>.from(json['added'].map((x) => x)),
existing: List<String>.from(json['existing'].map((x) => x)),
invalid: List<String>.from(json['invalid'].map((x) => x)),
);
}
15 changes: 7 additions & 8 deletions lib/models/add_group_members_response.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
class AddGroupMembersResponse {
factory AddGroupMembersResponse.fromJson(Map<String, dynamic> json) =>
AddGroupMembersResponse(
added: List<String>.from(json['added'].map((x) => x)),
pending: List<String>.from(json['pending'].map((x) => x)),
invalid: List<String>.from(json['invalid'].map((x) => x)),
);

AddGroupMembersResponse({
this.added,
this.pending,
this.invalid,
});

List<String> added;
List<String> pending;
List<String> invalid;

factory AddGroupMembersResponse.fromJson(Map<String, dynamic> json) =>
AddGroupMembersResponse(
added: List<String>.from(json['added'].map((x) => x)),
pending: List<String>.from(json['pending'].map((x) => x)),
invalid: List<String>.from(json['invalid'].map((x) => x)),
);
}
69 changes: 33 additions & 36 deletions lib/models/assignments.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,22 @@ import 'package:mobile_app/models/links.dart';
import 'package:mobile_app/models/projects.dart';

class Assignments {
factory Assignments.fromJson(Map<String, dynamic> json) => Assignments(
data: List<Assignment>.from(
json['data'].map((x) => Assignment.fromJson(x)),
),
links: Links.fromJson(json['links']),
);
Assignments({
this.data,
this.links,
});

List<Assignment> data;
Links links;

factory Assignments.fromJson(Map<String, dynamic> json) => Assignments(
data: List<Assignment>.from(
json['data'].map((x) => Assignment.fromJson(x)),
),
links: Links.fromJson(json['links']),
);
}

class Assignment {
Assignment({
this.id,
this.type,
this.attributes,
this.projects,
this.grades,
});

String id;
String type;
AssignmentAttributes attributes;
List<Project> projects;
List<Grade> grades;

factory Assignment.fromJson(Map<String, dynamic> json) => Assignment(
id: json['id'] ?? json['data']['id'],
type: json['type'] ?? json['data']['type'],
Expand All @@ -54,6 +39,18 @@ class Assignment {
)
: null,
);
Assignment({
this.id,
this.type,
this.attributes,
this.projects,
this.grades,
});
String id;
String type;
AssignmentAttributes attributes;
List<Project> projects;
List<Grade> grades;

bool get canBeGraded =>
attributes.gradingScale != 'no_scale' &&
Expand All @@ -78,6 +75,21 @@ class Assignment {
}

class AssignmentAttributes {
factory AssignmentAttributes.fromJson(Map<String, dynamic> json) =>
AssignmentAttributes(
name: json['name'],
deadline: DateTime.parse(json['deadline']).toLocal(),
description: json['description'],
hasMentorAccess: json['has_mentor_access'],
createdAt: DateTime.parse(json['created_at']).toLocal(),
updatedAt: DateTime.parse(json['updated_at']).toLocal(),
status: json['status'],
currentUserProjectId: json['current_user_project_id'],
gradingScale: json['grading_scale'],
gradesFinalized: json['grades_finalized'],
restrictions: json['restrictions'],
);

AssignmentAttributes({
this.name,
this.deadline,
Expand All @@ -103,19 +115,4 @@ class AssignmentAttributes {
String gradingScale;
bool gradesFinalized;
String restrictions;

factory AssignmentAttributes.fromJson(Map<String, dynamic> json) =>
AssignmentAttributes(
name: json['name'],
deadline: DateTime.parse(json['deadline']).toLocal(),
description: json['description'],
hasMentorAccess: json['has_mentor_access'],
createdAt: DateTime.parse(json['created_at']).toLocal(),
updatedAt: DateTime.parse(json['updated_at']).toLocal(),
status: json['status'],
currentUserProjectId: json['current_user_project_id'],
gradingScale: json['grading_scale'],
gradesFinalized: json['grades_finalized'],
restrictions: json['restrictions'],
);
}
37 changes: 17 additions & 20 deletions lib/models/collaborators.dart
Original file line number Diff line number Diff line change
@@ -1,48 +1,45 @@
import 'package:mobile_app/models/links.dart';

class Collaborators {
factory Collaborators.fromJson(Map<String, dynamic> json) => Collaborators(
data: List<Collaborator>.from(
json['data'].map((x) => Collaborator.fromJson(x))),
links: Links.fromJson(json['links']),
);

Collaborators({
this.data,
this.links,
});

List<Collaborator> data;
Links links;

factory Collaborators.fromJson(Map<String, dynamic> json) => Collaborators(
data: List<Collaborator>.from(
json['data'].map((x) => Collaborator.fromJson(x))),
links: Links.fromJson(json['links']),
);
}

class Collaborator {
factory Collaborator.fromJson(Map<String, dynamic> json) => Collaborator(
id: json['id'],
type: json['type'],
attributes: CollaboratorAttributes.fromJson(json['attributes']),
);

Collaborator({
this.id,
this.type,
this.attributes,
});

String id;
String type;
CollaboratorAttributes attributes;

factory Collaborator.fromJson(Map<String, dynamic> json) => Collaborator(
id: json['id'],
type: json['type'],
attributes: CollaboratorAttributes.fromJson(json['attributes']),
);
}

class CollaboratorAttributes {
CollaboratorAttributes({
this.name,
});

String name;

factory CollaboratorAttributes.fromJson(Map<String, dynamic> json) =>
CollaboratorAttributes(
name: json['name'],
);

CollaboratorAttributes({
this.name,
});
String name;
}
83 changes: 41 additions & 42 deletions lib/models/cv_contributors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,6 @@ List<CircuitVerseContributor> circuitVerseContributorsFromJson(String str) =>
json.decode(str).map((x) => CircuitVerseContributor.fromJson(x)));

class CircuitVerseContributor {
String login;
int id;
String nodeId;
String avatarUrl;
String gravatarId;
String url;
String htmlUrl;
String followersUrl;
String followingUrl;
String gistsUrl;
String starredUrl;
String subscriptionsUrl;
String organizationsUrl;
String reposUrl;
String eventsUrl;
String receivedEventsUrl;
Type type;
bool siteAdmin;
int contributions;

CircuitVerseContributor({
this.login,
this.id,
this.nodeId,
this.avatarUrl,
this.gravatarId,
this.url,
this.htmlUrl,
this.followersUrl,
this.followingUrl,
this.gistsUrl,
this.starredUrl,
this.subscriptionsUrl,
this.organizationsUrl,
this.reposUrl,
this.eventsUrl,
this.receivedEventsUrl,
this.type,
this.siteAdmin,
this.contributions,
});

factory CircuitVerseContributor.fromJson(Map<String, dynamic> json) =>
CircuitVerseContributor(
login: json['login'],
Expand All @@ -71,6 +29,47 @@ class CircuitVerseContributor {
siteAdmin: json['site_admin'],
contributions: json['contributions'],
);
CircuitVerseContributor({
this.login,
this.id,
this.nodeId,
this.avatarUrl,
this.gravatarId,
this.url,
this.htmlUrl,
this.followersUrl,
this.followingUrl,
this.gistsUrl,
this.starredUrl,
this.subscriptionsUrl,
this.organizationsUrl,
this.reposUrl,
this.eventsUrl,
this.receivedEventsUrl,
this.type,
this.siteAdmin,
this.contributions,
});

String login;
int id;
String nodeId;
String avatarUrl;
String gravatarId;
String url;
String htmlUrl;
String followersUrl;
String followingUrl;
String gistsUrl;
String starredUrl;
String subscriptionsUrl;
String organizationsUrl;
String reposUrl;
String eventsUrl;
String receivedEventsUrl;
Type type;
bool siteAdmin;
int contributions;
}

enum Type { USER, BOT }
Expand Down
14 changes: 7 additions & 7 deletions lib/models/dialog_models.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import 'package:flutter/foundation.dart';

class DialogRequest {
final String title;
final String description;
final String buttonTitle;
final String cancelTitle;

DialogRequest({
@required this.title,
this.description,
this.buttonTitle,
this.cancelTitle,
});

final String title;
final String description;
final String buttonTitle;
final String cancelTitle;
}

class DialogResponse {
final bool confirmed;

DialogResponse({
this.confirmed,
});

final bool confirmed;
}
3 changes: 1 addition & 2 deletions lib/models/failure_model.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class Failure implements Exception {
final String message;

Failure(this.message);
final String message;

@override
String toString() => message;
Expand Down
Loading

0 comments on commit 051c308

Please sign in to comment.