style: lint fix apply

This commit is contained in:
Rongjian Zhang 2022-09-22 00:28:21 +08:00
parent 606370a85e
commit 7e79da77ee
132 changed files with 635 additions and 633 deletions

View File

@ -24,6 +24,8 @@ linter:
rules:
prefer_single_quotes: true
always_use_package_imports: true
sort_constructors_first: true
sort_unnamed_constructors_first: true
analyzer:
exclude:

View File

@ -3,15 +3,7 @@ import 'package:json_annotation/json_annotation.dart';
part 'account.g.dart';
@JsonSerializable(includeIfNull: false)
class Account {
String platform;
String domain;
String token;
String login;
String avatarUrl;
int? gitlabId; // For GitLab
String? appPassword; // For Bitbucket
String? accountId; // For Bitbucket
class Account { // For Bitbucket
// equals(Account a) {
// final uri = Uri.parse(domain);
@ -38,6 +30,14 @@ class Account {
factory Account.fromJson(Map<String, dynamic> json) =>
_$AccountFromJson(json);
String platform;
String domain;
String token;
String login;
String avatarUrl;
int? gitlabId; // For GitLab
String? appPassword; // For Bitbucket
String? accountId;
Map<String, dynamic> toJson() => _$AccountToJson(this);
}

View File

@ -35,16 +35,16 @@ class PlatformType {
}
class DataWithPage<T> {
T data;
int cursor;
bool hasMore;
int total;
DataWithPage({
required this.data,
required this.cursor,
required this.hasMore,
required this.total,
});
T data;
int cursor;
bool hasMore;
int total;
}
class AuthModel with ChangeNotifier {

View File

@ -3,37 +3,39 @@ part 'bitbucket.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class BbPagination {
String? next;
List values;
BbPagination({required this.values});
factory BbPagination.fromJson(Map<String, dynamic> json) =>
_$BbPaginationFromJson(json);
String? next;
List values;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbRepoOwner {
BbRepoOwner();
factory BbRepoOwner.fromJson(Map<String, dynamic> json) =>
_$BbRepoOwnerFromJson(json);
String? nickname;
String? displayName;
String? type; // user, team
Map<String, dynamic>? links;
String? get avatarUrl => links!['avatar']['href'];
BbRepoOwner();
factory BbRepoOwner.fromJson(Map<String, dynamic> json) =>
_$BbRepoOwnerFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbUser extends BbRepoOwner {
BbUser();
factory BbUser.fromJson(Map<String, dynamic> json) => _$BbUserFromJson(json);
String? username;
bool? isStaff;
DateTime? createdOn;
String? accountId;
BbUser();
factory BbUser.fromJson(Map<String, dynamic> json) => _$BbUserFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbRepo {
BbRepo();
factory BbRepo.fromJson(Map<String, dynamic> json) => _$BbRepoFromJson(json);
String? name;
BbRepoOwner? owner;
String? website;
@ -50,51 +52,52 @@ class BbRepo {
Map<String, dynamic>? links;
String get ownerLogin => fullName!.split('/')[0]; // owner has no username
String? get avatarUrl => links!['avatar']['href'];
BbRepo();
factory BbRepo.fromJson(Map<String, dynamic> json) => _$BbRepoFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbRepoMainbranch {
String? type;
String? name;
BbRepoMainbranch();
factory BbRepoMainbranch.fromJson(Map<String, dynamic> json) =>
_$BbRepoMainbranchFromJson(json);
String? type;
String? name;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbTree {
BbTree({required this.type, required this.path});
factory BbTree.fromJson(Map<String, dynamic> json) => _$BbTreeFromJson(json);
String type;
String path;
int? size;
Map<String, dynamic>? links;
BbTree({required this.type, required this.path});
factory BbTree.fromJson(Map<String, dynamic> json) => _$BbTreeFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbCommit {
BbCommit();
factory BbCommit.fromJson(Map<String, dynamic> json) =>
_$BbCommitFromJson(json);
String? message;
DateTime? date;
String? hash;
BbCommitAuthor? author;
BbCommit();
factory BbCommit.fromJson(Map<String, dynamic> json) =>
_$BbCommitFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbCommitAuthor {
String? raw;
BbRepoOwner? user;
BbCommitAuthor();
factory BbCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$BbCommitAuthorFromJson(json);
String? raw;
BbRepoOwner? user;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbIssues {
BbIssues();
factory BbIssues.fromJson(Map<String, dynamic> json) =>
_$BbIssuesFromJson(json);
String? priority;
String? state;
BbRepo? repository;
@ -103,50 +106,47 @@ class BbIssues {
DateTime? createdOn;
Map<String, dynamic>? links;
String? get issueLink => links!['self']['href'];
BbIssues();
factory BbIssues.fromJson(Map<String, dynamic> json) =>
_$BbIssuesFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbPulls {
BbPulls();
factory BbPulls.fromJson(Map<String, dynamic> json) =>
_$BbPullsFromJson(json);
String? description;
BbRepoOwner? author;
String? title;
Map<String, dynamic>? links;
String? get pullRequestLink => links!['self']['href'];
DateTime? createdOn;
BbPulls();
factory BbPulls.fromJson(Map<String, dynamic> json) =>
_$BbPullsFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbCommentContent {
String? raw;
String? markup;
String? html;
BbCommentContent();
factory BbCommentContent.fromJson(Map<String, dynamic> json) =>
_$BbCommentContentFromJson(json);
String? raw;
String? markup;
String? html;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbComment {
BbComment();
factory BbComment.fromJson(Map<String, dynamic> json) =>
_$BbCommentFromJson(json);
String? createdOn;
String? updatedOn;
BbCommentContent? content;
BbRepoOwner? user;
BbComment();
factory BbComment.fromJson(Map<String, dynamic> json) =>
_$BbCommentFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbBranch {
String? name;
String? type;
BbBranch();
factory BbBranch.fromJson(Map<String, dynamic> json) =>
_$BbBranchFromJson(json);
String? name;
String? type;
}

View File

@ -4,18 +4,21 @@ part 'gitea.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaUser {
GiteaUser();
factory GiteaUser.fromJson(Map<String, dynamic> json) =>
_$GiteaUserFromJson(json);
int? id;
String? login;
String? fullName;
String? avatarUrl;
DateTime? created;
GiteaUser();
factory GiteaUser.fromJson(Map<String, dynamic> json) =>
_$GiteaUserFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaOrg {
GiteaOrg();
factory GiteaOrg.fromJson(Map<String, dynamic> json) =>
_$GiteaOrgFromJson(json);
int? id;
String? username;
String? fullName;
@ -23,13 +26,13 @@ class GiteaOrg {
String? description;
String? website;
String? location;
GiteaOrg();
factory GiteaOrg.fromJson(Map<String, dynamic> json) =>
_$GiteaOrgFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaRepository {
GiteaRepository();
factory GiteaRepository.fromJson(Map<String, dynamic> json) =>
_$GiteaRepositoryFromJson(json);
int? id;
GiteaUser? owner;
String? name;
@ -41,34 +44,34 @@ class GiteaRepository {
int? size;
int? openIssuesCount;
int? openPrCounter;
GiteaRepository();
factory GiteaRepository.fromJson(Map<String, dynamic> json) =>
_$GiteaRepositoryFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaTree {
GiteaTree({required this.type, required this.name});
factory GiteaTree.fromJson(Map<String, dynamic> json) =>
_$GiteaTreeFromJson(json);
String type;
String name;
String? path;
int? size;
String? downloadUrl;
GiteaTree({required this.type, required this.name});
factory GiteaTree.fromJson(Map<String, dynamic> json) =>
_$GiteaTreeFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaBlob extends GiteaTree {
String? content;
GiteaBlob({required String type, required String name})
: super(name: name, type: type);
factory GiteaBlob.fromJson(Map<String, dynamic> json) =>
_$GiteaBlobFromJson(json);
String? content;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaCommit {
GiteaCommit();
factory GiteaCommit.fromJson(Map<String, dynamic> json) =>
_$GiteaCommitFromJson(json);
int? number;
GiteaUser? author;
String? title;
@ -76,33 +79,33 @@ class GiteaCommit {
GiteaCommitDetail? commit;
String? sha;
String? htmlUrl;
GiteaCommit();
factory GiteaCommit.fromJson(Map<String, dynamic> json) =>
_$GiteaCommitFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaCommitDetail {
String? message;
GiteaCommitAuthor? author;
GiteaCommitAuthor? committer;
GiteaCommitDetail();
factory GiteaCommitDetail.fromJson(Map<String, dynamic> json) =>
_$GiteaCommitDetailFromJson(json);
String? message;
GiteaCommitAuthor? author;
GiteaCommitAuthor? committer;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaCommitAuthor {
String? name;
String? email;
DateTime? date;
GiteaCommitAuthor();
factory GiteaCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$GiteaCommitAuthorFromJson(json);
String? name;
String? email;
DateTime? date;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaIssue {
GiteaIssue();
factory GiteaIssue.fromJson(Map<String, dynamic> json) =>
_$GiteaIssueFromJson(json);
String? title;
String? body;
int? number;
@ -112,31 +115,31 @@ class GiteaIssue {
String? state;
String? htmlUrl;
List<GiteaLabel>? labels;
GiteaIssue();
factory GiteaIssue.fromJson(Map<String, dynamic> json) =>
_$GiteaIssueFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaLabel {
String? color;
String? name;
GiteaLabel();
factory GiteaLabel.fromJson(Map<String, dynamic> json) =>
_$GiteaLabelFromJson(json);
String? color;
String? name;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaHeatmapItem {
int? timestamp;
int? contributions;
GiteaHeatmapItem();
factory GiteaHeatmapItem.fromJson(Map<String, dynamic> json) =>
_$GiteaHeatmapItemFromJson(json);
int? timestamp;
int? contributions;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaComment {
GiteaComment();
factory GiteaComment.fromJson(Map<String, dynamic> json) =>
_$GiteaCommentFromJson(json);
String? body;
DateTime? createdAt;
String? htmlUrl;
@ -144,7 +147,4 @@ class GiteaComment {
DateTime? updatedAt;
int? id;
GiteaUser? user;
GiteaComment();
factory GiteaComment.fromJson(Map<String, dynamic> json) =>
_$GiteaCommentFromJson(json);
}

View File

@ -4,6 +4,9 @@ part 'gitee.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeUser {
GiteeUser();
factory GiteeUser.fromJson(Map<String, dynamic> json) =>
_$GiteeUserFromJson(json);
String? login;
String? avatarUrl;
String? name;
@ -16,24 +19,24 @@ class GiteeUser {
int? stared;
int? watched;
DateTime? createdAt;
GiteeUser();
factory GiteeUser.fromJson(Map<String, dynamic> json) =>
_$GiteeUserFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeListUser {
GiteeListUser();
factory GiteeListUser.fromJson(Map<String, dynamic> json) =>
_$GiteeListUserFromJson(json);
String? login;
String? avatarUrl;
String? name;
String? htmlUrl;
GiteeListUser();
factory GiteeListUser.fromJson(Map<String, dynamic> json) =>
_$GiteeListUserFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeRepo {
GiteeRepo();
factory GiteeRepo.fromJson(Map<String, dynamic> json) =>
_$GiteeRepoFromJson(json);
GiteeRepoNamespace? namespace;
GiteeRepoOwner? owner;
String? path;
@ -51,90 +54,90 @@ class GiteeRepo {
int? openIssuesCount;
bool? pullRequestsEnabled;
String? defaultBranch;
GiteeRepo();
factory GiteeRepo.fromJson(Map<String, dynamic> json) =>
_$GiteeRepoFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeRepoOwner {
String? login;
String? avatarUrl;
GiteeRepoOwner();
factory GiteeRepoOwner.fromJson(Map<String, dynamic> json) =>
_$GiteeRepoOwnerFromJson(json);
String? login;
String? avatarUrl;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeRepoNamespace {
String? path;
GiteeRepoNamespace();
factory GiteeRepoNamespace.fromJson(Map<String, dynamic> json) =>
_$GiteeRepoNamespaceFromJson(json);
String? path;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommit {
GiteeCommit();
factory GiteeCommit.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitFromJson(json);
GiteeUser? author;
GiteeCommitDetail? commit;
String? sha;
String? htmlUrl;
List<GiteeCommitFile>? files;
GiteeCommit();
factory GiteeCommit.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommitDetail {
String? message;
GiteeCommitAuthor? author;
GiteeCommitAuthor? committer;
GiteeCommitDetail();
factory GiteeCommitDetail.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitDetailFromJson(json);
String? message;
GiteeCommitAuthor? author;
GiteeCommitAuthor? committer;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommitAuthor {
String? name;
String? email;
DateTime? date;
GiteeCommitAuthor();
factory GiteeCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitAuthorFromJson(json);
String? name;
String? email;
DateTime? date;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeTreeItem {
GiteeTreeItem({required this.path, required this.type});
factory GiteeTreeItem.fromJson(Map<String, dynamic> json) =>
_$GiteeTreeItemFromJson(json);
String path;
String type;
String? sha;
int? size;
GiteeTreeItem({required this.path, required this.type});
factory GiteeTreeItem.fromJson(Map<String, dynamic> json) =>
_$GiteeTreeItemFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeBlob {
String? content;
GiteeBlob();
factory GiteeBlob.fromJson(Map<String, dynamic> json) =>
_$GiteeBlobFromJson(json);
String? content;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeLabel {
String? color;
String? name;
GiteeLabel();
factory GiteeLabel.fromJson(Map<String, dynamic> json) =>
_$GiteeLabelFromJson(json);
String? color;
String? name;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeIssue {
GiteeIssue();
factory GiteeIssue.fromJson(Map<String, dynamic> json) =>
_$GiteeIssueFromJson(json);
int? comments;
String? commentsUrl;
String? createdAt;
@ -149,13 +152,13 @@ class GiteeIssue {
String? number;
List<GiteeLabel>? labels;
int? id;
GiteeIssue();
factory GiteeIssue.fromJson(Map<String, dynamic> json) =>
_$GiteeIssueFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteePull {
GiteePull();
factory GiteePull.fromJson(Map<String, dynamic> json) =>
_$GiteePullFromJson(json);
String? commentsUrl;
String? createdAt;
String? htmlUrl;
@ -168,34 +171,34 @@ class GiteePull {
List<GiteeLabel>? labels;
int? number;
int? id;
GiteePull();
factory GiteePull.fromJson(Map<String, dynamic> json) =>
_$GiteePullFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeComment {
GiteeComment();
factory GiteeComment.fromJson(Map<String, dynamic> json) =>
_$GiteeCommentFromJson(json);
int? id;
String? body;
String? createdAt;
GiteeRepoOwner? user;
GiteeComment();
factory GiteeComment.fromJson(Map<String, dynamic> json) =>
_$GiteeCommentFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteePatch {
String? diff;
GiteePatch();
factory GiteePatch.fromJson(Map<String, dynamic> json) =>
_$GiteePatchFromJson(json);
String? diff;
}
// Two different classes because of variable type mismatch
// for additions, deletions, patch
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteePullFile {
GiteePullFile();
factory GiteePullFile.fromJson(Map<String, dynamic> json) =>
_$GiteePullFileFromJson(json);
String? additions;
String? deletions;
String? blobUrl;
@ -203,13 +206,13 @@ class GiteePullFile {
String? sha;
String? status;
GiteePatch? patch;
GiteePullFile();
factory GiteePullFile.fromJson(Map<String, dynamic> json) =>
_$GiteePullFileFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommitFile {
GiteeCommitFile();
factory GiteeCommitFile.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitFileFromJson(json);
int? additions;
int? deletions;
int? changes;
@ -218,24 +221,21 @@ class GiteeCommitFile {
String? sha;
String? status;
String? patch;
GiteeCommitFile();
factory GiteeCommitFile.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitFileFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeContributor {
String? name;
int? contributions;
GiteeContributor();
factory GiteeContributor.fromJson(Map<String, dynamic> json) =>
_$GiteeContributorFromJson(json);
String? name;
int? contributions;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeBranch {
String? name;
GiteeBranch();
factory GiteeBranch.fromJson(Map<String, dynamic> json) =>
_$GiteeBranchFromJson(json);
String? name;
}

View File

@ -6,6 +6,11 @@ part 'github.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEvent {
GithubEvent();
factory GithubEvent.fromJson(Map<String, dynamic> json) =>
_$GithubEventFromJson(json);
GithubEventUser? actor;
String? type;
GithubEventRepo? repo;
@ -22,36 +27,35 @@ class GithubEvent {
_repo ??= parseRepositoryFullName(repo!.name!);
return _repo!.item2;
}
GithubEvent();
factory GithubEvent.fromJson(Map<String, dynamic> json) =>
_$GithubEventFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventUser {
String? login;
String? avatarUrl;
GithubEventUser();
factory GithubEventUser.fromJson(Map<String, dynamic> json) =>
_$GithubEventUserFromJson(json);
String? login;
String? avatarUrl;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventRepo {
String? name;
GithubEventRepo();
factory GithubEventRepo.fromJson(Map<String, dynamic> json) =>
_$GithubEventRepoFromJson(json);
String? name;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventPayload {
GithubEventPayload();
factory GithubEventPayload.fromJson(Map<String, dynamic> json) =>
_$GithubEventPayloadFromJson(json);
GithubEventIssue? issue;
GithubEventIssue? pullRequest;
GithubEventComment? comment;
@ -72,14 +76,15 @@ class GithubEventPayload {
GithubCheckrunItem? checkRun;
GithubCheckSuiteItem? checkSuite;
GithubContentReferenceItem? contentReference;
GithubEventPayload();
factory GithubEventPayload.fromJson(Map<String, dynamic> json) =>
_$GithubEventPayloadFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventIssue {
GithubEventIssue();
factory GithubEventIssue.fromJson(Map<String, dynamic> json) =>
_$GithubEventIssueFromJson(json);
String? title;
GithubEventUser? user;
int? number;
@ -91,51 +96,51 @@ class GithubEventIssue {
DateTime? createdAt;
bool get isPullRequestComment => pullRequest != null;
GithubEventIssue();
factory GithubEventIssue.fromJson(Map<String, dynamic> json) =>
_$GithubEventIssueFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventComment {
String? body;
GithubEventUser? user;
String? commitId;
String? htmlUrl;
GithubEventComment();
factory GithubEventComment.fromJson(Map<String, dynamic> json) =>
_$GithubEventCommentFromJson(json);
String? body;
GithubEventUser? user;
String? commitId;
String? htmlUrl;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventCommit {
String? sha;
String? message;
GithubEventCommit();
factory GithubEventCommit.fromJson(Map<String, dynamic> json) =>
_$GithubEventCommitFromJson(json);
String? sha;
String? message;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventRelease {
String? htmlUrl;
String? tagName;
GithubEventRelease();
factory GithubEventRelease.fromJson(Map<String, dynamic> json) =>
_$GithubEventReleaseFromJson(json);
String? htmlUrl;
String? tagName;
}
// Notification
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubNotificationItem {
GithubNotificationItem();
factory GithubNotificationItem.fromJson(Map<String, dynamic> json) =>
_$GithubNotificationItemFromJson(json);
String? id;
GithubNotificationItemSubject? subject;
DateTime? updatedAt;
@ -146,15 +151,15 @@ class GithubNotificationItem {
String? state;
String get key => '_$hashCode';
GithubNotificationItem();
factory GithubNotificationItem.fromJson(Map<String, dynamic> json) =>
_$GithubNotificationItemFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubNotificationItemSubject {
GithubNotificationItemSubject();
factory GithubNotificationItemSubject.fromJson(Map<String, dynamic> json) =>
_$GithubNotificationItemSubjectFromJson(json);
String? title;
String? type;
String? url;
@ -164,15 +169,15 @@ class GithubNotificationItemSubject {
_number ??= int.parse(url?.split('/').last ?? '0');
return _number;
}
GithubNotificationItemSubject();
factory GithubNotificationItemSubject.fromJson(Map<String, dynamic> json) =>
_$GithubNotificationItemSubjectFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubNotificationItemRepo {
GithubNotificationItemRepo();
factory GithubNotificationItemRepo.fromJson(Map<String, dynamic> json) =>
_$GithubNotificationItemRepoFromJson(json);
String? fullName;
Tuple2<String, String>? _repo;
@ -185,137 +190,132 @@ class GithubNotificationItemRepo {
_repo ??= parseRepositoryFullName(fullName!);
return _repo!.item2;
}
GithubNotificationItemRepo();
factory GithubNotificationItemRepo.fromJson(Map<String, dynamic> json) =>
_$GithubNotificationItemRepoFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubTreeItem {
GithubTreeItem();
factory GithubTreeItem.fromJson(Map<String, dynamic> json) =>
_$GithubTreeItemFromJson(json);
String? name;
String? path;
int? size;
String? type;
String? downloadUrl;
String? content;
GithubTreeItem();
factory GithubTreeItem.fromJson(Map<String, dynamic> json) =>
_$GithubTreeItemFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubPagesItem {
String? pageName;
String? title;
String? action;
GithubPagesItem();
factory GithubPagesItem.fromJson(Map<String, dynamic> json) =>
_$GithubPagesItemFromJson(json);
String? pageName;
String? title;
String? action;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubSecurityItem {
String? summary;
String? description;
String? severity;
GithubSecurityItem();
factory GithubSecurityItem.fromJson(Map<String, dynamic> json) =>
_$GithubSecurityItemFromJson(json);
String? summary;
String? description;
String? severity;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubAlertItem {
String? affectedPackageName;
String? affectedRange;
GithubAlertItem();
factory GithubAlertItem.fromJson(Map<String, dynamic> json) =>
_$GithubAlertItemFromJson(json);
String? affectedPackageName;
String? affectedRange;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubProjectItem {
GithubProjectItem();
factory GithubProjectItem.fromJson(Map<String, dynamic> json) =>
_$GithubProjectItemFromJson(json);
String? name;
String? state;
String? body;
String? htmlUrl;
GithubProjectItem();
factory GithubProjectItem.fromJson(Map<String, dynamic> json) =>
_$GithubProjectItemFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubProjectColumnItem {
String? htmlUrl;
String? columnsUrl;
String? name;
GithubProjectColumnItem();
factory GithubProjectColumnItem.fromJson(Map<String, dynamic> json) =>
_$GithubProjectColumnItemFromJson(json);
String? htmlUrl;
String? columnsUrl;
String? name;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubInstallationRepositoriesItem {
List<GithubNotificationItemRepo>? repositoriesAdded, repositoriesRemoved;
String? repositoriesSelection;
int? id;
GithubInstallationRepositoriesItem();
factory GithubInstallationRepositoriesItem.fromJson(
Map<String, dynamic> json) =>
_$GithubInstallationRepositoriesItemFromJson(json);
List<GithubNotificationItemRepo>? repositoriesAdded, repositoriesRemoved;
String? repositoriesSelection;
int? id;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubCheckrunItem {
String? status;
String? name;
int? id;
GithubCheckrunItem();
factory GithubCheckrunItem.fromJson(Map<String, dynamic> json) =>
_$GithubCheckrunItemFromJson(json);
String? status;
String? name;
int? id;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubCheckSuiteItem {
String? status;
String? conclusion;
GithubCheckSuiteItem();
factory GithubCheckSuiteItem.fromJson(Map<String, dynamic> json) =>
_$GithubCheckSuiteItemFromJson(json);
String? status;
String? conclusion;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubContentReferenceItem {
int? id;
String? reference;
GithubContentReferenceItem();
factory GithubContentReferenceItem.fromJson(Map<String, dynamic> json) =>
_$GithubContentReferenceItemFromJson(json);
int? id;
String? reference;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubContributorItem {
GithubContributorItem();
factory GithubContributorItem.fromJson(Map<String, dynamic> json) =>
_$GithubContributorItemFromJson(json);
int? id;
String? login;
String? avatarUrl;
String? htmlUrl;
int? contributions;
GithubContributorItem();
factory GithubContributorItem.fromJson(Map<String, dynamic> json) =>
_$GithubContributorItemFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubUserOrganizationItem {
GithubUserOrganizationItem();
factory GithubUserOrganizationItem.fromJson(Map<String, dynamic> json) =>
_$GithubUserOrganizationItemFromJson(json);
int? id;
String? login;
String? avatarUrl;
String? description;
String? url;
GithubUserOrganizationItem();
factory GithubUserOrganizationItem.fromJson(Map<String, dynamic> json) =>
_$GithubUserOrganizationItemFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
@ -329,6 +329,9 @@ class GistFiles {
this.truncated,
this.content,
});
factory GistFiles.fromJson(Map<String, dynamic> json) =>
_$GistFilesFromJson(json);
String? filename;
int? size;
String? rawUrl;
@ -336,13 +339,14 @@ class GistFiles {
String? language;
bool? truncated;
String? content;
factory GistFiles.fromJson(Map<String, dynamic> json) =>
_$GistFilesFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubGistsItem {
GithubGistsItem();
factory GithubGistsItem.fromJson(Map<String, dynamic> json) =>
_$GithubGistsItemFromJson(json);
String? id;
String? description;
bool? public;
@ -358,32 +362,28 @@ class GithubGistsItem {
DateTime? createdAt;
DateTime? updatedAt;
GithubGistsItem();
factory GithubGistsItem.fromJson(Map<String, dynamic> json) =>
_$GithubGistsItemFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubFilesItem {
GithubFilesItem();
factory GithubFilesItem.fromJson(Map<String, dynamic> json) =>
_$GithubFilesItemFromJson(json);
String? filename;
String? status;
int? additions;
int? deletions;
int? changes;
String? patch;
GithubFilesItem();
factory GithubFilesItem.fromJson(Map<String, dynamic> json) =>
_$GithubFilesItemFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubComparisonItem {
GithubComparisonItem();
factory GithubComparisonItem.fromJson(Map<String, dynamic> json) =>
_$GithubComparisonItemFromJson(json);
List<GithubFilesItem>? files;
String? status;
int? aheadBy;
int? behindBy;
GithubComparisonItem();
factory GithubComparisonItem.fromJson(Map<String, dynamic> json) =>
_$GithubComparisonItemFromJson(json);
}

View File

@ -4,6 +4,9 @@ part 'gitlab.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabUser {
GitlabUser();
factory GitlabUser.fromJson(Map<String, dynamic> json) =>
_$GitlabUserFromJson(json);
int? id;
String? username;
String? name;
@ -11,70 +14,70 @@ class GitlabUser {
String? bio;
DateTime? createdAt;
int? accessLevel;
GitlabUser();
factory GitlabUser.fromJson(Map<String, dynamic> json) =>
_$GitlabUserFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabGroup {
GitlabGroup();
factory GitlabGroup.fromJson(Map<String, dynamic> json) =>
_$GitlabGroupFromJson(json);
int? id;
String? path;
String? name;
String? avatarUrl;
String? description;
List<GitlabProject>? projects;
GitlabGroup();
factory GitlabGroup.fromJson(Map<String, dynamic> json) =>
_$GitlabGroupFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTodoProject {
String? pathWithNamespace;
GitlabTodoProject();
factory GitlabTodoProject.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoProjectFromJson(json);
String? pathWithNamespace;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTodo {
GitlabTodo();
factory GitlabTodo.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoFromJson(json);
GitlabUser? author;
GitlabTodoProject? project;
String? actionName;
String? targetType;
GitlabTodoTarget? target;
GitlabTodo();
factory GitlabTodo.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTodoTarget {
GitlabTodoTarget();
factory GitlabTodoTarget.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoTargetFromJson(json);
int? iid;
int? projectId;
String? title;
GitlabUser? author;
String? description;
DateTime? createdAt;
GitlabTodoTarget();
factory GitlabTodoTarget.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoTargetFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabIssueNote {
GitlabIssueNote();
factory GitlabIssueNote.fromJson(Map<String, dynamic> json) =>
_$GitlabIssueNoteFromJson(json);
GitlabUser? author;
String? body;
bool? system;
DateTime? createdAt;
GitlabIssueNote();
factory GitlabIssueNote.fromJson(Map<String, dynamic> json) =>
_$GitlabIssueNoteFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProject {
GitlabProject();
factory GitlabProject.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectFromJson(json);
int? id;
String? name;
String? avatarUrl;
@ -93,103 +96,103 @@ class GitlabProject {
DateTime? lastActivityAt;
DateTime? createdAt;
String? defaultBranch;
GitlabProject();
factory GitlabProject.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProjectBadge {
String? renderedImageUrl;
GitlabProjectBadge();
factory GitlabProjectBadge.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectBadgeFromJson(json);
String? renderedImageUrl;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProjectStatistics {
int? commitCount;
int? repositorySize;
GitlabProjectStatistics();
factory GitlabProjectStatistics.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectStatisticsFromJson(json);
int? commitCount;
int? repositorySize;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProjectNamespace {
GitlabProjectNamespace();
factory GitlabProjectNamespace.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectNamespaceFromJson(json);
int? id;
String? name;
String? path;
String? kind;
GitlabProjectNamespace();
factory GitlabProjectNamespace.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectNamespaceFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTreeItem {
String type;
String path;
String name;
GitlabTreeItem({required this.type, required this.path, required this.name});
factory GitlabTreeItem.fromJson(Map<String, dynamic> json) =>
_$GitlabTreeItemFromJson(json);
String type;
String path;
String name;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabBlob {
String? content;
GitlabBlob();
factory GitlabBlob.fromJson(Map<String, dynamic> json) =>
_$GitlabBlobFromJson(json);
String? content;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabEvent {
GitlabEvent();
factory GitlabEvent.fromJson(Map<String, dynamic> json) =>
_$GitlabEventFromJson(json);
GitlabUser? author;
String? actionName;
String? targetType;
GitlabEventNote? note;
GitlabEvent();
factory GitlabEvent.fromJson(Map<String, dynamic> json) =>
_$GitlabEventFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabEventNote {
String? body;
String? noteableType;
int? noteableIid;
GitlabEventNote();
factory GitlabEventNote.fromJson(Map<String, dynamic> json) =>
_$GitlabEventNoteFromJson(json);
String? body;
String? noteableType;
int? noteableIid;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabCommit {
GitlabCommit();
factory GitlabCommit.fromJson(Map<String, dynamic> json) =>
_$GitlabCommitFromJson(json);
String? id;
String? shortId;
String? title;
DateTime? createdAt;
String? authorName;
String? message;
GitlabCommit();
factory GitlabCommit.fromJson(Map<String, dynamic> json) =>
_$GitlabCommitFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabDiff {
String? diff;
String? newPath;
String? oldPath;
GitlabDiff();
factory GitlabDiff.fromJson(Map<String, dynamic> json) =>
_$GitlabDiffFromJson(json);
String? diff;
String? newPath;
String? oldPath;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabIssue {
GitlabIssue();
factory GitlabIssue.fromJson(Map<String, dynamic> json) =>
_$GitlabIssueFromJson(json);
String? title;
int? iid;
int? projectId;
@ -197,25 +200,22 @@ class GitlabIssue {
int? userNotesCount;
DateTime? updatedAt;
List<String>? labels;
GitlabIssue();
factory GitlabIssue.fromJson(Map<String, dynamic> json) =>
_$GitlabIssueFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabStarrer {
DateTime? starredSince;
GitlabUser? user;
GitlabStarrer();
factory GitlabStarrer.fromJson(Map<String, dynamic> json) =>
_$GitlabStarrerFromJson(json);
DateTime? starredSince;
GitlabUser? user;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabBranch {
String? name;
bool? merged;
GitlabBranch();
factory GitlabBranch.fromJson(Map<String, dynamic> json) =>
_$GitlabBranchFromJson(json);
String? name;
bool? merged;
}

View File

@ -4,18 +4,21 @@ part 'gogs.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsUser {
GogsUser();
factory GogsUser.fromJson(Map<String, dynamic> json) =>
_$GogsUserFromJson(json);
int? id;
String? username;
String? fullName;
String? avatarUrl;
String? email;
GogsUser();
factory GogsUser.fromJson(Map<String, dynamic> json) =>
_$GogsUserFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsRepository {
GogsRepository();
factory GogsRepository.fromJson(Map<String, dynamic> json) =>
_$GogsRepositoryFromJson(json);
int? id;
String? fullName;
bool? private;
@ -29,13 +32,13 @@ class GogsRepository {
int? forksCount;
String? website;
int? watchersCount;
GogsRepository();
factory GogsRepository.fromJson(Map<String, dynamic> json) =>
_$GogsRepositoryFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsOrg {
GogsOrg();
factory GogsOrg.fromJson(Map<String, dynamic> json) =>
_$GogsOrgFromJson(json);
int? id;
String? username;
String? fullName;
@ -43,73 +46,73 @@ class GogsOrg {
String? description;
String? location;
String? website;
GogsOrg();
factory GogsOrg.fromJson(Map<String, dynamic> json) =>
_$GogsOrgFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsTree {
GogsTree({required this.type, required this.name});
factory GogsTree.fromJson(Map<String, dynamic> json) =>
_$GogsTreeFromJson(json);
String type;
String name;
String? path;
int? size;
String? downloadUrl;
GogsTree({required this.type, required this.name});
factory GogsTree.fromJson(Map<String, dynamic> json) =>
_$GogsTreeFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsBlob extends GogsTree {
String? content;
GogsBlob({required String type, required String name})
: super(name: name, type: type);
factory GogsBlob.fromJson(Map<String, dynamic> json) =>
_$GogsBlobFromJson(json);
String? content;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsBranch {
String? name;
GogsBranch();
factory GogsBranch.fromJson(Map<String, dynamic> json) =>
_$GogsBranchFromJson(json);
String? name;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsCommit {
GogsCommit();
factory GogsCommit.fromJson(Map<String, dynamic> json) =>
_$GogsCommitFromJson(json);
GogsUser? author;
GogsCommitDetail? commit;
String? sha;
String? htmlUrl;
GogsCommit();
factory GogsCommit.fromJson(Map<String, dynamic> json) =>
_$GogsCommitFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsCommitDetail {
String? message;
GogsCommitAuthor? author;
GogsCommitAuthor? committer;
GogsCommitDetail();
factory GogsCommitDetail.fromJson(Map<String, dynamic> json) =>
_$GogsCommitDetailFromJson(json);
String? message;
GogsCommitAuthor? author;
GogsCommitAuthor? committer;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsCommitAuthor {
String? name;
String? email;
DateTime? date;
GogsCommitAuthor();
factory GogsCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$GogsCommitAuthorFromJson(json);
String? name;
String? email;
DateTime? date;
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsIssue {
GogsIssue();
factory GogsIssue.fromJson(Map<String, dynamic> json) =>
_$GogsIssueFromJson(json);
int? number;
String? state;
String? title;
@ -119,16 +122,13 @@ class GogsIssue {
DateTime? createdAt;
DateTime? updatedAt;
int? comments;
GogsIssue();
factory GogsIssue.fromJson(Map<String, dynamic> json) =>
_$GogsIssueFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsLabel {
String? name;
String? color;
GogsLabel();
factory GogsLabel.fromJson(Map<String, dynamic> json) =>
_$GogsLabelFromJson(json);
String? name;
String? color;
}

View File

@ -5,6 +5,8 @@ import 'package:tuple/tuple.dart';
import 'package:git_touch/utils/utils.dart';
class NotificationGroup {
NotificationGroup(this.fullName);
String? fullName;
List<GithubNotificationItem> items = [];
@ -20,8 +22,6 @@ class NotificationGroup {
}
String get key => '_$hashCode';
NotificationGroup(this.fullName);
}
class NotificationModel with ChangeNotifier {

View File

@ -30,16 +30,12 @@ class AppMarkdownType {
}
class PickerItem<T> {
PickerItem(this.value, {required this.text});
final T value;
final String? text;
PickerItem(this.value, {required this.text});
}
class PickerGroupItem<T> {
final T value;
final List<PickerItem<T>> items;
final Function(T value)? onChange;
final Function(T value)? onClose;
PickerGroupItem({
required this.value,
@ -47,18 +43,21 @@ class PickerGroupItem<T> {
this.onChange,
this.onClose,
});
final T value;
final List<PickerItem<T>> items;
final Function(T value)? onChange;
final Function(T value)? onClose;
}
class SelectorItem<T> {
SelectorItem({required this.value, required this.text});
T value;
String text;
SelectorItem({required this.value, required this.text});
}
// No animation. For replacing route
// TODO: Go back
class StaticRoute extends PageRouteBuilder {
final WidgetBuilder? builder;
StaticRoute({this.builder})
: super(
pageBuilder: (BuildContext context, Animation<double> animation,
@ -72,16 +71,10 @@ class StaticRoute extends PageRouteBuilder {
return child;
},
);
final WidgetBuilder? builder;
}
class Palette {
final Color primary;
final Color text;
final Color secondaryText;
final Color tertiaryText;
final Color background;
final Color grayBackground;
final Color border;
const Palette({
required this.primary,
@ -92,6 +85,13 @@ class Palette {
required this.grayBackground,
required this.border,
});
final Color primary;
final Color text;
final Color secondaryText;
final Color tertiaryText;
final Color background;
final Color grayBackground;
final Color border;
}
class ThemeModel with ChangeNotifier {

View File

@ -3,15 +3,15 @@ import 'package:git_touch/models/theme.dart';
import 'package:provider/provider.dart';
class CommonScaffold extends StatelessWidget {
final Widget title;
final Widget body;
final Widget? action;
const CommonScaffold({
required this.title,
required this.body,
this.action,
});
final Widget title;
final Widget body;
final Widget? action;
@override
Widget build(BuildContext context) {

View File

@ -9,10 +9,6 @@ export 'package:git_touch/utils/utils.dart';
// This is a scaffold for infinite scroll screens
class ListStatefulScaffold<T, K> extends StatefulWidget {
final Widget title;
final Widget Function()? actionBuilder;
final Widget Function(T payload) itemBuilder;
final Future<ListPayload<T, K>> Function(K? cursor) fetch;
const ListStatefulScaffold({
required this.title,
@ -20,6 +16,10 @@ class ListStatefulScaffold<T, K> extends StatefulWidget {
required this.itemBuilder,
this.actionBuilder,
});
final Widget title;
final Widget Function()? actionBuilder;
final Widget Function(T payload) itemBuilder;
final Future<ListPayload<T, K>> Function(K? cursor) fetch;
@override
_ListStatefulScaffoldState<T, K> createState() =>

View File

@ -8,11 +8,6 @@ import 'package:git_touch/widgets/link.dart';
import 'package:git_touch/widgets/loading.dart';
class LongListPayload<T, K> {
T header;
int totalCount;
String? cursor;
List<K> leadingItems;
List<K>? trailingItems;
LongListPayload({
required this.header,
@ -21,6 +16,11 @@ class LongListPayload<T, K> {
required this.leadingItems,
this.trailingItems,
});
T header;
int totalCount;
String? cursor;
List<K> leadingItems;
List<K>? trailingItems;
}
// This is a scaffold for issue and pull request
@ -28,12 +28,6 @@ class LongListPayload<T, K> {
// We should load leading and trailing items at first fetching, and do load more in the middle
// e.g. https://github.com/reactjs/rfcs/pull/68
class LongListStatefulScaffold<T, K> extends StatefulWidget {
final Widget title;
final Widget Function(T t)? trailingBuilder;
final Widget Function(T t) headerBuilder;
final Widget Function(K k) itemBuilder;
final Future<LongListPayload<T, K>> Function() onRefresh;
final Future<LongListPayload<T, K>> Function(String? cursor) onLoadMore;
const LongListStatefulScaffold({
required this.title,
@ -43,6 +37,12 @@ class LongListStatefulScaffold<T, K> extends StatefulWidget {
required this.onRefresh,
required this.onLoadMore,
});
final Widget title;
final Widget Function(T t)? trailingBuilder;
final Widget Function(T t) headerBuilder;
final Widget Function(K k) itemBuilder;
final Future<LongListPayload<T, K>> Function() onRefresh;
final Future<LongListPayload<T, K>> Function(String? cursor) onLoadMore;
@override
_LongListStatefulScaffoldState<T, K> createState() =>

View File

@ -4,13 +4,6 @@ import 'package:git_touch/scaffolds/common.dart';
import 'package:git_touch/scaffolds/utils.dart';
class RefreshStatefulScaffold<T> extends StatefulWidget {
final Widget title;
final Widget? Function(T data, void Function(T newData) setData) bodyBuilder;
final Future<T> Function() fetch;
final Widget? Function(T data, void Function(T newData) setData)?
actionBuilder;
final Widget? action;
final canRefresh;
const RefreshStatefulScaffold({
required this.title,
@ -20,6 +13,13 @@ class RefreshStatefulScaffold<T> extends StatefulWidget {
this.action,
this.canRefresh = true,
}) : assert(actionBuilder == null || action == null);
final Widget title;
final Widget? Function(T data, void Function(T newData) setData) bodyBuilder;
final Future<T> Function() fetch;
final Widget? Function(T data, void Function(T newData) setData)?
actionBuilder;
final Widget? action;
final canRefresh;
@override
_RefreshStatefulScaffoldState<T> createState() =>

View File

@ -2,15 +2,15 @@ import 'package:flutter/cupertino.dart';
import 'package:git_touch/scaffolds/common.dart';
class SingleScaffold extends StatelessWidget {
final Widget title;
final Widget body;
final Widget? action;
const SingleScaffold({
required this.title,
required this.body,
this.action,
});
final Widget title;
final Widget body;
final Widget? action;
@override
Widget build(BuildContext context) {

View File

@ -3,13 +3,6 @@ import 'package:git_touch/scaffolds/common.dart';
import 'package:git_touch/scaffolds/utils.dart';
class TabScaffold extends StatelessWidget {
final Widget title;
final Widget body;
final Widget? action;
final void Function() onRefresh;
final List<String> tabs;
final int activeTab;
final Function(int index) onTabSwitch;
const TabScaffold({
required this.title,
@ -20,6 +13,13 @@ class TabScaffold extends StatelessWidget {
required this.activeTab,
required this.onTabSwitch,
});
final Widget title;
final Widget body;
final Widget? action;
final void Function() onRefresh;
final List<String> tabs;
final int activeTab;
final Function(int index) onTabSwitch;
@override
Widget build(BuildContext context) {

View File

@ -4,11 +4,6 @@ import 'package:git_touch/scaffolds/tab.dart';
import 'package:git_touch/scaffolds/utils.dart';
class TabStatefulScaffold<T> extends StatefulWidget {
final Widget title;
final Widget Function(T payload, int activeTab) bodyBuilder;
final Future<T> Function(int activeTab) fetchData;
final List<String> tabs;
final Widget Function(T payload, void Function() refresh)? actionBuilder;
const TabStatefulScaffold({
required this.title,
@ -17,6 +12,11 @@ class TabStatefulScaffold<T> extends StatefulWidget {
required this.tabs,
this.actionBuilder,
});
final Widget title;
final Widget Function(T payload, int activeTab) bodyBuilder;
final Future<T> Function(int activeTab) fetchData;
final List<String> tabs;
final Widget Function(T payload, void Function() refresh)? actionBuilder;
@override
_TabStatefulScaffoldState<T> createState() => _TabStatefulScaffoldState();

View File

@ -3,13 +3,13 @@ import 'package:git_touch/widgets/error_reload.dart';
import 'package:git_touch/widgets/loading.dart';
class RefreshWrapper extends StatelessWidget {
final Widget body;
final void Function() onRefresh;
const RefreshWrapper({
required this.onRefresh,
required this.body,
});
final Widget body;
final void Function() onRefresh;
@override
Widget build(BuildContext context) {
@ -26,10 +26,6 @@ class RefreshWrapper extends StatelessWidget {
}
class ErrorLoadingWrapper extends StatelessWidget {
final String error;
final bool loading;
final void Function() reload;
final Widget? Function() bodyBuilder;
const ErrorLoadingWrapper({
required this.error,
@ -37,6 +33,10 @@ class ErrorLoadingWrapper extends StatelessWidget {
required this.reload,
required this.bodyBuilder,
});
final String error;
final bool loading;
final void Function() reload;
final Widget? Function() bodyBuilder;
@override
Widget build(BuildContext context) {

View File

@ -8,10 +8,10 @@ import 'package:git_touch/widgets/commit_item.dart';
import 'package:provider/provider.dart';
class BbCommitsScreen extends StatelessWidget {
const BbCommitsScreen(this.owner, this.name, this.ref);
final String owner;
final String name;
final String ref;
const BbCommitsScreen(this.owner, this.name, this.ref);
@override
Widget build(BuildContext context) {

View File

@ -13,13 +13,13 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class BbIssueScreen extends StatelessWidget {
const BbIssueScreen(this.owner, this.name, this.number, {this.isPr = false});
final String owner;
final String name;
final String number;
final bool isPr;
const BbIssueScreen(this.owner, this.name, this.number, {this.isPr = false});
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<Tuple2<BbIssues, Iterable<BbComment>>>(

View File

@ -7,10 +7,10 @@ import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class BbIssueCommentScreen extends StatefulWidget {
const BbIssueCommentScreen(this.owner, this.name, this.number);
final String owner;
final String name;
final String number;
const BbIssueCommentScreen(this.owner, this.name, this.number);
@override
_BbIssueCommentScreenState createState() => _BbIssueCommentScreenState();

View File

@ -8,9 +8,9 @@ import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class BbIssueFormScreen extends StatefulWidget {
const BbIssueFormScreen(this.owner, this.name);
final String owner;
final String name;
const BbIssueFormScreen(this.owner, this.name);
@override
_BbIssueFormScreenState createState() => _BbIssueFormScreenState();

View File

@ -9,9 +9,9 @@ import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart';
class BbIssuesScreen extends StatelessWidget {
const BbIssuesScreen(this.owner, this.name);
final String owner;
final String name;
const BbIssuesScreen(this.owner, this.name);
@override
Widget build(BuildContext context) {

View File

@ -14,11 +14,11 @@ import 'package:provider/provider.dart';
import 'package:universal_io/io.dart';
class BbObjectScreen extends StatelessWidget {
const BbObjectScreen(this.owner, this.name, this.ref, {this.path});
final String owner;
final String name;
final String ref;
final String? path;
const BbObjectScreen(this.owner, this.name, this.ref, {this.path});
@override
Widget build(BuildContext context) {

View File

@ -8,9 +8,9 @@ import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart';
class BbPullsScreen extends StatelessWidget {
const BbPullsScreen(this.owner, this.name);
final String owner;
final String name;
const BbPullsScreen(this.owner, this.name);
@override
Widget build(BuildContext context) {

View File

@ -17,10 +17,10 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class BbRepoScreen extends StatelessWidget {
const BbRepoScreen(this.owner, this.name, {this.branch});
final String owner;
final String name;
final String? branch;
const BbRepoScreen(this.owner, this.name, {this.branch});
@override
Widget build(BuildContext context) {

View File

@ -10,9 +10,9 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class BbUserScreen extends StatelessWidget {
const BbUserScreen(this.login, {this.isTeam = false});
final String? login;
final bool isTeam;
const BbUserScreen(this.login, {this.isTeam = false});
bool get isViewer => login == null;
@override

View File

@ -10,11 +10,11 @@ import 'package:git_touch/widgets/blob_view.dart';
import 'package:provider/provider.dart';
class GeBlobScreen extends StatelessWidget {
const GeBlobScreen(this.owner, this.name, this.sha, this.path);
final String owner;
final String name;
final String sha;
final String path;
const GeBlobScreen(this.owner, this.name, this.sha, this.path);
@override
Widget build(BuildContext context) {

View File

@ -11,10 +11,10 @@ import 'package:git_touch/widgets/link.dart';
import 'package:provider/provider.dart';
class GeCommitScreen extends StatelessWidget {
const GeCommitScreen(this.owner, this.name, this.sha);
final String owner;
final String name;
final String sha;
const GeCommitScreen(this.owner, this.name, this.sha);
@override
Widget build(BuildContext context) {

View File

@ -8,10 +8,10 @@ import 'package:git_touch/widgets/commit_item.dart';
import 'package:provider/provider.dart';
class GeCommitsScreen extends StatelessWidget {
const GeCommitsScreen(this.owner, this.name, {this.branch});
final String owner;
final String name;
final String? branch;
const GeCommitsScreen(this.owner, this.name, {this.branch});
@override
Widget build(BuildContext context) {

View File

@ -9,9 +9,9 @@ import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:provider/provider.dart';
class GeContributorsScreen extends StatelessWidget {
const GeContributorsScreen(this.owner, this.name);
final String owner;
final String name;
const GeContributorsScreen(this.owner, this.name);
@override
Widget build(BuildContext context) {

View File

@ -10,10 +10,10 @@ import 'package:git_touch/widgets/files_item.dart';
import 'package:provider/provider.dart';
class GeFilesScreen extends StatelessWidget {
const GeFilesScreen(this.owner, this.name, this.pullNumber);
final String owner;
final String name;
final String pullNumber;
const GeFilesScreen(this.owner, this.name, this.pullNumber);
@override
Widget build(BuildContext context) {

View File

@ -14,13 +14,13 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class GeIssueScreen extends StatelessWidget {
const GeIssueScreen(this.owner, this.name, this.number, {this.isPr = false});
final String owner;
final String name;
final String number;
final bool isPr;
const GeIssueScreen(this.owner, this.name, this.number, {this.isPr = false});
List<ActionItem> _buildCommentActionItem(
BuildContext context, GiteeComment comment) {
final auth = context.read<AuthModel>();

View File

@ -7,14 +7,14 @@ import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class GeIssueCommentScreen extends StatefulWidget {
const GeIssueCommentScreen(this.owner, this.name, this.number,
{this.isPr = false, this.body = '', this.id = ''});
final String owner;
final String name;
final String number;
final bool isPr;
final String body;
final String id;
const GeIssueCommentScreen(this.owner, this.name, this.number,
{this.isPr = false, this.body = '', this.id = ''});
@override
_GeIssueCommentScreenState createState() => _GeIssueCommentScreenState();

View File

@ -8,9 +8,9 @@ import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class GeIssueFormScreen extends StatefulWidget {
const GeIssueFormScreen(this.owner, this.name);
final String owner;
final String name;
const GeIssueFormScreen(this.owner, this.name);
@override
_GeIssueFormScreenState createState() => _GeIssueFormScreenState();

View File

@ -9,10 +9,10 @@ import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart';
class GeIssuesScreen extends StatelessWidget {
const GeIssuesScreen(this.owner, this.name, {this.isPr = false});
final String owner;
final String name;
final bool isPr;
const GeIssuesScreen(this.owner, this.name, {this.isPr = false});
@override
Widget build(BuildContext context) {

View File

@ -14,13 +14,13 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class GePullScreen extends StatelessWidget {
const GePullScreen(this.owner, this.name, this.number, {this.isPr = false});
final String owner;
final String name;
final String number;
final bool isPr;
const GePullScreen(this.owner, this.name, this.number, {this.isPr = false});
List<ActionItem> _buildCommentActionItem(
BuildContext context, GiteeComment comment) {
final auth = context.read<AuthModel>();

View File

@ -8,10 +8,10 @@ import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart';
class GePullsScreen extends StatelessWidget {
const GePullsScreen(this.owner, this.name, {this.isPr = false});
final String owner;
final String name;
final bool isPr;
const GePullsScreen(this.owner, this.name, {this.isPr = false});
@override
Widget build(BuildContext context) {

View File

@ -20,16 +20,16 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class StatusPayload {
StatusPayload(this.isWatching, this.isStarred);
bool isWatching;
bool isStarred;
StatusPayload(this.isWatching, this.isStarred);
}
class GeRepoScreen extends StatelessWidget {
const GeRepoScreen(this.owner, this.name, {this.branch});
final String owner;
final String name;
final String? branch;
const GeRepoScreen(this.owner, this.name, {this.branch});
@override
Widget build(BuildContext context) {

View File

@ -8,8 +8,6 @@ import 'package:provider/provider.dart';
import 'package:timeago/timeago.dart' as timeago;
class GeReposScreen extends StatelessWidget {
final String api;
final String title;
const GeReposScreen(String owner)
: api = '/users/$owner/repos',
@ -20,6 +18,8 @@ class GeReposScreen extends StatelessWidget {
const GeReposScreen.forks(String owner, String name)
: api = '/repos/$owner/$name/forks',
title = 'Forks';
final String api;
final String title;
@override
Widget build(BuildContext context) {

View File

@ -11,10 +11,10 @@ import 'package:git_touch/widgets/object_tree.dart';
import 'package:provider/provider.dart';
class GeTreeScreen extends StatelessWidget {
const GeTreeScreen(this.owner, this.name, this.sha);
final String owner;
final String name;
final String sha;
const GeTreeScreen(this.owner, this.name, this.sha);
@override
Widget build(BuildContext context) {

View File

@ -15,9 +15,9 @@ import 'package:timeago/timeago.dart' as timeago;
import 'package:tuple/tuple.dart';
class GeUserScreen extends StatelessWidget {
const GeUserScreen(this.login, {this.isViewer = false});
final String login;
final bool isViewer;
const GeUserScreen(this.login, {this.isViewer = false});
@override
Widget build(BuildContext context) {

View File

@ -7,8 +7,6 @@ import 'package:git_touch/widgets/user_item.dart';
import 'package:provider/provider.dart';
class GeUsersScreen extends StatelessWidget {
final String api;
final String title;
const GeUsersScreen.followers(String login)
: api = '/users/$login/followers',
@ -25,6 +23,8 @@ class GeUsersScreen extends StatelessWidget {
const GeUsersScreen.watchers(String owner, String repo)
: api = '/repos/$owner/$repo/subscribers',
title = 'Watchers';
final String api;
final String title;
@override
Widget build(BuildContext context) {

View File

@ -12,10 +12,10 @@ import 'package:git_touch/widgets/commit_item.dart';
import 'package:provider/provider.dart';
class GhCommits extends StatelessWidget {
const GhCommits(this.owner, this.name, {this.branch});
final String owner;
final String name;
final String? branch;
const GhCommits(this.owner, this.name, {this.branch});
Widget _buildStatus(GStatusState? state) {
const size = 18.0;

View File

@ -10,11 +10,11 @@ import 'package:git_touch/widgets/files_item.dart';
import 'package:provider/provider.dart';
class GhComparisonScreen extends StatelessWidget {
const GhComparisonScreen(this.owner, this.name, this.before, this.head);
final String owner;
final String name;
final String before;
final String head;
const GhComparisonScreen(this.owner, this.name, this.before, this.head);
@override
Widget build(BuildContext context) {

View File

@ -9,9 +9,9 @@ import 'package:git_touch/widgets/contributor_item.dart';
import 'package:provider/provider.dart';
class GhContributorsScreen extends StatelessWidget {
const GhContributorsScreen(this.owner, this.name);
final String owner;
final String name;
const GhContributorsScreen(this.owner, this.name);
@override
Widget build(BuildContext context) {

View File

@ -9,8 +9,8 @@ import 'package:git_touch/widgets/event_item.dart';
import 'package:provider/provider.dart';
class GhEventsScreen extends StatelessWidget {
final String login;
const GhEventsScreen(this.login);
final String login;
@override
Widget build(context) {

View File

@ -10,10 +10,10 @@ import 'package:git_touch/widgets/files_item.dart';
import 'package:provider/provider.dart';
class GhFilesScreen extends StatelessWidget {
const GhFilesScreen(this.owner, this.name, this.pullNumber);
final String owner;
final String name;
final int pullNumber;
const GhFilesScreen(this.owner, this.name, this.pullNumber);
@override
Widget build(BuildContext context) {

View File

@ -6,15 +6,15 @@ import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/blob_view.dart';
class GistObjectScreen extends StatelessWidget {
const GistObjectScreen(this.login, this.id, this.file,
{this.raw, this.content});
final String login;
final String id;
final String file;
final String? raw;
final String? content;
const GistObjectScreen(this.login, this.id, this.file,
{this.raw, this.content});
@override
Widget build(BuildContext context) {
return CommonScaffold(

View File

@ -12,8 +12,8 @@ import 'package:git_touch/widgets/gists_item.dart';
import 'package:provider/provider.dart';
class GhGistsScreen extends StatelessWidget {
final String login;
const GhGistsScreen(this.login);
final String login;
@override
Widget build(BuildContext context) {

View File

@ -13,9 +13,9 @@ import 'package:git_touch/widgets/object_tree.dart';
import 'package:provider/provider.dart';
class GhGistsFilesScreen extends StatelessWidget {
const GhGistsFilesScreen(this.login, this.id);
final String id;
final String login;
const GhGistsFilesScreen(this.login, this.id);
@override
Widget build(BuildContext context) {

View File

@ -18,10 +18,10 @@ import 'package:git_touch/scaffolds/long_list.dart';
import 'package:git_touch/widgets/comment_item.dart';
class GhIssueScreen extends StatelessWidget {
const GhIssueScreen(this.owner, this.name, this.number);
final String owner;
final String name;
final int number;
const GhIssueScreen(this.owner, this.name, this.number);
Widget _buildHeader(
BuildContext context, {

View File

@ -8,9 +8,9 @@ import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class GhIssueFormScreen extends StatefulWidget {
const GhIssueFormScreen(this.owner, this.name);
final String owner;
final String name;
const GhIssueFormScreen(this.owner, this.name);
@override
_GhIssueFormScreenState createState() => _GhIssueFormScreenState();

View File

@ -13,9 +13,9 @@ import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart';
class GhIssuesScreen extends StatelessWidget {
const GhIssuesScreen(this.owner, this.name);
final String owner;
final String name;
const GhIssuesScreen(this.owner, this.name);
@override
Widget build(BuildContext context) {

View File

@ -12,12 +12,12 @@ import 'package:github/github.dart';
import 'package:provider/provider.dart';
class GhObjectScreen extends StatelessWidget {
const GhObjectScreen(this.owner, this.name, this.ref, {this.path, this.raw});
final String owner;
final String name;
final String ref;
final String? path;
final String? raw;
const GhObjectScreen(this.owner, this.name, this.ref, {this.path, this.raw});
@override
Widget build(BuildContext context) {

View File

@ -12,9 +12,9 @@ import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart';
class GhPullsScreen extends StatelessWidget {
const GhPullsScreen(this.owner, this.name);
final String owner;
final String name;
const GhPullsScreen(this.owner, this.name);
@override
Widget build(BuildContext context) {

View File

@ -11,9 +11,9 @@ import 'package:git_touch/widgets/release_item.dart';
import 'package:provider/provider.dart';
class GhReleasesScreen extends StatelessWidget {
const GhReleasesScreen(this.owner, this.name);
final String owner;
final String name;
const GhReleasesScreen(this.owner, this.name);
@override
Widget build(BuildContext context) {

View File

@ -27,10 +27,10 @@ import 'package:tuple/tuple.dart';
import 'package:universal_io/io.dart';
class GhRepoScreen extends StatelessWidget {
const GhRepoScreen(this.owner, this.name, {this.branch});
final String owner;
final String name;
final String? branch;
const GhRepoScreen(this.owner, this.name, {this.branch});
String _buildWatchState(GSubscriptionState? state) {
switch (state) {

View File

@ -11,8 +11,8 @@ import 'package:provider/provider.dart';
import 'package:timeago/timeago.dart' as timeago;
class GhRepos extends StatelessWidget {
final String login;
const GhRepos(this.login);
final String login;
@override
Widget build(BuildContext context) {
@ -42,8 +42,8 @@ class GhRepos extends StatelessWidget {
}
class GhStars extends StatelessWidget {
final String login;
const GhStars(this.login);
final String login;
@override
Widget build(BuildContext context) {

View File

@ -24,13 +24,13 @@ import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';
class _Repos extends StatelessWidget {
final String title;
final Iterable<GRepoParts>? repos;
_Repos(final Iterable<GRepoParts> pinned, final Iterable<GRepoParts>? repos)
: title =
pinned.isNotEmpty ? 'pinned repositories' : 'popular repositories',
repos = pinned.isNotEmpty ? pinned : repos;
final String title;
final Iterable<GRepoParts>? repos;
@override
Widget build(BuildContext context) {
@ -61,10 +61,10 @@ class _Repos extends StatelessWidget {
}
class _User extends StatelessWidget {
const _User(this.p, {this.isViewer = false, this.rightWidgets = const []});
final GUserPartsFull? p;
final bool isViewer;
final List<Widget> rightWidgets;
const _User(this.p, {this.isViewer = false, this.rightWidgets = const []});
@override
Widget build(BuildContext context) {
@ -195,8 +195,8 @@ class _User extends StatelessWidget {
}
class _Org extends StatelessWidget {
final GUserData_repositoryOwner__asOrganization? p;
const _Org(this.p);
final GUserData_repositoryOwner__asOrganization? p;
@override
Widget build(BuildContext context) {
@ -298,8 +298,8 @@ class GhViewer extends StatelessWidget {
}
class GhUser extends StatelessWidget {
final String login;
const GhUser(this.login);
final String login;
@override
Widget build(BuildContext context) {

View File

@ -10,8 +10,8 @@ import 'package:git_touch/widgets/user_item.dart';
import 'package:provider/provider.dart';
class GhFollowers extends StatelessWidget {
final String login;
const GhFollowers(this.login);
final String login;
@override
Widget build(BuildContext context) {
@ -40,8 +40,8 @@ class GhFollowers extends StatelessWidget {
}
class GhFollowing extends StatelessWidget {
final String login;
const GhFollowing(this.login);
final String login;
@override
Widget build(BuildContext context) {
@ -70,8 +70,8 @@ class GhFollowing extends StatelessWidget {
}
class GhOrgs extends StatelessWidget {
final String login;
const GhOrgs(this.login, {super.key});
final String login;
@override
Widget build(BuildContext context) {
@ -99,8 +99,8 @@ class GhOrgs extends StatelessWidget {
}
class GhMembers extends StatelessWidget {
final String login;
const GhMembers(this.login);
final String login;
@override
Widget build(BuildContext context) {
@ -129,9 +129,9 @@ class GhMembers extends StatelessWidget {
}
class GhWachers extends StatelessWidget {
const GhWachers(this.owner, this.name);
final String owner;
final String name;
const GhWachers(this.owner, this.name);
@override
Widget build(BuildContext context) {
@ -161,9 +161,9 @@ class GhWachers extends StatelessWidget {
}
class GhStargazers extends StatelessWidget {
const GhStargazers(this.owner, this.name);
final String owner;
final String name;
const GhStargazers(this.owner, this.name);
@override
Widget build(BuildContext context) {

View File

@ -9,10 +9,10 @@ import 'package:git_touch/widgets/blob_view.dart';
import 'package:provider/provider.dart';
class GlBlobScreen extends StatelessWidget {
const GlBlobScreen(this.id, this.ref, {this.path});
final int id;
final String ref;
final String? path;
const GlBlobScreen(this.id, this.ref, {this.path});
@override
Widget build(BuildContext context) {

View File

@ -13,9 +13,9 @@ import 'package:provider/provider.dart';
// TODO:
class GlCommitScreen extends StatelessWidget {
const GlCommitScreen(this.id, {this.sha});
final String id;
final String? sha;
const GlCommitScreen(this.id, {this.sha});
Future<List<GitlabDiff>> _query(BuildContext context) async {
final auth = context.read<AuthModel>();

View File

@ -8,10 +8,10 @@ import 'package:git_touch/widgets/commit_item.dart';
import 'package:provider/provider.dart';
class GlCommitsScreen extends StatelessWidget {
const GlCommitsScreen(this.id, {this.prefix, this.branch});
final String id;
final String? prefix;
final String? branch;
const GlCommitsScreen(this.id, {this.prefix, this.branch});
@override
Widget build(BuildContext context) {

View File

@ -12,8 +12,8 @@ import 'package:timeago/timeago.dart' as timeago;
import 'package:tuple/tuple.dart';
class GlGroupScreen extends StatelessWidget {
final int id;
const GlGroupScreen(this.id);
final int id;
@override
Widget build(BuildContext context) {

View File

@ -10,12 +10,12 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class GlIssueScreen extends StatelessWidget {
const GlIssueScreen(this.projectId, this.iid, {this.isMr = false});
final int projectId;
final int iid;
final bool isMr;
const GlIssueScreen(this.projectId, this.iid, {this.isMr = false});
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<

View File

@ -8,8 +8,8 @@ import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class GlIssueFormScreen extends StatefulWidget {
final int id;
const GlIssueFormScreen(this.id);
final int id;
@override
_GlIssueFormScreenState createState() => _GlIssueFormScreenState();

View File

@ -10,9 +10,9 @@ import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart';
class GlIssuesScreen extends StatelessWidget {
const GlIssuesScreen(this.id, {this.prefix});
final String id;
final String? prefix;
const GlIssuesScreen(this.id, {this.prefix});
@override
Widget build(BuildContext context) {

View File

@ -8,9 +8,9 @@ import 'package:git_touch/widgets/user_item.dart';
import 'package:provider/provider.dart';
class GlMembersScreen extends StatelessWidget {
const GlMembersScreen(this.id, this.type);
final int id;
final String type;
const GlMembersScreen(this.id, this.type);
// https://docs.gitlab.com/ee/api/access_requests.html#valid-access-levels
static const accessLevelMap = {

View File

@ -9,9 +9,9 @@ import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart';
class GlMergeRequestsScreen extends StatelessWidget {
const GlMergeRequestsScreen(this.id, {this.prefix});
final String id;
final String? prefix;
const GlMergeRequestsScreen(this.id, {this.prefix});
@override
Widget build(BuildContext context) {

View File

@ -19,9 +19,9 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class GlProjectScreen extends StatelessWidget {
const GlProjectScreen(this.id, {this.branch});
final int id;
final String? branch;
const GlProjectScreen(this.id, {this.branch});
@override
Widget build(BuildContext context) {

View File

@ -10,8 +10,8 @@ import 'package:git_touch/widgets/link.dart';
import 'package:provider/provider.dart';
class GlProjectActivityScreen extends StatelessWidget {
final int id;
const GlProjectActivityScreen(this.id);
final int id;
@override
Widget build(BuildContext context) {

View File

@ -9,8 +9,8 @@ import 'package:provider/provider.dart';
import 'package:timeago/timeago.dart' as timeago;
class GlStarrersScreen extends StatelessWidget {
final int id;
const GlStarrersScreen(this.id);
final int id;
@override
Widget build(BuildContext context) {

View File

@ -10,10 +10,10 @@ import 'package:git_touch/widgets/table_view.dart';
import 'package:provider/provider.dart';
class GlTreeScreen extends StatelessWidget {
const GlTreeScreen(this.id, this.ref, {this.path});
final int id;
final String ref;
final String? path;
const GlTreeScreen(this.id, this.ref, {this.path});
@override
Widget build(BuildContext context) {

View File

@ -12,8 +12,8 @@ import 'package:timeago/timeago.dart' as timeago;
import 'package:tuple/tuple.dart';
class GlUserScreen extends StatelessWidget {
final int? id;
const GlUserScreen(this.id);
final int? id;
bool get isViewer => id == null;
@override

View File

@ -8,10 +8,10 @@ import 'package:git_touch/widgets/commit_item.dart';
import 'package:provider/provider.dart';
class GoCommitsScreen extends StatelessWidget {
const GoCommitsScreen(this.owner, this.name, {this.branch = 'master'});
final String owner;
final String name;
final String? branch;
const GoCommitsScreen(this.owner, this.name, {this.branch = 'master'});
// TODO: API only returns most recent commit. No provision for all commits.
@override

View File

@ -10,10 +10,10 @@ import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart';
class GoIssuesScreen extends StatelessWidget {
const GoIssuesScreen(this.owner, this.name, {this.isPr = false});
final String owner;
final String name;
final bool isPr;
const GoIssuesScreen(this.owner, this.name, {this.isPr = false});
@override
Widget build(BuildContext context) {

View File

@ -12,11 +12,11 @@ import 'package:git_touch/widgets/object_tree.dart';
import 'package:provider/provider.dart';
class GoObjectScreen extends StatelessWidget {
const GoObjectScreen(this.owner, this.name, {this.path, this.ref});
final String owner;
final String name;
final String? path;
final String? ref;
const GoObjectScreen(this.owner, this.name, {this.path, this.ref});
@override
Widget build(BuildContext context) {

View File

@ -9,11 +9,11 @@ import 'package:git_touch/widgets/user_item.dart';
import 'package:provider/provider.dart';
class GoOrgsScreen extends StatelessWidget {
final String api;
final bool isViewer;
// TODO: implement list of orgs screen when API is available
const GoOrgsScreen.ofUser(String login, {required this.isViewer})
: api = isViewer ? '/users/$login/orgs' : '/user/orgs';
final String api;
final bool isViewer;
@override
Widget build(BuildContext context) {

View File

@ -18,10 +18,10 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class GoRepoScreen extends StatelessWidget {
const GoRepoScreen(this.owner, this.name, {this.branch});
final String owner;
final String name;
final String? branch;
const GoRepoScreen(this.owner, this.name, {this.branch});
@override
Widget build(BuildContext context) {

View File

@ -7,9 +7,6 @@ import 'package:git_touch/widgets/repository_item.dart';
import 'package:provider/provider.dart';
class GoReposScreen extends StatelessWidget {
final String api;
final String title;
final bool isViewer;
const GoReposScreen(String owner, {this.isViewer = false})
: api = isViewer ? '/users/$owner/repos' : '/user/repos',
@ -18,6 +15,9 @@ class GoReposScreen extends StatelessWidget {
: api = '/orgs/$owner/repos',
title = 'Repositories',
isViewer = false;
final String api;
final String title;
final bool isViewer;
@override
Widget build(BuildContext context) {

View File

@ -13,9 +13,9 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class GoUserScreen extends StatelessWidget {
const GoUserScreen(this.login, {this.isViewer = false});
final String login;
final bool isViewer;
const GoUserScreen(this.login, {this.isViewer = false});
@override
Widget build(BuildContext context) {

View File

@ -7,8 +7,6 @@ import 'package:git_touch/widgets/user_item.dart';
import 'package:provider/provider.dart';
class GoUsersScreen extends StatelessWidget {
final String api;
final String title;
const GoUsersScreen.followers(String login)
: api = '/users/$login/followers',
@ -16,6 +14,8 @@ class GoUsersScreen extends StatelessWidget {
const GoUsersScreen.following(String login)
: api = '/users/$login/following',
title = 'Following';
final String api;
final String title;
@override
Widget build(BuildContext context) {

View File

@ -8,10 +8,10 @@ import 'package:git_touch/widgets/commit_item.dart';
import 'package:provider/provider.dart';
class GtCommitsScreen extends StatelessWidget {
final String owner;
final String name;
// final String branch; // TODO:
const GtCommitsScreen(this.owner, this.name);
final String owner;
final String name;
@override
Widget build(BuildContext context) {

View File

@ -14,13 +14,13 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class GtIssueScreen extends StatelessWidget {
const GtIssueScreen(this.owner, this.name, this.number, {this.isPr = false});
final String owner;
final String name;
final String number;
final bool isPr;
const GtIssueScreen(this.owner, this.name, this.number, {this.isPr = false});
List<ActionItem> _buildCommentActionItem(
BuildContext context, GiteaComment comment) {
final auth = context.read<AuthModel>();

View File

@ -7,14 +7,14 @@ import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class GtIssueCommentScreen extends StatefulWidget {
const GtIssueCommentScreen(this.owner, this.name, this.number,
{this.isPr = false, this.body = '', this.id = ''});
final String owner;
final String name;
final String number;
final bool isPr;
final String body;
final String id;
const GtIssueCommentScreen(this.owner, this.name, this.number,
{this.isPr = false, this.body = '', this.id = ''});
@override
_GtIssueCommentScreenState createState() => _GtIssueCommentScreenState();

View File

@ -8,9 +8,9 @@ import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class GtIssueFormScreen extends StatefulWidget {
const GtIssueFormScreen(this.owner, this.name);
final String owner;
final String name;
const GtIssueFormScreen(this.owner, this.name);
@override
_GtIssueFormScreenState createState() => _GtIssueFormScreenState();

View File

@ -10,10 +10,10 @@ import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart';
class GtIssuesScreen extends StatelessWidget {
const GtIssuesScreen(this.owner, this.name, {this.isPr = false});
final String owner;
final String name;
final bool isPr;
const GtIssuesScreen(this.owner, this.name, {this.isPr = false});
@override
Widget build(BuildContext context) {

View File

@ -12,10 +12,10 @@ import 'package:git_touch/widgets/object_tree.dart';
import 'package:provider/provider.dart';
class GtObjectScreen extends StatelessWidget {
const GtObjectScreen(this.owner, this.name, {this.path});
final String owner;
final String name;
final String? path;
const GtObjectScreen(this.owner, this.name, {this.path});
@override
Widget build(BuildContext context) {

View File

@ -8,9 +8,9 @@ import 'package:git_touch/widgets/user_item.dart';
import 'package:provider/provider.dart';
class GtOrgsScreen extends StatelessWidget {
final String api;
const GtOrgsScreen() : api = '/orgs';
const GtOrgsScreen.ofUser(String login) : api = '/users/$login/orgs';
final String api;
@override
Widget build(BuildContext context) {

View File

@ -18,9 +18,9 @@ import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
class GtRepoScreen extends StatelessWidget {
const GtRepoScreen(this.owner, this.name);
final String owner;
final String name;
const GtRepoScreen(this.owner, this.name);
@override
Widget build(BuildContext context) {

View File

@ -8,8 +8,6 @@ import 'package:provider/provider.dart';
import 'package:timeago/timeago.dart' as timeago;
class GtReposScreen extends StatelessWidget {
final String api;
final String title;
const GtReposScreen(String owner)
: api = '/users/$owner/repos',
@ -23,6 +21,8 @@ class GtReposScreen extends StatelessWidget {
const GtReposScreen.forks(String owner, String repo)
: api = '/repos/$owner/$repo/forks',
title = 'Forks';
final String api;
final String title;
@override
Widget build(BuildContext context) {

View File

@ -24,9 +24,9 @@ class GtUserScreenPayload {
}
class GtUserScreen extends StatelessWidget {
const GtUserScreen(this.login, {this.isViewer = false});
final String login;
final bool isViewer;
const GtUserScreen(this.login, {this.isViewer = false});
static List<List<ContributionDay>> normalizeHeatmap(List userHeatmap) {
final heatmapItems = [

View File

@ -8,8 +8,6 @@ import 'package:provider/provider.dart';
import 'package:timeago/timeago.dart' as timeago;
class GtUsersScreen extends StatelessWidget {
final String api;
final String title;
const GtUsersScreen.followers(String login)
: api = '/users/$login/followers',
@ -26,6 +24,8 @@ class GtUsersScreen extends StatelessWidget {
const GtUsersScreen.watchers(String owner, String repo)
: api = '/repos/$owner/$repo/subscribers',
title = 'Watchers';
final String api;
final String title;
@override
Widget build(BuildContext context) {

View File

@ -129,9 +129,9 @@ bool isNotNullOrEmpty(String? text) {
// TODO: Primer
class PrimerBranchName extends StatelessWidget {
final String? name;
const PrimerBranchName(this.name);
final String? name;
static const branchBgColor = Color(0xffeaf5ff);
@ -180,13 +180,13 @@ int sortByKey<T>(T key, T a, T b) {
const TOTAL_COUNT_FALLBACK = 999; // TODO:
class ListPayload<T, K> {
K cursor;
bool hasMore;
Iterable<T> items;
ListPayload({
required this.cursor,
required this.hasMore,
required this.items,
});
K cursor;
bool hasMore;
Iterable<T> items;
}

View File

@ -5,15 +5,15 @@ import 'package:provider/provider.dart';
import 'package:share_plus/share_plus.dart';
class ActionItem {
String? text;
bool danger;
void Function(BuildContext context)? onTap;
ActionItem({
required this.text,
this.onTap,
this.danger = false,
});
String? text;
bool danger;
void Function(BuildContext context)? onTap;
static List<ActionItem> getUrlActions(String? url) {
return [
@ -33,11 +33,7 @@ class ActionItem {
}
}
class ActionButton extends StatelessWidget {
final String title;
final List<ActionItem> items;
final IconData iconData;
final int? selected; // TODO: selected, font bold
class ActionButton extends StatelessWidget { // TODO: selected, font bold
const ActionButton({
required this.title,
@ -45,6 +41,10 @@ class ActionButton extends StatelessWidget {
this.iconData = Ionicons.ellipsis_horizontal,
this.selected,
});
final String title;
final List<ActionItem> items;
final IconData iconData;
final int? selected;
@override
Widget build(BuildContext context) {

View File

@ -3,10 +3,10 @@ import 'package:git_touch/models/theme.dart';
import 'package:provider/provider.dart';
class ActionEntry extends StatelessWidget {
const ActionEntry({this.url, this.iconData, this.onTap});
final IconData? iconData;
final String? url;
final VoidCallback? onTap;
const ActionEntry({this.url, this.iconData, this.onTap});
@override
Widget build(BuildContext context) {

View File

@ -1,9 +1,9 @@
import 'package:flutter/widgets.dart';
class AppBarTitle extends StatelessWidget {
final String? text;
const AppBarTitle(this.text);
final String? text;
@override
Widget build(BuildContext context) {

View File

@ -14,10 +14,6 @@ class AvatarSize {
}
class Avatar extends StatelessWidget {
final String? url;
final double size;
final String? linkUrl;
final BorderRadius? borderRadius;
const Avatar({
required this.url,
@ -25,6 +21,10 @@ class Avatar extends StatelessWidget {
this.linkUrl,
this.borderRadius,
});
final String? url;
final double size;
final String? linkUrl;
final BorderRadius? borderRadius;
@override
Widget build(BuildContext context) {

Some files were not shown because too many files have changed in this diff Show More