From 051c308a627d9100786785535248e8f0a6b8bece Mon Sep 17 00:00:00 2001 From: Nishant Andoriya <56160262+M-A-D-A-R-A@users.noreply.github.com> Date: Mon, 22 Nov 2021 19:35:16 +0530 Subject: [PATCH] sort constructors first again (#171) * Fixed sort_constructors_first * Fixed sort_constructors_first again * formated files * Update analysis_options.yaml --- analysis_options.yaml | 3 - lib/models/add_collaborator_response.dart | 15 ++- lib/models/add_group_members_response.dart | 15 ++- lib/models/assignments.dart | 69 +++++------ lib/models/collaborators.dart | 37 +++--- lib/models/cv_contributors.dart | 83 ++++++------- lib/models/dialog_models.dart | 14 +-- lib/models/failure_model.dart | 3 +- lib/models/grade.dart | 58 ++++----- lib/models/group_members.dart | 47 ++++--- lib/models/groups.dart | 57 ++++----- lib/models/ib/ib_chapter.dart | 14 +-- lib/models/ib/ib_content.dart | 9 +- lib/models/ib/ib_page_data.dart | 13 +- lib/models/ib/ib_pop_quiz_question.dart | 8 +- lib/models/ib/ib_raw_page_data.dart | 70 +++++------ lib/models/links.dart | 17 ++- lib/models/projects.dart | 117 ++++++++---------- lib/models/user.dart | 51 ++++---- lib/ui/components/cv_add_icon_button.dart | 3 +- lib/ui/components/cv_drawer_tile.dart | 6 +- lib/ui/components/cv_header.dart | 8 +- lib/ui/components/cv_html_editor.dart | 8 +- lib/ui/components/cv_outline_button.dart | 10 +- lib/ui/components/cv_password_field.dart | 8 +- lib/ui/components/cv_primary_button.dart | 12 +- lib/ui/components/cv_social_card.dart | 10 +- lib/ui/components/cv_subheader.dart | 4 +- lib/ui/components/cv_tab_bar.dart | 4 +- lib/ui/components/cv_text_field.dart | 24 ++-- lib/ui/components/cv_typeahead_field.dart | 32 ++--- .../about/about_privacy_policy_view.dart | 6 +- lib/ui/views/about/about_tos_view.dart | 4 +- lib/ui/views/about/about_view.dart | 3 +- .../about/components/contributor_avatar.dart | 4 +- .../components/auth_options_view.dart | 4 +- .../authentication/forgot_password_view.dart | 3 +- lib/ui/views/authentication/login_view.dart | 4 +- lib/ui/views/authentication/signup_view.dart | 4 +- lib/ui/views/base_view.dart | 10 +- .../components/contributors_donate_card.dart | 8 +- .../components/contributors_support_card.dart | 8 +- .../views/contributors/contributors_view.dart | 4 +- lib/ui/views/cv_landing_view.dart | 3 +- lib/ui/views/groups/add_assignment_view.dart | 4 +- .../views/groups/assignment_details_view.dart | 4 +- .../groups/components/assignment_card.dart | 11 +- .../groups/components/group_card_button.dart | 7 +- .../groups/components/group_member_card.dart | 4 +- .../groups/components/group_mentor_card.dart | 6 +- .../views/groups/components/member_card.dart | 8 +- lib/ui/views/groups/edit_group_view.dart | 4 +- lib/ui/views/groups/group_details_view.dart | 4 +- lib/ui/views/groups/my_groups_view.dart | 4 +- lib/ui/views/groups/new_group_view.dart | 4 +- .../views/groups/update_assignment_view.dart | 4 +- .../views/home/components/feature_card.dart | 8 +- lib/ui/views/home/home_view.dart | 3 +- .../builders/ib_chapter_contents_builder.dart | 4 +- .../ib/builders/ib_headings_builder.dart | 4 +- .../ib/builders/ib_interaction_builder.dart | 4 +- .../ib/builders/ib_pop_quiz_builder.dart | 4 +- .../ib/builders/ib_subscript_builder.dart | 4 +- .../ib/builders/ib_superscript_builder.dart | 4 +- lib/ui/views/ib/components/ib_pop_quiz.dart | 4 +- .../ib/components/ib_pop_quiz_button.dart | 6 +- lib/ui/views/ib/ib_landing_view.dart | 4 +- lib/ui/views/ib/ib_page_view.dart | 10 +- .../ib/syntaxes/ib_inline_html_syntax.dart | 4 +- .../views/ib/syntaxes/ib_md_tag_syntax.dart | 3 +- lib/ui/views/profile/edit_profile_view.dart | 4 +- lib/ui/views/profile/profile_view.dart | 4 +- .../views/profile/user_favourites_view.dart | 4 +- lib/ui/views/profile/user_projects_view.dart | 4 +- .../components/featured_project_card.dart | 5 +- .../projects/components/project_card.dart | 8 +- lib/ui/views/projects/edit_project_view.dart | 4 +- .../projects/featured_projects_view.dart | 8 +- .../views/projects/project_details_view.dart | 4 +- .../project_preview_fullscreen_view.dart | 3 +- .../teachers/components/teachers_card.dart | 8 +- lib/ui/views/teachers/teachers_view.dart | 4 +- lib/utils/app_exceptions.dart | 4 +- lib/utils/enum_values.dart | 4 +- 84 files changed, 524 insertions(+), 568 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index cbf8de3c..d2b89b11 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -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 diff --git a/lib/models/add_collaborator_response.dart b/lib/models/add_collaborator_response.dart index ed98a612..14d9ab18 100644 --- a/lib/models/add_collaborator_response.dart +++ b/lib/models/add_collaborator_response.dart @@ -1,18 +1,17 @@ class AddCollaboratorsResponse { + factory AddCollaboratorsResponse.fromJson(Map json) => + AddCollaboratorsResponse( + added: List.from(json['added'].map((x) => x)), + existing: List.from(json['existing'].map((x) => x)), + invalid: List.from(json['invalid'].map((x) => x)), + ); + AddCollaboratorsResponse({ this.added, this.existing, this.invalid, }); - List added; List existing; List invalid; - - factory AddCollaboratorsResponse.fromJson(Map json) => - AddCollaboratorsResponse( - added: List.from(json['added'].map((x) => x)), - existing: List.from(json['existing'].map((x) => x)), - invalid: List.from(json['invalid'].map((x) => x)), - ); } diff --git a/lib/models/add_group_members_response.dart b/lib/models/add_group_members_response.dart index b4d7b21f..d96cda4f 100644 --- a/lib/models/add_group_members_response.dart +++ b/lib/models/add_group_members_response.dart @@ -1,18 +1,17 @@ class AddGroupMembersResponse { + factory AddGroupMembersResponse.fromJson(Map json) => + AddGroupMembersResponse( + added: List.from(json['added'].map((x) => x)), + pending: List.from(json['pending'].map((x) => x)), + invalid: List.from(json['invalid'].map((x) => x)), + ); + AddGroupMembersResponse({ this.added, this.pending, this.invalid, }); - List added; List pending; List invalid; - - factory AddGroupMembersResponse.fromJson(Map json) => - AddGroupMembersResponse( - added: List.from(json['added'].map((x) => x)), - pending: List.from(json['pending'].map((x) => x)), - invalid: List.from(json['invalid'].map((x) => x)), - ); } diff --git a/lib/models/assignments.dart b/lib/models/assignments.dart index ceb58405..e3e851e8 100644 --- a/lib/models/assignments.dart +++ b/lib/models/assignments.dart @@ -3,6 +3,12 @@ import 'package:mobile_app/models/links.dart'; import 'package:mobile_app/models/projects.dart'; class Assignments { + factory Assignments.fromJson(Map json) => Assignments( + data: List.from( + json['data'].map((x) => Assignment.fromJson(x)), + ), + links: Links.fromJson(json['links']), + ); Assignments({ this.data, this.links, @@ -10,30 +16,9 @@ class Assignments { List data; Links links; - - factory Assignments.fromJson(Map json) => Assignments( - data: List.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 projects; - List grades; - factory Assignment.fromJson(Map json) => Assignment( id: json['id'] ?? json['data']['id'], type: json['type'] ?? json['data']['type'], @@ -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 projects; + List grades; bool get canBeGraded => attributes.gradingScale != 'no_scale' && @@ -78,6 +75,21 @@ class Assignment { } class AssignmentAttributes { + factory AssignmentAttributes.fromJson(Map 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, @@ -103,19 +115,4 @@ class AssignmentAttributes { String gradingScale; bool gradesFinalized; String restrictions; - - factory AssignmentAttributes.fromJson(Map 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'], - ); } diff --git a/lib/models/collaborators.dart b/lib/models/collaborators.dart index bf9240af..d66765b9 100644 --- a/lib/models/collaborators.dart +++ b/lib/models/collaborators.dart @@ -1,48 +1,45 @@ import 'package:mobile_app/models/links.dart'; class Collaborators { + factory Collaborators.fromJson(Map json) => Collaborators( + data: List.from( + json['data'].map((x) => Collaborator.fromJson(x))), + links: Links.fromJson(json['links']), + ); + Collaborators({ this.data, this.links, }); - List data; Links links; - - factory Collaborators.fromJson(Map json) => Collaborators( - data: List.from( - json['data'].map((x) => Collaborator.fromJson(x))), - links: Links.fromJson(json['links']), - ); } class Collaborator { + factory Collaborator.fromJson(Map 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 json) => Collaborator( - id: json['id'], - type: json['type'], - attributes: CollaboratorAttributes.fromJson(json['attributes']), - ); } class CollaboratorAttributes { - CollaboratorAttributes({ - this.name, - }); - - String name; - factory CollaboratorAttributes.fromJson(Map json) => CollaboratorAttributes( name: json['name'], ); + + CollaboratorAttributes({ + this.name, + }); + String name; } diff --git a/lib/models/cv_contributors.dart b/lib/models/cv_contributors.dart index 38a55682..dbbc6f5f 100644 --- a/lib/models/cv_contributors.dart +++ b/lib/models/cv_contributors.dart @@ -7,48 +7,6 @@ List 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 json) => CircuitVerseContributor( login: json['login'], @@ -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 } diff --git a/lib/models/dialog_models.dart b/lib/models/dialog_models.dart index 4e05f6e2..fa3dd8ac 100644 --- a/lib/models/dialog_models.dart +++ b/lib/models/dialog_models.dart @@ -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; } diff --git a/lib/models/failure_model.dart b/lib/models/failure_model.dart index f1f3576a..43c9101f 100644 --- a/lib/models/failure_model.dart +++ b/lib/models/failure_model.dart @@ -1,7 +1,6 @@ class Failure implements Exception { - final String message; - Failure(this.message); + final String message; @override String toString() => message; diff --git a/lib/models/grade.dart b/lib/models/grade.dart index cb98d3a3..73842384 100644 --- a/lib/models/grade.dart +++ b/lib/models/grade.dart @@ -5,21 +5,27 @@ class Grade { this.attributes, this.relationships, }); - - String id; - String type; - GradeAttributes attributes; - GradeRelationships relationships; - factory Grade.fromJson(Map json) => Grade( id: json['id'], type: json['type'], attributes: GradeAttributes.fromJson(json['attributes']), relationships: GradeRelationships.fromJson(json['relationships']), ); + + String id; + String type; + GradeAttributes attributes; + GradeRelationships relationships; } class GradeAttributes { + factory GradeAttributes.fromJson(Map json) => + GradeAttributes( + grade: json['grade'], + remarks: json['remarks'], + createdAt: DateTime.parse(json['created_at']), + updatedAt: DateTime.parse(json['updated_at']), + ); GradeAttributes({ this.grade, this.remarks, @@ -31,53 +37,41 @@ class GradeAttributes { dynamic remarks; DateTime createdAt; DateTime updatedAt; - - factory GradeAttributes.fromJson(Map json) => - GradeAttributes( - grade: json['grade'], - remarks: json['remarks'], - createdAt: DateTime.parse(json['created_at']), - updatedAt: DateTime.parse(json['updated_at']), - ); } class GradeRelationships { - GradeRelationships({ - this.project, - }); - - GradedProject project; - factory GradeRelationships.fromJson(Map json) => GradeRelationships( project: GradedProject.fromJson(json['project']), ); + + GradeRelationships({ + this.project, + }); + GradedProject project; } class GradedProject { + factory GradedProject.fromJson(Map json) => GradedProject( + data: GradedProjectData.fromJson(json['data']), + ); GradedProject({ this.data, }); - GradedProjectData data; - - factory GradedProject.fromJson(Map json) => GradedProject( - data: GradedProjectData.fromJson(json['data']), - ); } class GradedProjectData { + factory GradedProjectData.fromJson(Map json) => + GradedProjectData( + id: json['id'], + type: json['type'], + ); + GradedProjectData({ this.id, this.type, }); - String id; String type; - - factory GradedProjectData.fromJson(Map json) => - GradedProjectData( - id: json['id'], - type: json['type'], - ); } diff --git a/lib/models/group_members.dart b/lib/models/group_members.dart index c550ae9f..779d04e2 100644 --- a/lib/models/group_members.dart +++ b/lib/models/group_members.dart @@ -1,40 +1,48 @@ import 'package:mobile_app/models/links.dart'; class GroupMembers { + factory GroupMembers.fromJson(Map json) => GroupMembers( + data: List.from( + json['data'].map((x) => GroupMember.fromJson(x))), + links: Links.fromJson(json['links']), + ); + GroupMembers({ this.data, this.links, }); - List data; Links links; - - factory GroupMembers.fromJson(Map json) => GroupMembers( - data: List.from( - json['data'].map((x) => GroupMember.fromJson(x))), - links: Links.fromJson(json['links']), - ); } class GroupMember { + factory GroupMember.fromJson(Map json) => GroupMember( + id: json['id'], + type: json['type'], + attributes: GroupMemberAttributes.fromJson(json['attributes']), + ); + GroupMember({ this.id, this.type, this.attributes, }); - String id; String type; GroupMemberAttributes attributes; - - factory GroupMember.fromJson(Map json) => GroupMember( - id: json['id'], - type: json['type'], - attributes: GroupMemberAttributes.fromJson(json['attributes']), - ); } class GroupMemberAttributes { + factory GroupMemberAttributes.fromJson(Map json) => + GroupMemberAttributes( + groupId: json['group_id'], + userId: json['user_id'], + createdAt: DateTime.parse(json['created_at']), + updatedAt: DateTime.parse(json['updated_at']), + name: json['name'], + email: json['email'], + ); + GroupMemberAttributes({ this.groupId, this.userId, @@ -43,21 +51,10 @@ class GroupMemberAttributes { this.name, this.email, }); - int groupId; int userId; DateTime createdAt; DateTime updatedAt; String name; String email; - - factory GroupMemberAttributes.fromJson(Map json) => - GroupMemberAttributes( - groupId: json['group_id'], - userId: json['user_id'], - createdAt: DateTime.parse(json['created_at']), - updatedAt: DateTime.parse(json['updated_at']), - name: json['name'], - email: json['email'], - ); } diff --git a/lib/models/groups.dart b/lib/models/groups.dart index cc36e832..6021b246 100644 --- a/lib/models/groups.dart +++ b/lib/models/groups.dart @@ -5,35 +5,19 @@ import 'package:mobile_app/models/links.dart'; import 'package:mobile_app/services/local_storage_service.dart'; class Groups { + factory Groups.fromJson(Map json) => Groups( + data: List.from(json['data'].map((x) => Group.fromJson(x))), + links: Links.fromJson(json['links']), + ); Groups({ this.data, this.links, }); - List data; Links links; - - factory Groups.fromJson(Map json) => Groups( - data: List.from(json['data'].map((x) => Group.fromJson(x))), - links: Links.fromJson(json['links']), - ); } class Group { - Group({ - this.id, - this.type, - this.attributes, - this.groupMembers, - this.assignments, - }); - - String id; - String type; - GroupAttributes attributes; - List groupMembers; - List assignments; - factory Group.fromJson(Map json) => Group( id: json['id'] ?? json['data']['id'], type: json['type'] ?? json['data']['type'], @@ -54,6 +38,18 @@ class Group { ) : null, ); + Group({ + this.id, + this.type, + this.attributes, + this.groupMembers, + this.assignments, + }); + String id; + String type; + GroupAttributes attributes; + List groupMembers; + List assignments; // returns true if the logged in user is mentor for this group bool get isMentor => locator().currentUser.data.id == @@ -63,6 +59,16 @@ class Group { } class GroupAttributes { + factory GroupAttributes.fromJson(Map json) => + GroupAttributes( + memberCount: json['member_count'], + mentorName: json['mentor_name'], + name: json['name'], + mentorId: json['mentor_id'], + createdAt: DateTime.parse(json['created_at']), + updatedAt: DateTime.parse(json['updated_at']), + ); + GroupAttributes({ this.memberCount, this.mentorName, @@ -71,21 +77,10 @@ class GroupAttributes { this.createdAt, this.updatedAt, }); - int memberCount; String mentorName; String name; int mentorId; DateTime createdAt; DateTime updatedAt; - - factory GroupAttributes.fromJson(Map json) => - GroupAttributes( - memberCount: json['member_count'], - mentorName: json['mentor_name'], - name: json['name'], - mentorId: json['mentor_id'], - createdAt: DateTime.parse(json['created_at']), - updatedAt: DateTime.parse(json['updated_at']), - ); } diff --git a/lib/models/ib/ib_chapter.dart b/lib/models/ib/ib_chapter.dart index 97d22cd9..91c24489 100644 --- a/lib/models/ib/ib_chapter.dart +++ b/lib/models/ib/ib_chapter.dart @@ -1,13 +1,6 @@ import 'package:flutter/material.dart'; class IbChapter { - final String id; - final String value; - final String navOrder; - IbChapter prev; - IbChapter next; - final List items; - IbChapter({ @required this.id, @required this.value, @@ -17,6 +10,13 @@ class IbChapter { this.items, }); + final String id; + final String value; + final String navOrder; + IbChapter prev; + IbChapter next; + final List items; + set prevPage(IbChapter prev) => this.prev = prev; set nextPage(IbChapter next) => this.next = next; diff --git a/lib/models/ib/ib_content.dart b/lib/models/ib/ib_content.dart index 3e672dd8..e76df249 100644 --- a/lib/models/ib/ib_content.dart +++ b/lib/models/ib/ib_content.dart @@ -1,17 +1,16 @@ import 'package:flutter/material.dart'; abstract class IbContent { - String content; - IbContent({@required this.content}); + String content; } class IbTocItem extends IbContent { - final String leading; - final List items; - IbTocItem({this.leading, @required String content, this.items}) : super(content: content); + + final String leading; + final List items; } class IbMd extends IbContent { diff --git a/lib/models/ib/ib_page_data.dart b/lib/models/ib/ib_page_data.dart index e0ad9897..edc38583 100644 --- a/lib/models/ib/ib_page_data.dart +++ b/lib/models/ib/ib_page_data.dart @@ -2,13 +2,6 @@ import 'package:flutter/material.dart'; import 'package:mobile_app/models/ib/ib_content.dart'; class IbPageData { - final String id; - final String pageUrl; - final String title; - final List content; - final List tableOfContents; - final List chapterOfContents; - IbPageData({ @required this.id, @required this.pageUrl, @@ -17,4 +10,10 @@ class IbPageData { this.tableOfContents, this.chapterOfContents, }); + final String id; + final String pageUrl; + final String title; + final List content; + final List tableOfContents; + final List chapterOfContents; } diff --git a/lib/models/ib/ib_pop_quiz_question.dart b/lib/models/ib/ib_pop_quiz_question.dart index 85c19dae..4ca900d2 100644 --- a/lib/models/ib/ib_pop_quiz_question.dart +++ b/lib/models/ib/ib_pop_quiz_question.dart @@ -1,13 +1,13 @@ import 'package:flutter/cupertino.dart'; class IbPopQuizQuestion { - final String question; - List answers; - List choices; - IbPopQuizQuestion({ @required this.question, @required this.answers, @required this.choices, }); + + final String question; + List answers; + List choices; } diff --git a/lib/models/ib/ib_raw_page_data.dart b/lib/models/ib/ib_raw_page_data.dart index 6f215bb5..dee9eb9f 100644 --- a/lib/models/ib/ib_raw_page_data.dart +++ b/lib/models/ib/ib_raw_page_data.dart @@ -4,6 +4,41 @@ part 'ib_raw_page_data.g.dart'; @HiveType(typeId: 0) class IbRawPageData { + factory IbRawPageData.fromJson(Map json) => IbRawPageData( + id: json['path'] ?? json['relative_path'], + name: json['name'], + title: json['title'], + content: json['content'], + rawContent: json['raw_content'], + navOrder: json['nav_order'].toString(), + cvibLevel: json['cvib_level'], + parent: json['parent'], + hasChildren: json['has_children'] ?? false, + hasToc: json['has_toc'] ?? (json['name'] == 'index.md' ? false : true), + disableComments: json['disable_comments'] ?? + (json['name'] == 'index.md' ? true : false), + frontMatter: json['front_matter'] ?? {}, + httpUrl: json['http_url'], + apiUrl: json['api_url'], + ); + + IbRawPageData({ + this.id, + this.title, + this.name, + this.content, + this.rawContent, + this.navOrder, + this.cvibLevel, + this.parent, + this.hasChildren, + this.hasToc, + this.disableComments, + this.frontMatter, + this.httpUrl, + this.apiUrl, + }); + @HiveField(0) String id; @@ -45,39 +80,4 @@ class IbRawPageData { @HiveField(13) String apiUrl; - - IbRawPageData({ - this.id, - this.title, - this.name, - this.content, - this.rawContent, - this.navOrder, - this.cvibLevel, - this.parent, - this.hasChildren, - this.hasToc, - this.disableComments, - this.frontMatter, - this.httpUrl, - this.apiUrl, - }); - - factory IbRawPageData.fromJson(Map json) => IbRawPageData( - id: json['path'] ?? json['relative_path'], - name: json['name'], - title: json['title'], - content: json['content'], - rawContent: json['raw_content'], - navOrder: json['nav_order'].toString(), - cvibLevel: json['cvib_level'], - parent: json['parent'], - hasChildren: json['has_children'] ?? false, - hasToc: json['has_toc'] ?? (json['name'] == 'index.md' ? false : true), - disableComments: json['disable_comments'] ?? - (json['name'] == 'index.md' ? true : false), - frontMatter: json['front_matter'] ?? {}, - httpUrl: json['http_url'], - apiUrl: json['api_url'], - ); } diff --git a/lib/models/links.dart b/lib/models/links.dart index 718608f3..f652912e 100644 --- a/lib/models/links.dart +++ b/lib/models/links.dart @@ -1,4 +1,12 @@ class Links { + factory Links.fromJson(Map json) => Links( + self: json['self'], + first: json['first'], + prev: json['prev'], + next: json['next'], + last: json['last'], + ); + Links({ this.self, this.first, @@ -6,18 +14,9 @@ class Links { this.next, this.last, }); - String self; String first; dynamic prev; dynamic next; String last; - - factory Links.fromJson(Map json) => Links( - self: json['self'], - first: json['first'], - prev: json['prev'], - next: json['next'], - last: json['last'], - ); } diff --git a/lib/models/projects.dart b/lib/models/projects.dart index 581f571c..03b59f10 100644 --- a/lib/models/projects.dart +++ b/lib/models/projects.dart @@ -4,35 +4,20 @@ import 'package:mobile_app/models/links.dart'; import 'package:mobile_app/services/local_storage_service.dart'; class Projects { + factory Projects.fromJson(Map json) => Projects( + data: List.from(json['data'].map((x) => Project.fromJson(x))), + links: Links.fromJson(json['links']), + ); + Projects({ this.data, this.links, }); - List data; Links links; - - factory Projects.fromJson(Map json) => Projects( - data: List.from(json['data'].map((x) => Project.fromJson(x))), - links: Links.fromJson(json['links']), - ); } class Project { - Project({ - this.id, - this.type, - this.attributes, - this.relationships, - this.collaborators, - }); - - String id; - String type; - ProjectAttributes attributes; - ProjectRelationships relationships; - List collaborators; - factory Project.fromJson(Map json) => Project( id: json['id'] ?? json['data']['id'], type: json['type'] ?? json['data']['type'], @@ -48,6 +33,18 @@ class Project { ) : null, ); + Project({ + this.id, + this.type, + this.attributes, + this.relationships, + this.collaborators, + }); + String id; + String type; + ProjectAttributes attributes; + ProjectRelationships relationships; + List collaborators; bool get hasAuthorAccess { var currentUser = locator().currentUser; @@ -61,6 +58,20 @@ class Project { } class ProjectAttributes { + factory ProjectAttributes.fromJson(Map json) => + ProjectAttributes( + name: json['name'], + projectAccessType: json['project_access_type'], + createdAt: DateTime.parse(json['created_at']), + updatedAt: DateTime.parse(json['updated_at']), + imagePreview: ImagePreview.fromJson(json['image_preview']), + description: json['description'], + view: json['view'], + tags: List.from(json['tags'].map((x) => Tag.fromJson(x))), + isStarred: json['is_starred'], + authorName: json['author_name'], + starsCount: json['stars_count'], + ); ProjectAttributes({ this.name, this.projectAccessType, @@ -86,92 +97,72 @@ class ProjectAttributes { bool isStarred; String authorName; int starsCount; - - factory ProjectAttributes.fromJson(Map json) => - ProjectAttributes( - name: json['name'], - projectAccessType: json['project_access_type'], - createdAt: DateTime.parse(json['created_at']), - updatedAt: DateTime.parse(json['updated_at']), - imagePreview: ImagePreview.fromJson(json['image_preview']), - description: json['description'], - view: json['view'], - tags: List.from(json['tags'].map((x) => Tag.fromJson(x))), - isStarred: json['is_starred'], - authorName: json['author_name'], - starsCount: json['stars_count'], - ); } class ImagePreview { + factory ImagePreview.fromJson(Map json) => ImagePreview( + url: json['url'], + ); ImagePreview({ this.url, }); String url; - - factory ImagePreview.fromJson(Map json) => ImagePreview( - url: json['url'], - ); } class ProjectRelationships { - ProjectRelationships({ - this.author, - }); - - Author author; - factory ProjectRelationships.fromJson(Map json) => ProjectRelationships( author: Author.fromJson(json['author']), ); + + ProjectRelationships({ + this.author, + }); + Author author; } class Author { + factory Author.fromJson(Map json) => Author( + data: AuthorData.fromJson(json['data']), + ); + Author({ this.data, }); - AuthorData data; - - factory Author.fromJson(Map json) => Author( - data: AuthorData.fromJson(json['data']), - ); } class AuthorData { + factory AuthorData.fromJson(Map json) => AuthorData( + id: json['id'], + type: json['type'], + ); + AuthorData({ this.id, this.type, }); - String id; String type; +} - factory AuthorData.fromJson(Map json) => AuthorData( +class Tag { + factory Tag.fromJson(Map json) => Tag( id: json['id'], - type: json['type'], + name: json['name'], + createdAt: DateTime.parse(json['created_at']), + updatedAt: DateTime.parse(json['updated_at']), ); -} -class Tag { Tag({ this.id, this.name, this.createdAt, this.updatedAt, }); - int id; String name; DateTime createdAt; DateTime updatedAt; - - factory Tag.fromJson(Map json) => Tag( - id: json['id'], - name: json['name'], - createdAt: DateTime.parse(json['created_at']), - updatedAt: DateTime.parse(json['updated_at']), - ); } diff --git a/lib/models/user.dart b/lib/models/user.dart index 90b499ca..376fa5c8 100644 --- a/lib/models/user.dart +++ b/lib/models/user.dart @@ -1,34 +1,32 @@ class User { - User({this.data}); - - Data data; - factory User.fromJson(Map json) => User( data: Data.fromJson(json['data']), ); + User({this.data}); + Data data; + Map toJson() => { 'data': data.toJson(), }; } class Data { + factory Data.fromJson(Map json) => Data( + id: json['id'], + type: json['type'], + attributes: UserAttributes.fromJson(json['attributes']), + ); + Data({ this.id, this.type, this.attributes, }); - String id; String type; UserAttributes attributes; - factory Data.fromJson(Map json) => Data( - id: json['id'], - type: json['type'], - attributes: UserAttributes.fromJson(json['attributes']), - ); - Map toJson() => { 'id': id, 'type': type, @@ -37,6 +35,21 @@ class Data { } class UserAttributes { + factory UserAttributes.fromJson(Map json) => UserAttributes( + name: json['name'], + email: json['email'], + subscribed: json['subscribed'] ?? false, + createdAt: json['created_at'] != null + ? DateTime.parse(json['created_at']) + : null, + updatedAt: json['updated_at'] != null + ? DateTime.parse(json['updated_at']) + : null, + admin: json['admin'], + country: json['country'], + educationalInstitute: json['educational_institute'], + ); + UserAttributes({ this.name, this.email, @@ -47,7 +60,6 @@ class UserAttributes { this.country, this.educationalInstitute, }); - String name; String email; bool subscribed; @@ -57,21 +69,6 @@ class UserAttributes { dynamic country; dynamic educationalInstitute; - factory UserAttributes.fromJson(Map json) => UserAttributes( - name: json['name'], - email: json['email'], - subscribed: json['subscribed'] ?? false, - createdAt: json['created_at'] != null - ? DateTime.parse(json['created_at']) - : null, - updatedAt: json['updated_at'] != null - ? DateTime.parse(json['updated_at']) - : null, - admin: json['admin'], - country: json['country'], - educationalInstitute: json['educational_institute'], - ); - Map toJson() => { 'name': name, 'email': email, diff --git a/lib/ui/components/cv_add_icon_button.dart b/lib/ui/components/cv_add_icon_button.dart index 01c28b4a..2d449996 100644 --- a/lib/ui/components/cv_add_icon_button.dart +++ b/lib/ui/components/cv_add_icon_button.dart @@ -2,9 +2,8 @@ import 'package:flutter/material.dart'; import 'package:mobile_app/cv_theme.dart'; class CVAddIconButton extends StatelessWidget { - final VoidCallback onPressed; - const CVAddIconButton({Key key, this.onPressed}) : super(key: key); + final VoidCallback onPressed; @override Widget build(BuildContext context) { diff --git a/lib/ui/components/cv_drawer_tile.dart b/lib/ui/components/cv_drawer_tile.dart index 5c81e07f..94367f70 100644 --- a/lib/ui/components/cv_drawer_tile.dart +++ b/lib/ui/components/cv_drawer_tile.dart @@ -2,13 +2,13 @@ import 'package:flutter/material.dart'; import 'package:mobile_app/cv_theme.dart'; class CVDrawerTile extends StatelessWidget { + const CVDrawerTile({Key key, @required this.title, this.iconData, this.color}) + : super(key: key); + final String title; final IconData iconData; final Color color; - const CVDrawerTile({Key key, @required this.title, this.iconData, this.color}) - : super(key: key); - @override Widget build(BuildContext context) { return Theme( diff --git a/lib/ui/components/cv_header.dart b/lib/ui/components/cv_header.dart index 190a2048..1d1509ca 100644 --- a/lib/ui/components/cv_header.dart +++ b/lib/ui/components/cv_header.dart @@ -2,14 +2,14 @@ import 'package:flutter/material.dart'; import 'package:mobile_app/cv_theme.dart'; class CVHeader extends StatelessWidget { - final String title; - final String subtitle; - final String description; - const CVHeader( {Key key, @required this.title, this.subtitle, this.description}) : super(key: key); + final String title; + final String subtitle; + final String description; + @override Widget build(BuildContext context) { return Column( diff --git a/lib/ui/components/cv_html_editor.dart b/lib/ui/components/cv_html_editor.dart index 5c9cd127..531d4893 100644 --- a/lib/ui/components/cv_html_editor.dart +++ b/lib/ui/components/cv_html_editor.dart @@ -3,10 +3,6 @@ import 'package:flutter_summernote/flutter_summernote.dart'; import 'package:mobile_app/cv_theme.dart'; class CVHtmlEditor extends StatelessWidget { - final GlobalKey editorKey; - final double height; - final bool hasAttachment; - const CVHtmlEditor({ Key key, @required this.editorKey, @@ -14,6 +10,10 @@ class CVHtmlEditor extends StatelessWidget { this.height = 300, }) : super(key: key); + final GlobalKey editorKey; + final double height; + final bool hasAttachment; + @override Widget build(BuildContext context) { return FlutterSummernote( diff --git a/lib/ui/components/cv_outline_button.dart b/lib/ui/components/cv_outline_button.dart index 155b6a6e..a4abdb1a 100644 --- a/lib/ui/components/cv_outline_button.dart +++ b/lib/ui/components/cv_outline_button.dart @@ -2,11 +2,6 @@ import 'package:flutter/material.dart'; import 'package:mobile_app/cv_theme.dart'; class CVOutlineButton extends StatelessWidget { - final String title; - final VoidCallback onPressed; - final bool isBodyText; - final bool isPrimaryDark; - const CVOutlineButton({ Key key, @required this.title, @@ -15,6 +10,11 @@ class CVOutlineButton extends StatelessWidget { this.isPrimaryDark = false, }) : super(key: key); + final String title; + final VoidCallback onPressed; + final bool isBodyText; + final bool isPrimaryDark; + @override Widget build(BuildContext context) { return OutlinedButton( diff --git a/lib/ui/components/cv_password_field.dart b/lib/ui/components/cv_password_field.dart index ac969870..38184f97 100644 --- a/lib/ui/components/cv_password_field.dart +++ b/lib/ui/components/cv_password_field.dart @@ -3,10 +3,6 @@ import 'package:flutter/services.dart'; import 'package:mobile_app/cv_theme.dart'; class CVPasswordField extends StatefulWidget { - final Function(String) validator; - final Function(String) onSaved; - final FocusNode focusNode; - const CVPasswordField({ Key key, this.validator, @@ -14,6 +10,10 @@ class CVPasswordField extends StatefulWidget { this.focusNode, }) : super(key: key); + final Function(String) validator; + final Function(String) onSaved; + final FocusNode focusNode; + @override _CVPasswordFieldState createState() => _CVPasswordFieldState(); } diff --git a/lib/ui/components/cv_primary_button.dart b/lib/ui/components/cv_primary_button.dart index 1a10b8d6..f5538b57 100644 --- a/lib/ui/components/cv_primary_button.dart +++ b/lib/ui/components/cv_primary_button.dart @@ -2,12 +2,6 @@ import 'package:flutter/material.dart'; import 'package:mobile_app/cv_theme.dart'; class CVPrimaryButton extends StatelessWidget { - final String title; - final VoidCallback onPressed; - final bool isBodyText; - final bool isPrimaryDark; - final EdgeInsetsGeometry padding; - const CVPrimaryButton({ Key key, @required this.title, @@ -17,6 +11,12 @@ class CVPrimaryButton extends StatelessWidget { this.padding = const EdgeInsets.all(8), }) : super(key: key); + final String title; + final VoidCallback onPressed; + final bool isBodyText; + final bool isPrimaryDark; + final EdgeInsetsGeometry padding; + @override Widget build(BuildContext context) { return ElevatedButton( diff --git a/lib/ui/components/cv_social_card.dart b/lib/ui/components/cv_social_card.dart index 2d287622..86e23c10 100644 --- a/lib/ui/components/cv_social_card.dart +++ b/lib/ui/components/cv_social_card.dart @@ -3,11 +3,6 @@ import 'package:mobile_app/cv_theme.dart'; import 'package:mobile_app/utils/url_launcher.dart'; class CircuitVerseSocialCard extends StatelessWidget { - final String imagePath; - final String title; - final String description; - final String url; - const CircuitVerseSocialCard({ Key key, this.imagePath, @@ -16,6 +11,11 @@ class CircuitVerseSocialCard extends StatelessWidget { this.url, }) : super(key: key); + final String imagePath; + final String title; + final String description; + final String url; + @override Widget build(BuildContext context) { return GestureDetector( diff --git a/lib/ui/components/cv_subheader.dart b/lib/ui/components/cv_subheader.dart index 1caa78d9..68d62928 100644 --- a/lib/ui/components/cv_subheader.dart +++ b/lib/ui/components/cv_subheader.dart @@ -2,11 +2,11 @@ import 'package:flutter/material.dart'; import 'package:mobile_app/cv_theme.dart'; class CVSubheader extends StatelessWidget { + const CVSubheader({Key key, this.title, this.subtitle}) : super(key: key); + final String title; final String subtitle; - const CVSubheader({Key key, this.title, this.subtitle}) : super(key: key); - @override Widget build(BuildContext context) { return Column( diff --git a/lib/ui/components/cv_tab_bar.dart b/lib/ui/components/cv_tab_bar.dart index db643ea6..53929364 100644 --- a/lib/ui/components/cv_tab_bar.dart +++ b/lib/ui/components/cv_tab_bar.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; class CVTabBar extends StatelessWidget implements PreferredSizeWidget { + const CVTabBar({Key key, this.color, this.tabBar}) : super(key: key); + final Color color; final TabBar tabBar; - const CVTabBar({Key key, this.color, this.tabBar}) : super(key: key); - @override Size get preferredSize => tabBar.preferredSize; diff --git a/lib/ui/components/cv_text_field.dart b/lib/ui/components/cv_text_field.dart index 0b0b78d1..f18a5b70 100644 --- a/lib/ui/components/cv_text_field.dart +++ b/lib/ui/components/cv_text_field.dart @@ -2,18 +2,6 @@ import 'package:flutter/material.dart'; import 'package:mobile_app/cv_theme.dart'; class CVTextField extends StatelessWidget { - final String label; - final TextEditingController controller; - final TextInputType type; - final TextInputAction action; - final int maxLines; - final String initialValue; - final Function(String) validator; - final Function(String) onSaved; - final Function(String) onFieldSubmitted; - final EdgeInsets padding; - final FocusNode focusNode; - /// Creates a [TextField] that is specifically styled for CircuitVerse. /// /// When a [TextInputType] is not specified, it defaults to [TextInputType.text] @@ -37,6 +25,18 @@ class CVTextField extends StatelessWidget { this.onFieldSubmitted, }) : super(key: key); + final String label; + final TextEditingController controller; + final TextInputType type; + final TextInputAction action; + final int maxLines; + final String initialValue; + final Function(String) validator; + final Function(String) onSaved; + final Function(String) onFieldSubmitted; + final EdgeInsets padding; + final FocusNode focusNode; + @override Widget build(BuildContext context) { return Padding( diff --git a/lib/ui/components/cv_typeahead_field.dart b/lib/ui/components/cv_typeahead_field.dart index 07491138..2150fae5 100644 --- a/lib/ui/components/cv_typeahead_field.dart +++ b/lib/ui/components/cv_typeahead_field.dart @@ -4,22 +4,6 @@ import 'package:flutter_typeahead/flutter_typeahead.dart'; import 'package:mobile_app/services/API/country_institute_api.dart'; class CVTypeAheadField extends StatelessWidget { - final String label; - final TextEditingController controller; - final TextInputType type; - final TextInputAction action; - final int maxLines; - final Function(String) validator; - final Function(String) onSaved; - final Function onFieldSubmitted; - final EdgeInsets padding; - final FocusNode focusNode; - final CountryInstituteAPI countryInstituteObject; - final String toggle; - - static const String COUNTRY = 'country'; - static const String EDUCATIONAL_INSTITUTE = 'educational institute'; - /// Creates a [TextField] that is specifically styled for CircuitVerse. /// /// When a [TextInputType] is not specified, it defaults to [TextInputType.text] @@ -44,6 +28,22 @@ class CVTypeAheadField extends StatelessWidget { this.toggle, }) : super(key: key); + final String label; + final TextEditingController controller; + final TextInputType type; + final TextInputAction action; + final int maxLines; + final Function(String) validator; + final Function(String) onSaved; + final Function onFieldSubmitted; + final EdgeInsets padding; + final FocusNode focusNode; + final CountryInstituteAPI countryInstituteObject; + final String toggle; + + static const String COUNTRY = 'country'; + static const String EDUCATIONAL_INSTITUTE = 'educational institute'; + @override Widget build(BuildContext context) { String text; diff --git a/lib/ui/views/about/about_privacy_policy_view.dart b/lib/ui/views/about/about_privacy_policy_view.dart index 3ad6e578..4ab9ae88 100644 --- a/lib/ui/views/about/about_privacy_policy_view.dart +++ b/lib/ui/views/about/about_privacy_policy_view.dart @@ -5,13 +5,13 @@ import 'package:url_launcher/url_launcher.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class AboutPrivacyPolicyView extends StatelessWidget { + const AboutPrivacyPolicyView({Key key, this.showAppBar = true}) + : super(key: key); + static const String id = 'about_privacy_policy_view'; final bool showAppBar; - const AboutPrivacyPolicyView({Key key, this.showAppBar = true}) - : super(key: key); - TextSpan _buildText(BuildContext context, String text, {bool bold = false, bool italic = false}) { return TextSpan( diff --git a/lib/ui/views/about/about_tos_view.dart b/lib/ui/views/about/about_tos_view.dart index b0a230aa..3dc7200d 100644 --- a/lib/ui/views/about/about_tos_view.dart +++ b/lib/ui/views/about/about_tos_view.dart @@ -7,12 +7,12 @@ import 'package:mobile_app/cv_theme.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class AboutTosView extends StatelessWidget { + const AboutTosView({Key key, this.showAppBar = true}) : super(key: key); + static const String id = 'about_tos_view'; final bool showAppBar; - const AboutTosView({Key key, this.showAppBar = true}) : super(key: key); - TextSpan _buildText(BuildContext context, String text, {bool bold = false}) { return TextSpan( style: Theme.of(context).textTheme.bodyText1.copyWith( diff --git a/lib/ui/views/about/about_view.dart b/lib/ui/views/about/about_view.dart index c1162769..dfc0d3c8 100644 --- a/lib/ui/views/about/about_view.dart +++ b/lib/ui/views/about/about_view.dart @@ -14,9 +14,8 @@ import 'package:mobile_app/viewmodels/about/about_viewmodel.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class AboutView extends StatefulWidget { - static const String id = 'about_view'; - const AboutView({Key key}) : super(key: key); + static const String id = 'about_view'; @override _AboutViewState createState() => _AboutViewState(); diff --git a/lib/ui/views/about/components/contributor_avatar.dart b/lib/ui/views/about/components/contributor_avatar.dart index 6db92019..ef48e023 100644 --- a/lib/ui/views/about/components/contributor_avatar.dart +++ b/lib/ui/views/about/components/contributor_avatar.dart @@ -5,11 +5,11 @@ import 'package:mobile_app/utils/url_launcher.dart'; import 'package:transparent_image/transparent_image.dart'; class ContributorAvatar extends StatelessWidget { - final CircuitVerseContributor contributor; - const ContributorAvatar({Key key, @required this.contributor}) : super(key: key); + final CircuitVerseContributor contributor; + @override Widget build(BuildContext context) { return GestureDetector( diff --git a/lib/ui/views/authentication/components/auth_options_view.dart b/lib/ui/views/authentication/components/auth_options_view.dart index 89b801dc..3cc02b27 100644 --- a/lib/ui/views/authentication/components/auth_options_view.dart +++ b/lib/ui/views/authentication/components/auth_options_view.dart @@ -7,10 +7,10 @@ import 'package:mobile_app/utils/snackbar_utils.dart'; import 'package:mobile_app/viewmodels/authentication/auth_options_viewmodel.dart'; class AuthOptionsView extends StatefulWidget { - final bool isSignUp; - const AuthOptionsView({Key key, this.isSignUp = false}) : super(key: key); + final bool isSignUp; + @override _AuthOptionsViewState createState() => _AuthOptionsViewState(); } diff --git a/lib/ui/views/authentication/forgot_password_view.dart b/lib/ui/views/authentication/forgot_password_view.dart index 1b2cd9b0..9efd73d8 100644 --- a/lib/ui/views/authentication/forgot_password_view.dart +++ b/lib/ui/views/authentication/forgot_password_view.dart @@ -13,9 +13,10 @@ import 'package:mobile_app/utils/validators.dart'; import 'package:mobile_app/viewmodels/authentication/forgot_password_viewmodel.dart'; class ForgotPasswordView extends StatefulWidget { + const ForgotPasswordView({Key key}) : super(key: key); + static const String id = 'forgot_password_view'; - const ForgotPasswordView({Key key}) : super(key: key); @override _ForgotPasswordViewState createState() => _ForgotPasswordViewState(); } diff --git a/lib/ui/views/authentication/login_view.dart b/lib/ui/views/authentication/login_view.dart index ae921854..93340370 100644 --- a/lib/ui/views/authentication/login_view.dart +++ b/lib/ui/views/authentication/login_view.dart @@ -14,10 +14,10 @@ import 'package:mobile_app/utils/validators.dart'; import 'package:mobile_app/viewmodels/authentication/login_viewmodel.dart'; class LoginView extends StatefulWidget { - static const String id = 'login_view'; - const LoginView({Key key}) : super(key: key); + static const String id = 'login_view'; + @override _LoginViewState createState() => _LoginViewState(); } diff --git a/lib/ui/views/authentication/signup_view.dart b/lib/ui/views/authentication/signup_view.dart index 5a005be1..2616aaf3 100644 --- a/lib/ui/views/authentication/signup_view.dart +++ b/lib/ui/views/authentication/signup_view.dart @@ -13,10 +13,10 @@ import 'package:mobile_app/utils/validators.dart'; import 'package:mobile_app/viewmodels/authentication/signup_viewmodel.dart'; class SignupView extends StatefulWidget { - static const String id = 'signup_view'; - const SignupView({Key key}) : super(key: key); + static const String id = 'signup_view'; + @override _SignupViewState createState() => _SignupViewState(); } diff --git a/lib/ui/views/base_view.dart b/lib/ui/views/base_view.dart index 66355158..a48293b4 100644 --- a/lib/ui/views/base_view.dart +++ b/lib/ui/views/base_view.dart @@ -4,11 +4,6 @@ import 'package:mobile_app/viewmodels/base_viewmodel.dart'; import 'package:provider/provider.dart'; class BaseView extends StatefulWidget { - final Widget Function(BuildContext context, T model, Widget child) builder; - final Function(T) onModelReady; - final Function(T) onModelDestroy; - final T model; - const BaseView({ Key key, @required this.builder, @@ -17,6 +12,11 @@ class BaseView extends StatefulWidget { this.model, }) : super(key: key); + final Widget Function(BuildContext context, T model, Widget child) builder; + final Function(T) onModelReady; + final Function(T) onModelDestroy; + final T model; + @override _BaseViewState createState() => _BaseViewState(); } diff --git a/lib/ui/views/contributors/components/contributors_donate_card.dart b/lib/ui/views/contributors/components/contributors_donate_card.dart index 694a64f2..7078958c 100644 --- a/lib/ui/views/contributors/components/contributors_donate_card.dart +++ b/lib/ui/views/contributors/components/contributors_donate_card.dart @@ -2,10 +2,6 @@ import 'package:flutter/material.dart'; import 'package:mobile_app/utils/url_launcher.dart'; class ContributeDonateCard extends StatelessWidget { - final String imagePath; - final String title; - final String url; - const ContributeDonateCard({ Key key, this.imagePath, @@ -13,6 +9,10 @@ class ContributeDonateCard extends StatelessWidget { this.url, }) : super(key: key); + final String imagePath; + final String title; + final String url; + @override Widget build(BuildContext context) { return Column( diff --git a/lib/ui/views/contributors/components/contributors_support_card.dart b/lib/ui/views/contributors/components/contributors_support_card.dart index 62fcaaa8..4204573e 100644 --- a/lib/ui/views/contributors/components/contributors_support_card.dart +++ b/lib/ui/views/contributors/components/contributors_support_card.dart @@ -1,10 +1,6 @@ import 'package:flutter/material.dart'; class ContributeSupportCard extends StatelessWidget { - final String imagePath; - final String title; - final List cardDescriptionList; - const ContributeSupportCard({ Key key, this.imagePath, @@ -12,6 +8,10 @@ class ContributeSupportCard extends StatelessWidget { this.cardDescriptionList, }) : super(key: key); + final String imagePath; + final String title; + final List cardDescriptionList; + @override Widget build(BuildContext context) { return Card( diff --git a/lib/ui/views/contributors/contributors_view.dart b/lib/ui/views/contributors/contributors_view.dart index ba5aaf8e..92716b81 100644 --- a/lib/ui/views/contributors/contributors_view.dart +++ b/lib/ui/views/contributors/contributors_view.dart @@ -6,11 +6,11 @@ import 'package:mobile_app/ui/views/contributors/components/contributors_donate_ import 'package:mobile_app/ui/views/contributors/components/contributors_support_card.dart'; class ContributorsView extends StatelessWidget { + const ContributorsView({Key key, this.showAppBar = true}) : super(key: key); + static const String id = 'contributors_view'; final bool showAppBar; - const ContributorsView({Key key, this.showAppBar = true}) : super(key: key); - @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/ui/views/cv_landing_view.dart b/lib/ui/views/cv_landing_view.dart index c99a2a00..86e64a1d 100644 --- a/lib/ui/views/cv_landing_view.dart +++ b/lib/ui/views/cv_landing_view.dart @@ -23,9 +23,8 @@ import 'package:theme_provider/theme_provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class CVLandingView extends StatefulWidget { - static const String id = 'cv_landing_view'; - const CVLandingView({Key key}) : super(key: key); + static const String id = 'cv_landing_view'; @override _CVLandingViewState createState() => _CVLandingViewState(); diff --git a/lib/ui/views/groups/add_assignment_view.dart b/lib/ui/views/groups/add_assignment_view.dart index 14e65a00..4238e3a3 100644 --- a/lib/ui/views/groups/add_assignment_view.dart +++ b/lib/ui/views/groups/add_assignment_view.dart @@ -16,11 +16,11 @@ import 'package:mobile_app/utils/validators.dart'; import 'package:mobile_app/viewmodels/groups/add_assignment_viewmodel.dart'; class AddAssignmentView extends StatefulWidget { + const AddAssignmentView({Key key, this.groupId}) : super(key: key); + static const String id = 'add_assignment_view'; final String groupId; - const AddAssignmentView({Key key, this.groupId}) : super(key: key); - @override _AddAssignmentViewState createState() => _AddAssignmentViewState(); } diff --git a/lib/ui/views/groups/assignment_details_view.dart b/lib/ui/views/groups/assignment_details_view.dart index a7034f26..b03d4789 100644 --- a/lib/ui/views/groups/assignment_details_view.dart +++ b/lib/ui/views/groups/assignment_details_view.dart @@ -20,11 +20,11 @@ import 'package:mobile_app/viewmodels/groups/assignment_details_viewmodel.dart'; import 'package:transparent_image/transparent_image.dart'; class AssignmentDetailsView extends StatefulWidget { + const AssignmentDetailsView({Key key, this.assignment}) : super(key: key); + static const String id = 'assignment_details_view'; final Assignment assignment; - const AssignmentDetailsView({Key key, this.assignment}) : super(key: key); - @override _AssignmentDetailsViewState createState() => _AssignmentDetailsViewState(); } diff --git a/lib/ui/views/groups/components/assignment_card.dart b/lib/ui/views/groups/components/assignment_card.dart index f743ffdf..160d6ffe 100644 --- a/lib/ui/views/groups/components/assignment_card.dart +++ b/lib/ui/views/groups/components/assignment_card.dart @@ -7,12 +7,6 @@ import 'package:mobile_app/ui/views/groups/assignment_details_view.dart'; import 'package:mobile_app/ui/views/groups/components/group_card_button.dart'; class AssignmentCard extends StatefulWidget { - final Assignment assignment; - final VoidCallback onDeletePressed; - final VoidCallback onEditPressed; - final VoidCallback onReopenPressed; - final VoidCallback onStartPressed; - const AssignmentCard({ Key key, this.assignment, @@ -21,6 +15,11 @@ class AssignmentCard extends StatefulWidget { this.onReopenPressed, this.onStartPressed, }) : super(key: key); + final Assignment assignment; + final VoidCallback onDeletePressed; + final VoidCallback onEditPressed; + final VoidCallback onReopenPressed; + final VoidCallback onStartPressed; @override _AssignmentCardState createState() => _AssignmentCardState(); diff --git a/lib/ui/views/groups/components/group_card_button.dart b/lib/ui/views/groups/components/group_card_button.dart index 3aa7678b..ab6e6097 100644 --- a/lib/ui/views/groups/components/group_card_button.dart +++ b/lib/ui/views/groups/components/group_card_button.dart @@ -1,16 +1,15 @@ import 'package:flutter/material.dart'; class CardButton extends StatelessWidget { - final VoidCallback onPressed; - final Color color; - final String title; - const CardButton({ Key key, @required this.onPressed, @required this.color, @required this.title, }) : super(key: key); + final VoidCallback onPressed; + final Color color; + final String title; @override Widget build(BuildContext context) { diff --git a/lib/ui/views/groups/components/group_member_card.dart b/lib/ui/views/groups/components/group_member_card.dart index f55ccc5f..d7c7dedf 100644 --- a/lib/ui/views/groups/components/group_member_card.dart +++ b/lib/ui/views/groups/components/group_member_card.dart @@ -6,10 +6,10 @@ import 'package:mobile_app/ui/views/groups/components/group_card_button.dart'; import 'package:mobile_app/ui/views/groups/group_details_view.dart'; class GroupMemberCard extends StatelessWidget { - final Group group; - const GroupMemberCard({Key key, this.group}) : super(key: key); + final Group group; + @override Widget build(BuildContext context) { return Container( diff --git a/lib/ui/views/groups/components/group_mentor_card.dart b/lib/ui/views/groups/components/group_mentor_card.dart index f739b25c..c85deae1 100644 --- a/lib/ui/views/groups/components/group_mentor_card.dart +++ b/lib/ui/views/groups/components/group_mentor_card.dart @@ -6,13 +6,13 @@ import 'package:mobile_app/ui/views/groups/components/group_card_button.dart'; import 'package:mobile_app/ui/views/groups/group_details_view.dart'; class GroupMentorCard extends StatefulWidget { + const GroupMentorCard({Key key, this.group, this.onEdit, this.onDelete}) + : super(key: key); + final Group group; final VoidCallback onEdit; final VoidCallback onDelete; - const GroupMentorCard({Key key, this.group, this.onEdit, this.onDelete}) - : super(key: key); - @override _GroupMentorCardState createState() => _GroupMentorCardState(); } diff --git a/lib/ui/views/groups/components/member_card.dart b/lib/ui/views/groups/components/member_card.dart index 1c81cc7a..d1f796e0 100644 --- a/lib/ui/views/groups/components/member_card.dart +++ b/lib/ui/views/groups/components/member_card.dart @@ -3,10 +3,6 @@ import 'package:mobile_app/cv_theme.dart'; import 'package:mobile_app/models/group_members.dart'; class MemberCard extends StatelessWidget { - final GroupMember member; - final bool hasMentorAccess; - final VoidCallback onDeletePressed; - const MemberCard({ Key key, this.member, @@ -14,6 +10,10 @@ class MemberCard extends StatelessWidget { this.onDeletePressed, }) : super(key: key); + final GroupMember member; + final bool hasMentorAccess; + final VoidCallback onDeletePressed; + @override Widget build(BuildContext context) { return Container( diff --git a/lib/ui/views/groups/edit_group_view.dart b/lib/ui/views/groups/edit_group_view.dart index 2db67e10..b64beb71 100644 --- a/lib/ui/views/groups/edit_group_view.dart +++ b/lib/ui/views/groups/edit_group_view.dart @@ -13,11 +13,11 @@ import 'package:mobile_app/utils/validators.dart'; import 'package:mobile_app/viewmodels/groups/edit_group_viewmodel.dart'; class EditGroupView extends StatefulWidget { + const EditGroupView({Key key, this.group}) : super(key: key); + static const String id = 'edit_group_view'; final Group group; - const EditGroupView({Key key, this.group}) : super(key: key); - @override _EditGroupViewState createState() => _EditGroupViewState(); } diff --git a/lib/ui/views/groups/group_details_view.dart b/lib/ui/views/groups/group_details_view.dart index 39e4f060..f04cf0e6 100644 --- a/lib/ui/views/groups/group_details_view.dart +++ b/lib/ui/views/groups/group_details_view.dart @@ -18,11 +18,11 @@ import 'package:mobile_app/ui/components/cv_flat_button.dart'; import 'package:mobile_app/viewmodels/groups/group_details_viewmodel.dart'; class GroupDetailsView extends StatefulWidget { + const GroupDetailsView({Key key, this.group}) : super(key: key); + static const String id = 'group_details_view'; final Group group; - const GroupDetailsView({Key key, this.group}) : super(key: key); - @override _GroupDetailsViewState createState() => _GroupDetailsViewState(); } diff --git a/lib/ui/views/groups/my_groups_view.dart b/lib/ui/views/groups/my_groups_view.dart index 10a98298..1c2cd4c4 100644 --- a/lib/ui/views/groups/my_groups_view.dart +++ b/lib/ui/views/groups/my_groups_view.dart @@ -15,10 +15,10 @@ import 'package:mobile_app/utils/snackbar_utils.dart'; import 'package:mobile_app/viewmodels/groups/my_groups_viewmodel.dart'; class MyGroupsView extends StatefulWidget { - static const String id = 'my_groups_view'; - const MyGroupsView({Key key}) : super(key: key); + static const String id = 'my_groups_view'; + @override _MyGroupsViewState createState() => _MyGroupsViewState(); } diff --git a/lib/ui/views/groups/new_group_view.dart b/lib/ui/views/groups/new_group_view.dart index 071fd4f6..ec1e64e4 100644 --- a/lib/ui/views/groups/new_group_view.dart +++ b/lib/ui/views/groups/new_group_view.dart @@ -12,10 +12,10 @@ import 'package:mobile_app/utils/validators.dart'; import 'package:mobile_app/viewmodels/groups/new_group_viewmodel.dart'; class NewGroupView extends StatefulWidget { - static const String id = 'new_group_view'; - const NewGroupView({Key key}) : super(key: key); + static const String id = 'new_group_view'; + @override _NewGroupViewState createState() => _NewGroupViewState(); } diff --git a/lib/ui/views/groups/update_assignment_view.dart b/lib/ui/views/groups/update_assignment_view.dart index 60df3834..9b717a23 100644 --- a/lib/ui/views/groups/update_assignment_view.dart +++ b/lib/ui/views/groups/update_assignment_view.dart @@ -19,11 +19,11 @@ import 'package:mobile_app/utils/validators.dart'; import 'package:mobile_app/viewmodels/groups/update_assignment_viewmodel.dart'; class UpdateAssignmentView extends StatefulWidget { + const UpdateAssignmentView({Key key, this.assignment}) : super(key: key); + static const String id = 'update_assignment_view'; final Assignment assignment; - const UpdateAssignmentView({Key key, this.assignment}) : super(key: key); - @override _UpdateAssignmentViewState createState() => _UpdateAssignmentViewState(); } diff --git a/lib/ui/views/home/components/feature_card.dart b/lib/ui/views/home/components/feature_card.dart index 2232d312..c8be5416 100644 --- a/lib/ui/views/home/components/feature_card.dart +++ b/lib/ui/views/home/components/feature_card.dart @@ -1,10 +1,6 @@ import 'package:flutter/material.dart'; class FeatureCard extends StatelessWidget { - final String assetPath; - final String cardHeading; - final String cardDescription; - const FeatureCard({ Key key, this.assetPath, @@ -12,6 +8,10 @@ class FeatureCard extends StatelessWidget { this.cardHeading, }) : super(key: key); + final String assetPath; + final String cardHeading; + final String cardDescription; + @override Widget build(BuildContext context) { return Card( diff --git a/lib/ui/views/home/home_view.dart b/lib/ui/views/home/home_view.dart index 19556170..6ab5f47e 100644 --- a/lib/ui/views/home/home_view.dart +++ b/lib/ui/views/home/home_view.dart @@ -10,9 +10,8 @@ import 'package:mobile_app/ui/views/teachers/teachers_view.dart'; import 'package:mobile_app/viewmodels/home/home_viewmodel.dart'; class HomeView extends StatefulWidget { - static const String id = 'home_view'; - const HomeView({Key key}) : super(key: key); + static const String id = 'home_view'; @override _HomeViewState createState() => _HomeViewState(); diff --git a/lib/ui/views/ib/builders/ib_chapter_contents_builder.dart b/lib/ui/views/ib/builders/ib_chapter_contents_builder.dart index 2c3d252a..52238448 100644 --- a/lib/ui/views/ib/builders/ib_chapter_contents_builder.dart +++ b/lib/ui/views/ib/builders/ib_chapter_contents_builder.dart @@ -3,10 +3,10 @@ import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:markdown/markdown.dart' as md; class IbChapterContentsBuilder extends MarkdownElementBuilder { - final Widget chapterContents; - IbChapterContentsBuilder({this.chapterContents}); + final Widget chapterContents; + @override Widget visitElementAfter(md.Element element, TextStyle preferredStyle) { return chapterContents; diff --git a/lib/ui/views/ib/builders/ib_headings_builder.dart b/lib/ui/views/ib/builders/ib_headings_builder.dart index 1f1a61ed..136ad7d7 100644 --- a/lib/ui/views/ib/builders/ib_headings_builder.dart +++ b/lib/ui/views/ib/builders/ib_headings_builder.dart @@ -5,13 +5,13 @@ import 'package:mobile_app/services/ib_engine_service.dart'; import 'package:scroll_to_index/scroll_to_index.dart'; class IbHeadingsBuilder extends MarkdownElementBuilder { + IbHeadingsBuilder({this.slugMap, this.controller, this.selectable = true}); + final Map slugMap; final AutoScrollController controller; final bool selectable; var index = 0; - IbHeadingsBuilder({this.slugMap, this.controller, this.selectable = true}); - @override Widget visitElementAfter(md.Element element, TextStyle preferredStyle) { var text = element.textContent; diff --git a/lib/ui/views/ib/builders/ib_interaction_builder.dart b/lib/ui/views/ib/builders/ib_interaction_builder.dart index 9953edbc..b867a61a 100644 --- a/lib/ui/views/ib/builders/ib_interaction_builder.dart +++ b/lib/ui/views/ib/builders/ib_interaction_builder.dart @@ -9,10 +9,10 @@ import 'package:mobile_app/viewmodels/ib/ib_page_viewmodel.dart'; import 'package:webview_flutter/webview_flutter.dart'; class IbInteractionBuilder extends MarkdownElementBuilder { - final IbPageViewModel model; - IbInteractionBuilder({this.model}); + final IbPageViewModel model; + @override Widget visitElementAfter(md.Element element, TextStyle preferredStyle) { var id = element.textContent; diff --git a/lib/ui/views/ib/builders/ib_pop_quiz_builder.dart b/lib/ui/views/ib/builders/ib_pop_quiz_builder.dart index a638912f..126cbea2 100644 --- a/lib/ui/views/ib/builders/ib_pop_quiz_builder.dart +++ b/lib/ui/views/ib/builders/ib_pop_quiz_builder.dart @@ -5,11 +5,11 @@ import 'package:mobile_app/ui/views/ib/components/ib_pop_quiz.dart'; import 'package:mobile_app/viewmodels/ib/ib_page_viewmodel.dart'; class IbPopQuizBuilder extends MarkdownElementBuilder { + IbPopQuizBuilder({this.context, this.model}); + final BuildContext context; final IbPageViewModel model; - IbPopQuizBuilder({this.context, this.model}); - @override Widget visitElementAfter(md.Element element, TextStyle preferredStyle) { var _rawContent = element.textContent; diff --git a/lib/ui/views/ib/builders/ib_subscript_builder.dart b/lib/ui/views/ib/builders/ib_subscript_builder.dart index 21564230..c03e32f9 100644 --- a/lib/ui/views/ib/builders/ib_subscript_builder.dart +++ b/lib/ui/views/ib/builders/ib_subscript_builder.dart @@ -4,10 +4,10 @@ import 'package:markdown/markdown.dart' as md; import 'package:mobile_app/utils/unicode_map.dart'; class IbSubscriptBuilder extends MarkdownElementBuilder { - final bool selectable; - IbSubscriptBuilder({this.selectable = true}); + final bool selectable; + @override Widget visitElementAfter(md.Element element, TextStyle preferredStyle) { final textContent = element.textContent; diff --git a/lib/ui/views/ib/builders/ib_superscript_builder.dart b/lib/ui/views/ib/builders/ib_superscript_builder.dart index 202e0eef..bfb7c2fc 100644 --- a/lib/ui/views/ib/builders/ib_superscript_builder.dart +++ b/lib/ui/views/ib/builders/ib_superscript_builder.dart @@ -4,10 +4,10 @@ import 'package:markdown/markdown.dart' as md; import 'package:mobile_app/utils/unicode_map.dart'; class IbSuperscriptBuilder extends MarkdownElementBuilder { - final bool selectable; - IbSuperscriptBuilder({this.selectable = true}); + final bool selectable; + @override Widget visitElementAfter(md.Element element, TextStyle preferredStyle) { final textContent = element.textContent; diff --git a/lib/ui/views/ib/components/ib_pop_quiz.dart b/lib/ui/views/ib/components/ib_pop_quiz.dart index 828d196d..67ea95ea 100644 --- a/lib/ui/views/ib/components/ib_pop_quiz.dart +++ b/lib/ui/views/ib/components/ib_pop_quiz.dart @@ -5,11 +5,11 @@ import 'package:mobile_app/models/ib/ib_pop_quiz_question.dart'; import 'package:mobile_app/ui/views/ib/components/ib_pop_quiz_button.dart'; class IbPopQuiz extends StatelessWidget { + const IbPopQuiz({Key key, this.context, this.questions}) : super(key: key); + final BuildContext context; final List questions; - const IbPopQuiz({Key key, this.context, this.questions}) : super(key: key); - Widget _buildQuestion(int questionNumber, IbPopQuizQuestion question) { var buttonsWidgets = []; diff --git a/lib/ui/views/ib/components/ib_pop_quiz_button.dart b/lib/ui/views/ib/components/ib_pop_quiz_button.dart index 27c782fc..72905134 100644 --- a/lib/ui/views/ib/components/ib_pop_quiz_button.dart +++ b/lib/ui/views/ib/components/ib_pop_quiz_button.dart @@ -1,15 +1,15 @@ import 'package:flutter/material.dart'; class IbPopQuizButton extends StatefulWidget { - final String content; - final bool isCorrect; - const IbPopQuizButton({ Key key, @required this.content, @required this.isCorrect, }) : super(key: key); + final String content; + final bool isCorrect; + @override IbPopQuizButtonState createState() => IbPopQuizButtonState(); } diff --git a/lib/ui/views/ib/ib_landing_view.dart b/lib/ui/views/ib/ib_landing_view.dart index 13a2f818..cbd7f780 100644 --- a/lib/ui/views/ib/ib_landing_view.dart +++ b/lib/ui/views/ib/ib_landing_view.dart @@ -10,10 +10,10 @@ import 'package:mobile_app/viewmodels/ib/ib_landing_viewmodel.dart'; import 'package:theme_provider/theme_provider.dart'; class IbLandingView extends StatefulWidget { - static const String id = 'ib_landing_view'; - const IbLandingView({Key key}) : super(key: key); + static const String id = 'ib_landing_view'; + @override _IbLandingViewState createState() => _IbLandingViewState(); } diff --git a/lib/ui/views/ib/ib_page_view.dart b/lib/ui/views/ib/ib_page_view.dart index ba930d70..911cb90f 100644 --- a/lib/ui/views/ib/ib_page_view.dart +++ b/lib/ui/views/ib/ib_page_view.dart @@ -33,11 +33,6 @@ typedef TocCallback = void Function(Function); typedef SetPageCallback = void Function(IbChapter); class IbPageView extends StatefulWidget { - static const String id = 'ib_page_view'; - final TocCallback tocCallback; - final SetPageCallback setPage; - final IbChapter chapter; - const IbPageView({ @required Key key, @required this.tocCallback, @@ -45,6 +40,11 @@ class IbPageView extends StatefulWidget { @required this.setPage, }) : super(key: key); + static const String id = 'ib_page_view'; + final TocCallback tocCallback; + final SetPageCallback setPage; + final IbChapter chapter; + @override _IbPageViewState createState() => _IbPageViewState(); } diff --git a/lib/ui/views/ib/syntaxes/ib_inline_html_syntax.dart b/lib/ui/views/ib/syntaxes/ib_inline_html_syntax.dart index 5f259411..2bb6a1d3 100644 --- a/lib/ui/views/ib/syntaxes/ib_inline_html_syntax.dart +++ b/lib/ui/views/ib/syntaxes/ib_inline_html_syntax.dart @@ -3,10 +3,10 @@ import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:markdown/markdown.dart' as md; class IbInlineHtmlSyntax extends md.InlineSyntax { - Map builders; - IbInlineHtmlSyntax({@required this.builders}) : super(_pattern); + Map builders; + static const String _pattern = r'<(\S*?)[^>]*>(.*?)<\/\1>|<.*?\/>'; @override diff --git a/lib/ui/views/ib/syntaxes/ib_md_tag_syntax.dart b/lib/ui/views/ib/syntaxes/ib_md_tag_syntax.dart index a0dfd61b..698a9488 100644 --- a/lib/ui/views/ib/syntaxes/ib_md_tag_syntax.dart +++ b/lib/ui/views/ib/syntaxes/ib_md_tag_syntax.dart @@ -1,9 +1,10 @@ import 'package:markdown/markdown.dart' as md; class IbMdTagSyntax extends md.BlockSyntax { - final _tagsStack = []; IbMdTagSyntax() : super(); + final _tagsStack = []; + @override md.Node parse(md.BlockParser parser) { var match = pattern.firstMatch(parser.current); diff --git a/lib/ui/views/profile/edit_profile_view.dart b/lib/ui/views/profile/edit_profile_view.dart index be2270bc..0a6b35a1 100644 --- a/lib/ui/views/profile/edit_profile_view.dart +++ b/lib/ui/views/profile/edit_profile_view.dart @@ -13,10 +13,10 @@ import 'package:mobile_app/utils/validators.dart'; import 'package:mobile_app/viewmodels/profile/edit_profile_viewmodel.dart'; class EditProfileView extends StatefulWidget { - static const String id = 'edit_profile_view'; - const EditProfileView({Key key}) : super(key: key); + static const String id = 'edit_profile_view'; + @override _EditProfileViewState createState() => _EditProfileViewState(); } diff --git a/lib/ui/views/profile/profile_view.dart b/lib/ui/views/profile/profile_view.dart index dc86516f..cd9bbce4 100644 --- a/lib/ui/views/profile/profile_view.dart +++ b/lib/ui/views/profile/profile_view.dart @@ -13,11 +13,11 @@ import 'package:mobile_app/viewmodels/profile/profile_viewmodel.dart'; import 'package:timeago/timeago.dart' as timeago; class ProfileView extends StatefulWidget { + const ProfileView({Key key, this.userId}) : super(key: key); + static const String id = 'profile_view'; final String userId; - const ProfileView({Key key, this.userId}) : super(key: key); - @override _ProfileViewState createState() => _ProfileViewState(); } diff --git a/lib/ui/views/profile/user_favourites_view.dart b/lib/ui/views/profile/user_favourites_view.dart index 32215a9a..20923535 100644 --- a/lib/ui/views/profile/user_favourites_view.dart +++ b/lib/ui/views/profile/user_favourites_view.dart @@ -8,10 +8,10 @@ import 'package:mobile_app/ui/views/projects/project_details_view.dart'; import 'package:mobile_app/viewmodels/profile/user_favourites_viewmodel.dart'; class UserFavouritesView extends StatefulWidget { - final String userId; - const UserFavouritesView({Key key, this.userId}) : super(key: key); + final String userId; + @override _UserFavouritesViewState createState() => _UserFavouritesViewState(); } diff --git a/lib/ui/views/profile/user_projects_view.dart b/lib/ui/views/profile/user_projects_view.dart index 1eed9c8b..fa7e2997 100644 --- a/lib/ui/views/profile/user_projects_view.dart +++ b/lib/ui/views/profile/user_projects_view.dart @@ -7,10 +7,10 @@ import 'package:mobile_app/ui/views/projects/project_details_view.dart'; import 'package:mobile_app/viewmodels/profile/user_projects_viewmodel.dart'; class UserProjectsView extends StatefulWidget { - final String userId; - const UserProjectsView({Key key, this.userId}) : super(key: key); + final String userId; + @override _UserProjectsViewState createState() => _UserProjectsViewState(); } diff --git a/lib/ui/views/projects/components/featured_project_card.dart b/lib/ui/views/projects/components/featured_project_card.dart index 0cd4be5c..4519dc72 100644 --- a/lib/ui/views/projects/components/featured_project_card.dart +++ b/lib/ui/views/projects/components/featured_project_card.dart @@ -6,12 +6,13 @@ import 'package:mobile_app/ui/components/cv_primary_button.dart'; import 'package:transparent_image/transparent_image.dart'; class FeaturedProjectCard extends StatefulWidget { - final Project project; - final VoidCallback onViewPressed; const FeaturedProjectCard( {Key key, @required this.project, this.onViewPressed}) : super(key: key); + final Project project; + final VoidCallback onViewPressed; + @override _FeaturedProjectCardState createState() => _FeaturedProjectCardState(); } diff --git a/lib/ui/views/projects/components/project_card.dart b/lib/ui/views/projects/components/project_card.dart index ae045266..d99685b3 100644 --- a/lib/ui/views/projects/components/project_card.dart +++ b/lib/ui/views/projects/components/project_card.dart @@ -5,14 +5,14 @@ import 'package:mobile_app/models/projects.dart'; import 'package:transparent_image/transparent_image.dart'; class ProjectCard extends StatefulWidget { - final Project project; - final VoidCallback onPressed; - final bool isHeaderFilled; - const ProjectCard( {Key key, this.project, this.onPressed, this.isHeaderFilled = true}) : super(key: key); + final Project project; + final VoidCallback onPressed; + final bool isHeaderFilled; + @override _ProjectCardState createState() => _ProjectCardState(); } diff --git a/lib/ui/views/projects/edit_project_view.dart b/lib/ui/views/projects/edit_project_view.dart index b56859df..695dbbb3 100644 --- a/lib/ui/views/projects/edit_project_view.dart +++ b/lib/ui/views/projects/edit_project_view.dart @@ -14,11 +14,11 @@ import 'package:mobile_app/utils/validators.dart'; import 'package:mobile_app/viewmodels/projects/edit_project_viewmodel.dart'; class EditProjectView extends StatefulWidget { + const EditProjectView({Key key, this.project}) : super(key: key); + static const String id = 'edit_project_view'; final Project project; - const EditProjectView({Key key, this.project}) : super(key: key); - @override _EditProjectViewState createState() => _EditProjectViewState(); } diff --git a/lib/ui/views/projects/featured_projects_view.dart b/lib/ui/views/projects/featured_projects_view.dart index b5904d52..e2241213 100644 --- a/lib/ui/views/projects/featured_projects_view.dart +++ b/lib/ui/views/projects/featured_projects_view.dart @@ -8,14 +8,14 @@ import 'package:mobile_app/ui/views/projects/project_details_view.dart'; import 'package:mobile_app/viewmodels/projects/featured_projects_viewmodel.dart'; class FeaturedProjectsView extends StatefulWidget { - static const String id = 'featured_projects_view'; - final bool showAppBar; - final bool embed; - const FeaturedProjectsView( {Key key, this.showAppBar = true, this.embed = false}) : super(key: key); + static const String id = 'featured_projects_view'; + final bool showAppBar; + final bool embed; + @override _FeaturedProjectsViewState createState() => _FeaturedProjectsViewState(); } diff --git a/lib/ui/views/projects/project_details_view.dart b/lib/ui/views/projects/project_details_view.dart index 58124805..422c0fb6 100644 --- a/lib/ui/views/projects/project_details_view.dart +++ b/lib/ui/views/projects/project_details_view.dart @@ -23,11 +23,11 @@ import 'package:share/share.dart'; import 'package:transparent_image/transparent_image.dart'; class ProjectDetailsView extends StatefulWidget { + const ProjectDetailsView({Key key, this.project}) : super(key: key); + static const String id = 'project_details_view'; final Project project; - const ProjectDetailsView({Key key, this.project}) : super(key: key); - @override _ProjectDetailsViewState createState() => _ProjectDetailsViewState(); } diff --git a/lib/ui/views/projects/project_preview_fullscreen_view.dart b/lib/ui/views/projects/project_preview_fullscreen_view.dart index 0e373950..9d89ec2a 100644 --- a/lib/ui/views/projects/project_preview_fullscreen_view.dart +++ b/lib/ui/views/projects/project_preview_fullscreen_view.dart @@ -5,9 +5,10 @@ import 'package:photo_view/photo_view.dart'; import 'package:transparent_image/transparent_image.dart'; class ProjectPreviewFullScreen extends StatelessWidget { + const ProjectPreviewFullScreen({Key key, this.project}) : super(key: key); + static const String id = 'project_preview_fullscreen_view'; final Project project; - const ProjectPreviewFullScreen({Key key, this.project}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/ui/views/teachers/components/teachers_card.dart b/lib/ui/views/teachers/components/teachers_card.dart index 618a47ec..49b5df94 100644 --- a/lib/ui/views/teachers/components/teachers_card.dart +++ b/lib/ui/views/teachers/components/teachers_card.dart @@ -1,10 +1,6 @@ import 'package:flutter/material.dart'; class TeachersCard extends StatelessWidget { - final String assetPath; - final String cardHeading; - final String cardDescription; - const TeachersCard({ Key key, this.assetPath, @@ -12,6 +8,10 @@ class TeachersCard extends StatelessWidget { this.cardHeading, }) : super(key: key); + final String assetPath; + final String cardHeading; + final String cardDescription; + @override Widget build(BuildContext context) { return Card( diff --git a/lib/ui/views/teachers/teachers_view.dart b/lib/ui/views/teachers/teachers_view.dart index 8d29e8c2..a0242b12 100644 --- a/lib/ui/views/teachers/teachers_view.dart +++ b/lib/ui/views/teachers/teachers_view.dart @@ -4,11 +4,11 @@ import 'package:mobile_app/ui/components/cv_subheader.dart'; import 'package:mobile_app/ui/views/teachers/components/teachers_card.dart'; class TeachersView extends StatelessWidget { + const TeachersView({Key key, this.showAppBar = true}) : super(key: key); + static const String id = 'teachers_view'; final bool showAppBar; - const TeachersView({Key key, this.showAppBar = true}) : super(key: key); - @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/utils/app_exceptions.dart b/lib/utils/app_exceptions.dart index 3435e68c..76267256 100644 --- a/lib/utils/app_exceptions.dart +++ b/lib/utils/app_exceptions.dart @@ -1,10 +1,10 @@ class AppException implements Exception { + AppException([this._message, this._prefix]); + final String _message; final String _prefix; - AppException([this._message, this._prefix]); - String get message => _message; String get prefix => _prefix; diff --git a/lib/utils/enum_values.dart b/lib/utils/enum_values.dart index e0e57b2e..606a0a62 100644 --- a/lib/utils/enum_values.dart +++ b/lib/utils/enum_values.dart @@ -1,9 +1,9 @@ class EnumValues { + EnumValues(this.map); + Map map; Map reverseMap; - EnumValues(this.map); - Map get reverse { reverseMap ??= map.map((k, v) => MapEntry(v, k)); return reverseMap;