build: migrate to NNBD

closes #136
This commit is contained in:
Rongjian Zhang 2021-05-16 15:16:35 +08:00
parent 420eca980a
commit efe0126bdb
168 changed files with 44577 additions and 42824 deletions

1
.gitignore vendored
View File

@ -39,3 +39,4 @@ app.*.symbols
# Obfuscation related
app.*.map.json
lib/generated/

View File

@ -51,7 +51,7 @@ SPEC CHECKSUMS:
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96
webview_flutter: 9f491a9b5a66f2573946a389b2677987b0ff8c0b
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c

View File

@ -19,21 +19,21 @@ class MyApp extends StatelessWidget {
// 2. system locale
try {
if (theme.locale != null) {
final intlLocale = l.Locale.parse(theme.locale);
final intlLocale = l.Locale.parse(theme.locale!);
locales = [
Locale.fromSubtags(
languageCode: intlLocale.languageCode,
countryCode: intlLocale.countryCode,
scriptCode: intlLocale.scriptCode,
),
...locales
...locales!
];
}
} catch (err) {
print(err);
}
for (final locale in locales) {
for (final locale in locales!) {
// this is necessary because Flutter only handles zh_Hans -> zh
// and would not handle non-exist language code
if (AppLocalizations.delegate.isSupported(locale)) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -12,12 +12,12 @@ abstract class GGistsVars implements Built<GGistsVars, GGistsVarsBuilder> {
factory GGistsVars([Function(GGistsVarsBuilder b) updates]) = _$GGistsVars;
String get login;
@nullable
String get after;
String? get after;
static Serializer<GGistsVars> get serializer => _$gGistsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GGistsVars.serializer, this);
static GGistsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GGistsVars.serializer, this)
as Map<String, dynamic>);
static GGistsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GGistsVars.serializer, json);
}
@ -30,8 +30,9 @@ abstract class GGistVars implements Built<GGistVars, GGistVarsBuilder> {
String get name;
static Serializer<GGistVars> get serializer => _$gGistVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GGistVars.serializer, this);
static GGistVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GGistVars.serializer, this)
as Map<String, dynamic>);
static GGistVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GGistVars.serializer, json);
}
@ -43,13 +44,13 @@ abstract class GFollowersVars
_$GFollowersVars;
String get login;
@nullable
String get after;
String? get after;
static Serializer<GFollowersVars> get serializer =>
_$gFollowersVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GFollowersVars.serializer, this);
static GFollowersVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GFollowersVars.serializer, this)
as Map<String, dynamic>);
static GFollowersVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GFollowersVars.serializer, json);
}
@ -61,13 +62,13 @@ abstract class GFollowingVars
_$GFollowingVars;
String get login;
@nullable
String get after;
String? get after;
static Serializer<GFollowingVars> get serializer =>
_$gFollowingVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GFollowingVars.serializer, this);
static GFollowingVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GFollowingVars.serializer, this)
as Map<String, dynamic>);
static GFollowingVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GFollowingVars.serializer, json);
}
@ -79,12 +80,12 @@ abstract class GMembersVars
_$GMembersVars;
String get login;
@nullable
String get after;
String? get after;
static Serializer<GMembersVars> get serializer => _$gMembersVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GMembersVars.serializer, this);
static GMembersVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GMembersVars.serializer, this)
as Map<String, dynamic>);
static GMembersVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GMembersVars.serializer, json);
}
@ -97,12 +98,12 @@ abstract class GWatchersVars
String get owner;
String get name;
@nullable
String get after;
String? get after;
static Serializer<GWatchersVars> get serializer => _$gWatchersVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GWatchersVars.serializer, this);
static GWatchersVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GWatchersVars.serializer, this)
as Map<String, dynamic>);
static GWatchersVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GWatchersVars.serializer, json);
}
@ -115,13 +116,13 @@ abstract class GStargazersVars
String get owner;
String get name;
@nullable
String get after;
String? get after;
static Serializer<GStargazersVars> get serializer =>
_$gStargazersVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GStargazersVars.serializer, this);
static GStargazersVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GStargazersVars.serializer, this)
as Map<String, dynamic>);
static GStargazersVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GStargazersVars.serializer, json);
}
@ -131,12 +132,12 @@ abstract class GReposVars implements Built<GReposVars, GReposVarsBuilder> {
factory GReposVars([Function(GReposVarsBuilder b) updates]) = _$GReposVars;
String get login;
@nullable
String get after;
String? get after;
static Serializer<GReposVars> get serializer => _$gReposVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReposVars.serializer, this);
static GReposVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GReposVars.serializer, this)
as Map<String, dynamic>);
static GReposVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GReposVars.serializer, json);
}
@ -146,12 +147,12 @@ abstract class GStarsVars implements Built<GStarsVars, GStarsVarsBuilder> {
factory GStarsVars([Function(GStarsVarsBuilder b) updates]) = _$GStarsVars;
String get login;
@nullable
String get after;
String? get after;
static Serializer<GStarsVars> get serializer => _$gStarsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GStarsVars.serializer, this);
static GStarsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GStarsVars.serializer, this)
as Map<String, dynamic>);
static GStarsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GStarsVars.serializer, json);
}
@ -162,8 +163,9 @@ abstract class GViewerVars implements Built<GViewerVars, GViewerVarsBuilder> {
static Serializer<GViewerVars> get serializer => _$gViewerVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GViewerVars.serializer, this);
static GViewerVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GViewerVars.serializer, this)
as Map<String, dynamic>);
static GViewerVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GViewerVars.serializer, json);
}
@ -175,8 +177,9 @@ abstract class GUserVars implements Built<GUserVars, GUserVarsBuilder> {
String get login;
static Serializer<GUserVars> get serializer => _$gUserVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUserVars.serializer, this);
static GUserVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GUserVars.serializer, this)
as Map<String, dynamic>);
static GUserVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GUserVars.serializer, json);
}
@ -191,8 +194,9 @@ abstract class GRepoVars implements Built<GRepoVars, GRepoVarsBuilder> {
String get branch;
static Serializer<GRepoVars> get serializer => _$gRepoVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GRepoVars.serializer, this);
static GRepoVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GRepoVars.serializer, this)
as Map<String, dynamic>);
static GRepoVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GRepoVars.serializer, json);
}
@ -207,12 +211,12 @@ abstract class GCommitsVars
String get name;
String get ref;
bool get hasRef;
@nullable
String get after;
String? get after;
static Serializer<GCommitsVars> get serializer => _$gCommitsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GCommitsVars.serializer, this);
static GCommitsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GCommitsVars.serializer, this)
as Map<String, dynamic>);
static GCommitsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GCommitsVars.serializer, json);
}
@ -223,12 +227,12 @@ abstract class GIssuesVars implements Built<GIssuesVars, GIssuesVarsBuilder> {
String get owner;
String get name;
@nullable
String get cursor;
String? get cursor;
static Serializer<GIssuesVars> get serializer => _$gIssuesVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GIssuesVars.serializer, this);
static GIssuesVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GIssuesVars.serializer, this)
as Map<String, dynamic>);
static GIssuesVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GIssuesVars.serializer, json);
}
@ -239,12 +243,12 @@ abstract class GPullsVars implements Built<GPullsVars, GPullsVarsBuilder> {
String get owner;
String get name;
@nullable
String get cursor;
String? get cursor;
static Serializer<GPullsVars> get serializer => _$gPullsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GPullsVars.serializer, this);
static GPullsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GPullsVars.serializer, this)
as Map<String, dynamic>);
static GPullsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GPullsVars.serializer, json);
}
@ -256,12 +260,12 @@ abstract class GIssueVars implements Built<GIssueVars, GIssueVarsBuilder> {
String get owner;
String get name;
int get number;
@nullable
String get cursor;
String? get cursor;
static Serializer<GIssueVars> get serializer => _$gIssueVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GIssueVars.serializer, this);
static GIssueVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GIssueVars.serializer, this)
as Map<String, dynamic>);
static GIssueVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GIssueVars.serializer, json);
}
@ -274,12 +278,12 @@ abstract class GReleasesVars
String get name;
String get owner;
@nullable
String get cursor;
String? get cursor;
static Serializer<GReleasesVars> get serializer => _$gReleasesVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReleasesVars.serializer, this);
static GReleasesVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GReleasesVars.serializer, this)
as Map<String, dynamic>);
static GReleasesVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GReleasesVars.serializer, json);
}
@ -293,8 +297,9 @@ abstract class GPageInfoPartsVars
static Serializer<GPageInfoPartsVars> get serializer =>
_$gPageInfoPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GPageInfoPartsVars.serializer, this);
static GPageInfoPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GPageInfoPartsVars.serializer, this)
as Map<String, dynamic>);
static GPageInfoPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GPageInfoPartsVars.serializer, json);
}
@ -307,8 +312,9 @@ abstract class GRepoItemVars
static Serializer<GRepoItemVars> get serializer => _$gRepoItemVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GRepoItemVars.serializer, this);
static GRepoItemVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GRepoItemVars.serializer, this)
as Map<String, dynamic>);
static GRepoItemVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GRepoItemVars.serializer, json);
}
@ -321,8 +327,9 @@ abstract class GUserItemVars
static Serializer<GUserItemVars> get serializer => _$gUserItemVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUserItemVars.serializer, this);
static GUserItemVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GUserItemVars.serializer, this)
as Map<String, dynamic>);
static GUserItemVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GUserItemVars.serializer, json);
}
@ -336,8 +343,9 @@ abstract class GReposRepoItemVars
static Serializer<GReposRepoItemVars> get serializer =>
_$gReposRepoItemVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReposRepoItemVars.serializer, this);
static GReposRepoItemVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GReposRepoItemVars.serializer, this)
as Map<String, dynamic>);
static GReposRepoItemVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GReposRepoItemVars.serializer, json);
}
@ -351,8 +359,9 @@ abstract class GUserPartsVars
static Serializer<GUserPartsVars> get serializer =>
_$gUserPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUserPartsVars.serializer, this);
static GUserPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GUserPartsVars.serializer, this)
as Map<String, dynamic>);
static GUserPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GUserPartsVars.serializer, json);
}
@ -366,8 +375,9 @@ abstract class GRepoCommitVars
static Serializer<GRepoCommitVars> get serializer =>
_$gRepoCommitVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GRepoCommitVars.serializer, this);
static GRepoCommitVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GRepoCommitVars.serializer, this)
as Map<String, dynamic>);
static GRepoCommitVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GRepoCommitVars.serializer, json);
}
@ -380,8 +390,9 @@ abstract class GRepoRefVars
static Serializer<GRepoRefVars> get serializer => _$gRepoRefVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GRepoRefVars.serializer, this);
static GRepoRefVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GRepoRefVars.serializer, this)
as Map<String, dynamic>);
static GRepoRefVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GRepoRefVars.serializer, json);
}
@ -393,13 +404,13 @@ abstract class GCommitsRefCommitVars
[Function(GCommitsRefCommitVarsBuilder b) updates]) =
_$GCommitsRefCommitVars;
@nullable
String get after;
String? get after;
static Serializer<GCommitsRefCommitVars> get serializer =>
_$gCommitsRefCommitVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GCommitsRefCommitVars.serializer, this);
static GCommitsRefCommitVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GCommitsRefCommitVars.serializer, this)
as Map<String, dynamic>);
static GCommitsRefCommitVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GCommitsRefCommitVars.serializer, json);
}
@ -410,13 +421,13 @@ abstract class GCommitsRefVars
factory GCommitsRefVars([Function(GCommitsRefVarsBuilder b) updates]) =
_$GCommitsRefVars;
@nullable
String get after;
String? get after;
static Serializer<GCommitsRefVars> get serializer =>
_$gCommitsRefVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GCommitsRefVars.serializer, this);
static GCommitsRefVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GCommitsRefVars.serializer, this)
as Map<String, dynamic>);
static GCommitsRefVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GCommitsRefVars.serializer, json);
}
@ -430,8 +441,9 @@ abstract class GCommentPartsVars
static Serializer<GCommentPartsVars> get serializer =>
_$gCommentPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GCommentPartsVars.serializer, this);
static GCommentPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GCommentPartsVars.serializer, this)
as Map<String, dynamic>);
static GCommentPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GCommentPartsVars.serializer, json);
}
@ -447,9 +459,9 @@ abstract class GReactionConnectionPartsVars
static Serializer<GReactionConnectionPartsVars> get serializer =>
_$gReactionConnectionPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GReactionConnectionPartsVars.serializer, this);
static GReactionConnectionPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GReactionConnectionPartsVars.serializer, this) as Map<String, dynamic>);
static GReactionConnectionPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GReactionConnectionPartsVars.serializer, json);
}
@ -464,8 +476,9 @@ abstract class GReactablePartsVars
static Serializer<GReactablePartsVars> get serializer =>
_$gReactablePartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReactablePartsVars.serializer, this);
static GReactablePartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GReactablePartsVars.serializer, this)
as Map<String, dynamic>);
static GReactablePartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GReactablePartsVars.serializer, json);
}
@ -481,8 +494,9 @@ abstract class GReferencedEventPartsVars
static Serializer<GReferencedEventPartsVars> get serializer =>
_$gReferencedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReferencedEventPartsVars.serializer, this);
static GReferencedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GReferencedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GReferencedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GReferencedEventPartsVars.serializer, json);
}
@ -498,9 +512,9 @@ abstract class GRenamedTitleEventPartsVars
static Serializer<GRenamedTitleEventPartsVars> get serializer =>
_$gRenamedTitleEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GRenamedTitleEventPartsVars.serializer, this);
static GRenamedTitleEventPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GRenamedTitleEventPartsVars.serializer, this) as Map<String, dynamic>);
static GRenamedTitleEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GRenamedTitleEventPartsVars.serializer, json);
}
@ -516,8 +530,9 @@ abstract class GClosedEventPartsVars
static Serializer<GClosedEventPartsVars> get serializer =>
_$gClosedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GClosedEventPartsVars.serializer, this);
static GClosedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GClosedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GClosedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GClosedEventPartsVars.serializer, json);
}
@ -532,8 +547,9 @@ abstract class GReopenedEventPartsVars
static Serializer<GReopenedEventPartsVars> get serializer =>
_$gReopenedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReopenedEventPartsVars.serializer, this);
static GReopenedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GReopenedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GReopenedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GReopenedEventPartsVars.serializer, json);
}
@ -549,9 +565,9 @@ abstract class GCrossReferencedEventPartsVars
static Serializer<GCrossReferencedEventPartsVars> get serializer =>
_$gCrossReferencedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GCrossReferencedEventPartsVars.serializer, this);
static GCrossReferencedEventPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GCrossReferencedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GCrossReferencedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GCrossReferencedEventPartsVars.serializer, json);
}
@ -567,8 +583,9 @@ abstract class GLabeledEventPartsVars
static Serializer<GLabeledEventPartsVars> get serializer =>
_$gLabeledEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GLabeledEventPartsVars.serializer, this);
static GLabeledEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GLabeledEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GLabeledEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GLabeledEventPartsVars.serializer, json);
}
@ -584,8 +601,9 @@ abstract class GUnlabeledEventPartsVars
static Serializer<GUnlabeledEventPartsVars> get serializer =>
_$gUnlabeledEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUnlabeledEventPartsVars.serializer, this);
static GUnlabeledEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GUnlabeledEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GUnlabeledEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GUnlabeledEventPartsVars.serializer, json);
}
@ -602,8 +620,9 @@ abstract class GMilestonedEventPartsVars
static Serializer<GMilestonedEventPartsVars> get serializer =>
_$gMilestonedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GMilestonedEventPartsVars.serializer, this);
static GMilestonedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GMilestonedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GMilestonedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GMilestonedEventPartsVars.serializer, json);
}
@ -619,9 +638,9 @@ abstract class GDemilestonedEventPartsVars
static Serializer<GDemilestonedEventPartsVars> get serializer =>
_$gDemilestonedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GDemilestonedEventPartsVars.serializer, this);
static GDemilestonedEventPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GDemilestonedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GDemilestonedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GDemilestonedEventPartsVars.serializer, json);
}
@ -637,8 +656,9 @@ abstract class GLockedEventPartsVars
static Serializer<GLockedEventPartsVars> get serializer =>
_$gLockedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GLockedEventPartsVars.serializer, this);
static GLockedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GLockedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GLockedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GLockedEventPartsVars.serializer, json);
}
@ -653,8 +673,9 @@ abstract class GUnlockedEventPartsVars
static Serializer<GUnlockedEventPartsVars> get serializer =>
_$gUnlockedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUnlockedEventPartsVars.serializer, this);
static GUnlockedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GUnlockedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GUnlockedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GUnlockedEventPartsVars.serializer, json);
}
@ -669,8 +690,9 @@ abstract class GAssignedEventPartsVars
static Serializer<GAssignedEventPartsVars> get serializer =>
_$gAssignedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GAssignedEventPartsVars.serializer, this);
static GAssignedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GAssignedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GAssignedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GAssignedEventPartsVars.serializer, json);
}
@ -686,8 +708,9 @@ abstract class GUnassignedEventPartsVars
static Serializer<GUnassignedEventPartsVars> get serializer =>
_$gUnassignedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUnassignedEventPartsVars.serializer, this);
static GUnassignedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GUnassignedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GUnassignedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GUnassignedEventPartsVars.serializer, json);
}
@ -704,8 +727,9 @@ abstract class GSubscribedEventPartsVars
static Serializer<GSubscribedEventPartsVars> get serializer =>
_$gSubscribedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GSubscribedEventPartsVars.serializer, this);
static GSubscribedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GSubscribedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GSubscribedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GSubscribedEventPartsVars.serializer, json);
}
@ -721,9 +745,9 @@ abstract class GUnsubscribedEventPartsVars
static Serializer<GUnsubscribedEventPartsVars> get serializer =>
_$gUnsubscribedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GUnsubscribedEventPartsVars.serializer, this);
static GUnsubscribedEventPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GUnsubscribedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GUnsubscribedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GUnsubscribedEventPartsVars.serializer, json);
}
@ -740,8 +764,9 @@ abstract class GMentionedEventPartsVars
static Serializer<GMentionedEventPartsVars> get serializer =>
_$gMentionedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GMentionedEventPartsVars.serializer, this);
static GMentionedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GMentionedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GMentionedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GMentionedEventPartsVars.serializer, json);
}
@ -757,8 +782,9 @@ abstract class GPinnedEventPartsVars
static Serializer<GPinnedEventPartsVars> get serializer =>
_$gPinnedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GPinnedEventPartsVars.serializer, this);
static GPinnedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GPinnedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GPinnedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GPinnedEventPartsVars.serializer, json);
}
@ -773,9 +799,9 @@ abstract class GTransferredEventPartsVars
static Serializer<GTransferredEventPartsVars> get serializer =>
_$gTransferredEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GTransferredEventPartsVars.serializer, this);
static GTransferredEventPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GTransferredEventPartsVars.serializer, this) as Map<String, dynamic>);
static GTransferredEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GTransferredEventPartsVars.serializer, json);
}
@ -791,9 +817,9 @@ abstract class GPullRequestCommitPartsVars
static Serializer<GPullRequestCommitPartsVars> get serializer =>
_$gPullRequestCommitPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GPullRequestCommitPartsVars.serializer, this);
static GPullRequestCommitPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GPullRequestCommitPartsVars.serializer, this) as Map<String, dynamic>);
static GPullRequestCommitPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GPullRequestCommitPartsVars.serializer, json);
}
@ -809,8 +835,9 @@ abstract class GDeployedEventPartsVars
static Serializer<GDeployedEventPartsVars> get serializer =>
_$gDeployedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GDeployedEventPartsVars.serializer, this);
static GDeployedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GDeployedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GDeployedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GDeployedEventPartsVars.serializer, json);
}
@ -826,9 +853,10 @@ abstract class GDeploymentEnvironmentChangedEventPartsVars
static Serializer<GDeploymentEnvironmentChangedEventPartsVars>
get serializer => _$gDeploymentEnvironmentChangedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers.serializeWith(
GDeploymentEnvironmentChangedEventPartsVars.serializer, this);
static GDeploymentEnvironmentChangedEventPartsVars fromJson(
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GDeploymentEnvironmentChangedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GDeploymentEnvironmentChangedEventPartsVars? fromJson(
Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(
GDeploymentEnvironmentChangedEventPartsVars.serializer, json);
@ -846,9 +874,9 @@ abstract class GHeadRefRestoredEventPartsVars
static Serializer<GHeadRefRestoredEventPartsVars> get serializer =>
_$gHeadRefRestoredEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GHeadRefRestoredEventPartsVars.serializer, this);
static GHeadRefRestoredEventPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GHeadRefRestoredEventPartsVars.serializer, this) as Map<String, dynamic>);
static GHeadRefRestoredEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GHeadRefRestoredEventPartsVars.serializer, json);
}
@ -865,9 +893,10 @@ abstract class GBaseRefForcePushedEventPartsVars
static Serializer<GBaseRefForcePushedEventPartsVars> get serializer =>
_$gBaseRefForcePushedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GBaseRefForcePushedEventPartsVars.serializer, this);
static GBaseRefForcePushedEventPartsVars fromJson(
Map<String, dynamic> toJson() => (_i1.serializers
.serializeWith(GBaseRefForcePushedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GBaseRefForcePushedEventPartsVars? fromJson(
Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GBaseRefForcePushedEventPartsVars.serializer, json);
@ -885,9 +914,10 @@ abstract class GHeadRefForcePushedEventPartsVars
static Serializer<GHeadRefForcePushedEventPartsVars> get serializer =>
_$gHeadRefForcePushedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GHeadRefForcePushedEventPartsVars.serializer, this);
static GHeadRefForcePushedEventPartsVars fromJson(
Map<String, dynamic> toJson() => (_i1.serializers
.serializeWith(GHeadRefForcePushedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GHeadRefForcePushedEventPartsVars? fromJson(
Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GHeadRefForcePushedEventPartsVars.serializer, json);
@ -905,9 +935,9 @@ abstract class GReviewRequestedEventPartsVars
static Serializer<GReviewRequestedEventPartsVars> get serializer =>
_$gReviewRequestedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GReviewRequestedEventPartsVars.serializer, this);
static GReviewRequestedEventPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GReviewRequestedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GReviewRequestedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GReviewRequestedEventPartsVars.serializer, json);
}
@ -924,9 +954,10 @@ abstract class GReviewRequestRemovedEventPartsVars
static Serializer<GReviewRequestRemovedEventPartsVars> get serializer =>
_$gReviewRequestRemovedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GReviewRequestRemovedEventPartsVars.serializer, this);
static GReviewRequestRemovedEventPartsVars fromJson(
Map<String, dynamic> toJson() => (_i1.serializers
.serializeWith(GReviewRequestRemovedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GReviewRequestRemovedEventPartsVars? fromJson(
Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(
GReviewRequestRemovedEventPartsVars.serializer, json);
@ -944,9 +975,9 @@ abstract class GReviewDismissedEventPartsVars
static Serializer<GReviewDismissedEventPartsVars> get serializer =>
_$gReviewDismissedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GReviewDismissedEventPartsVars.serializer, this);
static GReviewDismissedEventPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GReviewDismissedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GReviewDismissedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GReviewDismissedEventPartsVars.serializer, json);
}
@ -962,9 +993,9 @@ abstract class GPullRequestReviewPartsVars
static Serializer<GPullRequestReviewPartsVars> get serializer =>
_$gPullRequestReviewPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GPullRequestReviewPartsVars.serializer, this);
static GPullRequestReviewPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GPullRequestReviewPartsVars.serializer, this) as Map<String, dynamic>);
static GPullRequestReviewPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GPullRequestReviewPartsVars.serializer, json);
}
@ -980,8 +1011,9 @@ abstract class GMergedEventPartsVars
static Serializer<GMergedEventPartsVars> get serializer =>
_$gMergedEventPartsVarsSerializer;
Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GMergedEventPartsVars.serializer, this);
static GMergedEventPartsVars fromJson(Map<String, dynamic> json) =>
(_i1.serializers.serializeWith(GMergedEventPartsVars.serializer, this)
as Map<String, dynamic>);
static GMergedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GMergedEventPartsVars.serializer, json);
}
@ -997,9 +1029,9 @@ abstract class GHeadRefDeletedEventPartsVars
static Serializer<GHeadRefDeletedEventPartsVars> get serializer =>
_$gHeadRefDeletedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers
.serializeWith(GHeadRefDeletedEventPartsVars.serializer, this);
static GHeadRefDeletedEventPartsVars fromJson(Map<String, dynamic> json) =>
Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GHeadRefDeletedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GHeadRefDeletedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers
.deserializeWith(GHeadRefDeletedEventPartsVars.serializer, json);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,7 @@ class _HomeState extends State<Home> {
// return Image.asset('images/spinner.webp', width: 32, height: 32);
// return GhRepoScreen('shreyas1599', 'test');
final auth = Provider.of<AuthModel>(context);
switch (auth.activeAccount.platform) {
switch (auth.activeAccount!.platform) {
case PlatformType.github:
switch (index) {
case 0:
@ -90,7 +90,7 @@ class _HomeState extends State<Home> {
case 0:
return GtOrgsScreen();
case 1:
return GtUserScreen(auth.activeAccount.login, isViewer: true);
return GtUserScreen(auth.activeAccount!.login, isViewer: true);
}
break;
case PlatformType.gitee:
@ -98,7 +98,7 @@ class _HomeState extends State<Home> {
case 0:
return GeSearchScreen();
case 1:
return GeUserScreen(auth.activeAccount.login, isViewer: true);
return GeUserScreen(auth.activeAccount!.login, isViewer: true);
}
break;
case PlatformType.gogs:
@ -106,7 +106,7 @@ class _HomeState extends State<Home> {
case 0:
return GoSearchScreen();
case 1:
return GoUserScreen(auth.activeAccount.login, isViewer: true);
return GoUserScreen(auth.activeAccount!.login, isViewer: true);
}
}
}
@ -151,22 +151,22 @@ class _HomeState extends State<Home> {
final search = BottomNavigationBarItem(
icon: Icon(Ionicons.search_outline),
activeIcon: Icon(Ionicons.search),
label: AppLocalizations.of(context).search,
label: AppLocalizations.of(context)!.search,
);
final group = BottomNavigationBarItem(
icon: Icon(Ionicons.people_outline),
activeIcon: Icon(Ionicons.people),
label: AppLocalizations.of(context).organizations,
label: AppLocalizations.of(context)!.organizations,
);
final me = BottomNavigationBarItem(
icon: Icon(Ionicons.person_outline),
activeIcon: Icon(Ionicons.person),
label: AppLocalizations.of(context).me,
label: AppLocalizations.of(context)!.me,
);
final explore = BottomNavigationBarItem(
icon: Icon(Ionicons.compass_outline),
activeIcon: Icon(Ionicons.compass),
label: AppLocalizations.of(context).explore,
label: AppLocalizations.of(context)!.explore,
);
switch (platform) {
@ -175,18 +175,18 @@ class _HomeState extends State<Home> {
BottomNavigationBarItem(
icon: Icon(Ionicons.newspaper_outline),
activeIcon: Icon(Ionicons.newspaper),
label: AppLocalizations.of(context).news,
label: AppLocalizations.of(context)!.news,
),
BottomNavigationBarItem(
icon:
_buildNotificationIcon(context, Ionicons.notifications_outline),
activeIcon: _buildNotificationIcon(context, Ionicons.notifications),
label: AppLocalizations.of(context).notification,
label: AppLocalizations.of(context)!.notification,
),
BottomNavigationBarItem(
icon: Icon(Ionicons.flame_outline),
activeIcon: Icon(Ionicons.flame),
label: AppLocalizations.of(context).trending,
label: AppLocalizations.of(context)!.trending,
),
search,
me,
@ -219,15 +219,15 @@ class _HomeState extends State<Home> {
return LoginScreen();
}
final navigationItems = _buildNavigationItems(auth.activeAccount.platform);
final navigationItems = _buildNavigationItems(auth.activeAccount!.platform);
switch (theme.theme) {
case AppThemeType.cupertino:
return WillPopScope(
onWillPop: () async {
return !await getNavigatorKey(auth.activeTab)
return !(await getNavigatorKey(auth.activeTab)
.currentState
?.maybePop();
?.maybePop())!;
},
child: CupertinoTabScaffold(
tabBuilder: (context, index) {

View File

@ -10,9 +10,9 @@ class Account {
String token;
String login;
String avatarUrl;
int gitlabId; // For GitLab
String appPassword; // For Bitbucket
String accountId; // For Bitbucket
int? gitlabId; // For GitLab
String? appPassword; // For Bitbucket
String? accountId; // For Bitbucket
// equals(Account a) {
// final uri = Uri.parse(domain);
@ -27,11 +27,11 @@ class Account {
// }
Account({
@required this.platform,
@required this.domain,
@required this.token,
@required this.login,
@required this.avatarUrl,
required this.platform,
required this.domain,
required this.token,
required this.login,
required this.avatarUrl,
this.gitlabId,
this.appPassword,
this.accountId,

View File

@ -13,14 +13,20 @@ Account _$AccountFromJson(Map<String, dynamic> json) {
token: json['token'] as String,
login: json['login'] as String,
avatarUrl: json['avatarUrl'] as String,
gitlabId: json['gitlabId'] as int,
appPassword: json['appPassword'] as String,
accountId: json['accountId'] as String,
gitlabId: json['gitlabId'] as int?,
appPassword: json['appPassword'] as String?,
accountId: json['accountId'] as String?,
);
}
Map<String, dynamic> _$AccountToJson(Account instance) {
final val = <String, dynamic>{};
final val = <String, dynamic>{
'platform': instance.platform,
'domain': instance.domain,
'token': instance.token,
'login': instance.login,
'avatarUrl': instance.avatarUrl,
};
void writeNotNull(String key, dynamic value) {
if (value != null) {
@ -28,11 +34,6 @@ Map<String, dynamic> _$AccountToJson(Account instance) {
}
}
writeNotNull('platform', instance.platform);
writeNotNull('domain', instance.domain);
writeNotNull('token', instance.token);
writeNotNull('login', instance.login);
writeNotNull('avatarUrl', instance.avatarUrl);
writeNotNull('gitlabId', instance.gitlabId);
writeNotNull('appPassword', instance.appPassword);
writeNotNull('accountId', instance.accountId);

View File

@ -39,23 +39,23 @@ class DataWithPage<T> {
bool hasMore;
int total;
DataWithPage({
@required this.data,
@required this.cursor,
@required this.hasMore,
this.total,
/*required*/ required this.data,
/*required*/ required this.cursor,
/*required*/ required this.hasMore,
required this.total,
});
}
class BbPagePayload<T> {
T data;
String cursor;
String? cursor;
bool hasMore;
int total;
BbPagePayload({
@required this.data,
@required this.cursor,
@required this.hasMore,
this.total,
required this.data,
required this.cursor,
required this.hasMore,
required this.total,
});
}
@ -65,21 +65,21 @@ class AuthModel with ChangeNotifier {
// static final inAppReview = InAppReview.instance;
var hasRequestedReview = false;
List<Account> _accounts;
int activeAccountIndex;
StreamSubscription<Uri> _sub;
List<Account>? _accounts;
int? activeAccountIndex;
late StreamSubscription<Uri?> _sub;
bool loading = false;
List<Account> get accounts => _accounts;
Account get activeAccount {
List<Account>? get accounts => _accounts;
Account? get activeAccount {
if (activeAccountIndex == null || _accounts == null) return null;
return _accounts[activeAccountIndex];
return _accounts![activeAccountIndex!];
}
String get token => activeAccount.token;
String get token => activeAccount!.token;
_addAccount(Account account) async {
_accounts = [...accounts, account];
_accounts = [...accounts!, account];
// Save
final prefs = await SharedPreferences.getInstance();
await prefs.setString(StorageKeys.accounts, json.encode(_accounts));
@ -89,7 +89,7 @@ class AuthModel with ChangeNotifier {
if (activeAccountIndex == index) {
activeAccountIndex = null;
}
_accounts.removeAt(index);
_accounts!.removeAt(index);
// Save
final prefs = await SharedPreferences.getInstance();
await prefs.setString(StorageKeys.accounts, json.encode(_accounts));
@ -97,7 +97,7 @@ class AuthModel with ChangeNotifier {
}
// https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow
Future<void> _onSchemeDetected(Uri uri) async {
Future<void> _onSchemeDetected(Uri? uri) async {
await closeWebView();
loading = true;
@ -112,7 +112,7 @@ class AuthModel with ChangeNotifier {
},
body: json.encode({
'client_id': clientId,
'code': uri.queryParameters['code'],
'code': uri!.queryParameters['code'],
'state': _oauthState,
}),
);
@ -168,8 +168,8 @@ class AuthModel with ChangeNotifier {
platform: PlatformType.gitlab,
domain: domain,
token: token,
login: user.username,
avatarUrl: user.avatarUrl,
login: user.username!,
avatarUrl: user.avatarUrl!,
gitlabId: user.id,
));
} finally {
@ -188,7 +188,7 @@ class AuthModel with ChangeNotifier {
http.Response res;
if (isPost) {
res = await http.post(
Uri.parse('${activeAccount.domain}/api/v4$p'),
Uri.parse('${activeAccount!.domain}/api/v4$p'),
headers: {
'Private-Token': token,
HttpHeaders.contentTypeHeader: 'application/json'
@ -196,7 +196,7 @@ class AuthModel with ChangeNotifier {
body: jsonEncode(body),
);
} else {
res = await http.get(Uri.parse('${activeAccount.domain}/api/v4$p'),
res = await http.get(Uri.parse('${activeAccount!.domain}/api/v4$p'),
headers: {'Private-Token': token});
}
final info = json.decode(utf8.decode(res.bodyBytes));
@ -205,10 +205,10 @@ class AuthModel with ChangeNotifier {
}
Future<DataWithPage> fetchGitlabWithPage(String p) async {
final res = await http.get(Uri.parse('${activeAccount.domain}/api/v4$p'),
final res = await http.get(Uri.parse('${activeAccount!.domain}/api/v4$p'),
headers: {'Private-Token': token});
final next = int.tryParse(
res.headers['X-Next-Pages'] ?? res.headers['x-next-page'] ?? '');
res.headers['X-Next-Pages'] ?? res.headers['x-next-page'] ?? '')!;
final info = json.decode(utf8.decode(res.bodyBytes));
if (info is Map && info['message'] != null) throw info['message'];
return DataWithPage(
@ -216,7 +216,7 @@ class AuthModel with ChangeNotifier {
cursor: next,
hasMore: next != null,
total:
int.tryParse(res.headers['X-Total'] ?? res.headers['x-total'] ?? ''),
int.tryParse(res.headers['X-Total'] ?? res.headers['x-total'] ?? '')!,
);
}
@ -238,8 +238,8 @@ class AuthModel with ChangeNotifier {
platform: PlatformType.gitea,
domain: domain,
token: token,
login: user.login,
avatarUrl: user.avatarUrl,
login: user.login!,
avatarUrl: user.avatarUrl!,
));
} finally {
loading = false;
@ -252,7 +252,7 @@ class AuthModel with ChangeNotifier {
requestType = 'GET',
Map<String, dynamic> body = const {},
}) async {
http.Response res;
late http.Response res;
Map<String, String> headers = {
'Authorization': 'token $token',
HttpHeaders.contentTypeHeader: 'application/json'
@ -261,7 +261,7 @@ class AuthModel with ChangeNotifier {
case 'DELETE':
{
await http.delete(
Uri.parse('${activeAccount.domain}/api/v1$p'),
Uri.parse('${activeAccount!.domain}/api/v1$p'),
headers: headers,
);
break;
@ -269,7 +269,7 @@ class AuthModel with ChangeNotifier {
case 'POST':
{
res = await http.post(
Uri.parse('${activeAccount.domain}/api/v1$p'),
Uri.parse('${activeAccount!.domain}/api/v1$p'),
headers: headers,
body: jsonEncode(body),
);
@ -278,7 +278,7 @@ class AuthModel with ChangeNotifier {
case 'PATCH':
{
res = await http.patch(
Uri.parse('${activeAccount.domain}/api/v1$p'),
Uri.parse('${activeAccount!.domain}/api/v1$p'),
headers: headers,
body: jsonEncode(body),
);
@ -286,7 +286,7 @@ class AuthModel with ChangeNotifier {
}
default:
{
res = await http.get(Uri.parse('${activeAccount.domain}/api/v1$p'),
res = await http.get(Uri.parse('${activeAccount!.domain}/api/v1$p'),
headers: headers);
break;
}
@ -299,11 +299,11 @@ class AuthModel with ChangeNotifier {
}
Future<DataWithPage> fetchGiteaWithPage(String path,
{int page, int limit}) async {
{int? page, int? limit}) async {
page = page ?? 1;
limit = limit ?? pageSize;
var uri = Uri.parse('${activeAccount.domain}/api/v1$path');
var uri = Uri.parse('${activeAccount!.domain}/api/v1$path');
uri = uri.replace(
queryParameters: {
'page': page.toString(),
@ -318,7 +318,7 @@ class AuthModel with ChangeNotifier {
data: info,
cursor: page + 1,
hasMore: info is List && info.length > 0,
total: int.tryParse(res.headers['x-total-count'] ?? ''),
total: int.tryParse(res.headers['x-total-count'] ?? '')!,
);
}
@ -340,8 +340,8 @@ class AuthModel with ChangeNotifier {
platform: PlatformType.gogs,
domain: domain,
token: token,
login: user.username,
avatarUrl: user.avatarUrl,
login: user.username!,
avatarUrl: user.avatarUrl!,
));
} finally {
loading = false;
@ -355,7 +355,7 @@ class AuthModel with ChangeNotifier {
requestType = 'GET',
Map<String, dynamic> body = const {},
}) async {
http.Response res;
late http.Response res;
Map<String, String> headers = {
'Authorization': 'token $token',
HttpHeaders.contentTypeHeader: 'application/json'
@ -364,7 +364,7 @@ class AuthModel with ChangeNotifier {
case 'DELETE':
{
await http.delete(
Uri.parse('${activeAccount.domain}/api/v1$p'),
Uri.parse('${activeAccount!.domain}/api/v1$p'),
headers: headers,
);
break;
@ -372,7 +372,7 @@ class AuthModel with ChangeNotifier {
case 'POST':
{
res = await http.post(
Uri.parse('${activeAccount.domain}/api/v1$p'),
Uri.parse('${activeAccount!.domain}/api/v1$p'),
headers: headers,
body: jsonEncode(body),
);
@ -381,7 +381,7 @@ class AuthModel with ChangeNotifier {
case 'PATCH':
{
res = await http.patch(
Uri.parse('${activeAccount.domain}/api/v1$p'),
Uri.parse('${activeAccount!.domain}/api/v1$p'),
headers: headers,
body: jsonEncode(body),
);
@ -389,7 +389,7 @@ class AuthModel with ChangeNotifier {
}
default:
{
res = await http.get(Uri.parse('${activeAccount.domain}/api/v1$p'),
res = await http.get(Uri.parse('${activeAccount!.domain}/api/v1$p'),
headers: headers);
break;
}
@ -402,11 +402,11 @@ class AuthModel with ChangeNotifier {
}
Future<DataWithPage> fetchGogsWithPage(String path,
{int page, int limit}) async {
{int? page, int? limit}) async {
page = page ?? 1;
limit = limit ?? pageSize;
var uri = Uri.parse('${activeAccount.domain}/api/v1$path');
var uri = Uri.parse('${activeAccount!.domain}/api/v1$path');
uri = uri.replace(
queryParameters: {
'page': page.toString(),
@ -421,7 +421,7 @@ class AuthModel with ChangeNotifier {
data: info,
cursor: page + 1,
hasMore: info is List && info.length > 0,
total: int.tryParse(res.headers['x-total-count'] ?? ''),
total: int.tryParse(res.headers['x-total-count'] ?? '')!,
);
}
@ -439,7 +439,7 @@ class AuthModel with ChangeNotifier {
case 'DELETE':
{
await http.delete(
Uri.parse('${activeAccount.domain}/api/v5$p'),
Uri.parse('${activeAccount!.domain}/api/v5$p'),
headers: headers,
);
return;
@ -447,7 +447,7 @@ class AuthModel with ChangeNotifier {
case 'PUT':
{
await http.put(
Uri.parse('${activeAccount.domain}/api/v5$p'),
Uri.parse('${activeAccount!.domain}/api/v5$p'),
headers: headers,
);
return;
@ -455,7 +455,7 @@ class AuthModel with ChangeNotifier {
case 'POST':
{
res = await http.post(
Uri.parse('${activeAccount.domain}/api/v5$p'),
Uri.parse('${activeAccount!.domain}/api/v5$p'),
headers: headers,
body: jsonEncode(body),
);
@ -464,7 +464,7 @@ class AuthModel with ChangeNotifier {
case 'PATCH':
{
res = await http.patch(
Uri.parse('${activeAccount.domain}/api/v5$p'),
Uri.parse('${activeAccount!.domain}/api/v5$p'),
headers: headers,
body: jsonEncode(body),
);
@ -472,13 +472,13 @@ class AuthModel with ChangeNotifier {
}
case 'NO CONTENT':
{
res = await http.get(Uri.parse('${activeAccount.domain}/api/v5$p'),
res = await http.get(Uri.parse('${activeAccount!.domain}/api/v5$p'),
headers: headers);
return res;
}
default:
{
res = await http.get(Uri.parse('${activeAccount.domain}/api/v5$p'),
res = await http.get(Uri.parse('${activeAccount!.domain}/api/v5$p'),
headers: headers);
break;
}
@ -488,11 +488,11 @@ class AuthModel with ChangeNotifier {
}
Future<DataWithPage> fetchGiteeWithPage(String path,
{int page, int limit}) async {
{int? page, int? limit}) async {
page = page ?? 1;
limit = limit ?? pageSize;
var uri = Uri.parse('${activeAccount.domain}/api/v5$path');
var uri = Uri.parse('${activeAccount!.domain}/api/v5$path');
uri = uri.replace(
queryParameters: {
'page': page.toString(),
@ -504,7 +504,7 @@ class AuthModel with ChangeNotifier {
final info = json.decode(utf8.decode(res.bodyBytes));
final totalPage = int.tryParse(res.headers['total_page'] ?? '');
final totalCount = int.tryParse(res.headers['total_count'] ?? '');
final totalCount = int.tryParse(res.headers['total_count'] ?? '')!;
return DataWithPage(
data: info,
@ -532,9 +532,9 @@ class AuthModel with ChangeNotifier {
await _addAccount(Account(
platform: PlatformType.bitbucket,
domain: domain,
token: user.username,
token: user.username!,
login: username,
avatarUrl: user.avatarUrl,
avatarUrl: user.avatarUrl!,
appPassword: appPassword,
accountId: user.accountId,
));
@ -551,8 +551,8 @@ class AuthModel with ChangeNotifier {
}) async {
if (p.startsWith('/') && !p.startsWith('/api')) p = '/api/2.0$p';
final input = Uri.parse(p);
final uri = Uri.parse(activeAccount.domain).replace(
userInfo: '${activeAccount.login}:${activeAccount.appPassword}',
final uri = Uri.parse(activeAccount!.domain).replace(
userInfo: '${activeAccount!.login}:${activeAccount!.appPassword}',
path: input.path,
query: input.query,
);
@ -579,12 +579,12 @@ class AuthModel with ChangeNotifier {
return json.decode(utf8.decode(res.bodyBytes));
}
Future<BbPagePayload<List>> fetchBbWithPage(String p) async {
Future<BbPagePayload<List?>> fetchBbWithPage(String p) async {
final data = await fetchBbJson(p);
final v = BbPagination.fromJson(data);
return BbPagePayload(
cursor: v.next,
total: v.size,
total: v.size!,
data: v.values,
hasMore: v.next != null,
);
@ -607,8 +607,8 @@ class AuthModel with ChangeNotifier {
platform: PlatformType.gitee,
domain: 'https://gitee.com',
token: token,
login: user.login,
avatarUrl: user.avatarUrl,
login: user.login!,
avatarUrl: user.avatarUrl!,
));
} finally {
loading = false;
@ -626,7 +626,7 @@ class AuthModel with ChangeNotifier {
// Read accounts
try {
String str = prefs.getString(StorageKeys.accounts);
String? str = prefs.getString(StorageKeys.accounts);
// Fimber.d('read accounts: $str');
_accounts = (json.decode(str ?? '[]') as List)
.map((item) => Account.fromJson(item))
@ -635,7 +635,7 @@ class AuthModel with ChangeNotifier {
if (activeAccount != null) {
_activeTab = prefs.getInt(
StorageKeys.getDefaultStartTabKey(activeAccount.platform)) ??
StorageKeys.getDefaultStartTabKey(activeAccount!.platform)) ??
0;
}
} catch (err) {
@ -669,10 +669,10 @@ class AuthModel with ChangeNotifier {
// https://stackoverflow.com/a/50116077
rootKey = UniqueKey();
activeAccountIndex = index;
setDefaultAccount(activeAccountIndex);
setDefaultAccount(activeAccountIndex!);
final prefs = await SharedPreferences.getInstance();
_activeTab = prefs.getInt(
StorageKeys.getDefaultStartTabKey(activeAccount.platform)) ??
StorageKeys.getDefaultStartTabKey(activeAccount!.platform)) ??
0;
_ghClient = null;
_gqlClient = null;
@ -694,8 +694,8 @@ class AuthModel with ChangeNotifier {
var _timeoutDuration = Duration(seconds: 10);
// var _timeoutDuration = Duration(seconds: 1);
GitHub _ghClient;
GitHub get ghClient {
GitHub? _ghClient;
GitHub? get ghClient {
if (token == null) return null;
if (_ghClient == null) {
_ghClient = GitHub(auth: Authentication.withToken(token));
@ -703,8 +703,8 @@ class AuthModel with ChangeNotifier {
return _ghClient;
}
Client _gqlClient;
Client get gqlClient {
Client? _gqlClient;
Client? get gqlClient {
if (token == null) return null;
if (_gqlClient == null) {
@ -720,7 +720,7 @@ class AuthModel with ChangeNotifier {
return _gqlClient;
}
Future<dynamic> query(String query, [String _token]) async {
Future<dynamic> query(String query, [String? _token]) async {
if (_token == null) {
_token = token;
}
@ -747,7 +747,7 @@ class AuthModel with ChangeNotifier {
return data['data'];
}
String _oauthState;
String? _oauthState;
void redirectToGithubOauth([publicOnly = false]) {
_oauthState = nanoid();
final repoScope = publicOnly ? 'public_repo' : 'repo';
@ -765,8 +765,8 @@ class AuthModel with ChangeNotifier {
_activeTab = v;
final prefs = await SharedPreferences.getInstance();
await prefs.setInt(
StorageKeys.getDefaultStartTabKey(activeAccount.platform), v);
Fimber.d('write default start tab for ${activeAccount.platform}: $v');
StorageKeys.getDefaultStartTabKey(activeAccount!.platform), v);
Fimber.d('write default start tab for ${activeAccount!.platform}: $v');
notifyListeners();
}
}

View File

@ -3,11 +3,11 @@ part 'bitbucket.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class BbPagination {
int pagelen;
int size;
int page;
String next;
List values;
int? pagelen;
int? size;
int? page;
String? next;
List? values;
BbPagination();
factory BbPagination.fromJson(Map<String, dynamic> json) =>
_$BbPaginationFromJson(json);
@ -15,11 +15,11 @@ class BbPagination {
@JsonSerializable(fieldRename: FieldRename.snake)
class BbRepoOwner {
String nickname;
String displayName;
String type; // user, team
Map<String, dynamic> links;
String get avatarUrl => links['avatar']['href'];
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);
@ -27,40 +27,40 @@ class BbRepoOwner {
@JsonSerializable(fieldRename: FieldRename.snake)
class BbUser extends BbRepoOwner {
String username;
bool isStaff;
DateTime createdOn;
String accountId;
String? username;
bool? isStaff;
DateTime? createdOn;
String? accountId;
BbUser();
factory BbUser.fromJson(Map<String, dynamic> json) => _$BbUserFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbRepo {
String name;
BbRepoOwner owner;
String website;
String language;
int size;
String type; // repository
bool isPrivate;
DateTime createdOn;
DateTime updatedOn;
String description;
String fullName;
String slug;
BbRepoMainbranch mainbranch;
Map<String, dynamic> links;
String get ownerLogin => fullName.split('/')[0]; // owner has no username
String get avatarUrl => links['avatar']['href'];
String? name;
BbRepoOwner? owner;
String? website;
String? language;
int? size;
String? type; // repository
bool? isPrivate;
DateTime? createdOn;
DateTime? updatedOn;
String? description;
String? fullName;
String? slug;
BbRepoMainbranch? mainbranch;
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;
String? type;
String? name;
BbRepoMainbranch();
factory BbRepoMainbranch.fromJson(Map<String, dynamic> json) =>
_$BbRepoMainbranchFromJson(json);
@ -68,20 +68,20 @@ class BbRepoMainbranch {
@JsonSerializable(fieldRename: FieldRename.snake)
class BbTree {
String type;
String path;
int size;
Map<String, dynamic> links;
String? type;
String? path;
int? size;
Map<String, dynamic>? links;
BbTree();
factory BbTree.fromJson(Map<String, dynamic> json) => _$BbTreeFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbCommit {
String message;
DateTime date;
String hash;
BbCommitAuthor author;
String? message;
DateTime? date;
String? hash;
BbCommitAuthor? author;
BbCommit();
factory BbCommit.fromJson(Map<String, dynamic> json) =>
_$BbCommitFromJson(json);
@ -89,8 +89,8 @@ class BbCommit {
@JsonSerializable(fieldRename: FieldRename.snake)
class BbCommitAuthor {
String raw;
BbRepoOwner user;
String? raw;
BbRepoOwner? user;
BbCommitAuthor();
factory BbCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$BbCommitAuthorFromJson(json);
@ -98,14 +98,14 @@ class BbCommitAuthor {
@JsonSerializable(fieldRename: FieldRename.snake)
class BbIssues {
String priority;
String state;
BbRepo repository;
String title;
BbRepoOwner reporter;
DateTime createdOn;
Map<String, dynamic> links;
String get issueLink => links['self']['href'];
String? priority;
String? state;
BbRepo? repository;
String? title;
BbRepoOwner? reporter;
DateTime? createdOn;
Map<String, dynamic>? links;
String? get issueLink => links!['self']['href'];
BbIssues();
factory BbIssues.fromJson(Map<String, dynamic> json) =>
_$BbIssuesFromJson(json);
@ -113,12 +113,12 @@ class BbIssues {
@JsonSerializable(fieldRename: FieldRename.snake)
class BbPulls {
String description;
BbRepoOwner author;
String title;
Map<String, dynamic> links;
String get pullRequestLink => links['self']['href'];
DateTime createdOn;
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);
@ -126,9 +126,9 @@ class BbPulls {
@JsonSerializable(fieldRename: FieldRename.snake)
class BbCommentContent {
String raw;
String markup;
String html;
String? raw;
String? markup;
String? html;
BbCommentContent();
factory BbCommentContent.fromJson(Map<String, dynamic> json) =>
_$BbCommentContentFromJson(json);
@ -136,10 +136,10 @@ class BbCommentContent {
@JsonSerializable(fieldRename: FieldRename.snake)
class BbComment {
String createdOn;
String updatedOn;
BbCommentContent content;
BbRepoOwner user;
String? createdOn;
String? updatedOn;
BbCommentContent? content;
BbRepoOwner? user;
BbComment();
factory BbComment.fromJson(Map<String, dynamic> json) =>
_$BbCommentFromJson(json);
@ -147,8 +147,8 @@ class BbComment {
@JsonSerializable(fieldRename: FieldRename.snake)
class BbBranch {
String name;
String type;
String? name;
String? type;
BbBranch();
factory BbBranch.fromJson(Map<String, dynamic> json) =>
_$BbBranchFromJson(json);

View File

@ -8,11 +8,11 @@ part of 'bitbucket.dart';
BbPagination _$BbPaginationFromJson(Map<String, dynamic> json) {
return BbPagination()
..pagelen = json['pagelen'] as int
..size = json['size'] as int
..page = json['page'] as int
..next = json['next'] as String
..values = json['values'] as List;
..pagelen = json['pagelen'] as int?
..size = json['size'] as int?
..page = json['page'] as int?
..next = json['next'] as String?
..values = json['values'] as List<dynamic>?;
}
Map<String, dynamic> _$BbPaginationToJson(BbPagination instance) =>
@ -26,10 +26,10 @@ Map<String, dynamic> _$BbPaginationToJson(BbPagination instance) =>
BbRepoOwner _$BbRepoOwnerFromJson(Map<String, dynamic> json) {
return BbRepoOwner()
..nickname = json['nickname'] as String
..displayName = json['display_name'] as String
..type = json['type'] as String
..links = json['links'] as Map<String, dynamic>;
..nickname = json['nickname'] as String?
..displayName = json['display_name'] as String?
..type = json['type'] as String?
..links = json['links'] as Map<String, dynamic>?;
}
Map<String, dynamic> _$BbRepoOwnerToJson(BbRepoOwner instance) =>
@ -42,16 +42,16 @@ Map<String, dynamic> _$BbRepoOwnerToJson(BbRepoOwner instance) =>
BbUser _$BbUserFromJson(Map<String, dynamic> json) {
return BbUser()
..nickname = json['nickname'] as String
..displayName = json['display_name'] as String
..type = json['type'] as String
..links = json['links'] as Map<String, dynamic>
..username = json['username'] as String
..isStaff = json['is_staff'] as bool
..nickname = json['nickname'] as String?
..displayName = json['display_name'] as String?
..type = json['type'] as String?
..links = json['links'] as Map<String, dynamic>?
..username = json['username'] as String?
..isStaff = json['is_staff'] as bool?
..createdOn = json['created_on'] == null
? null
: DateTime.parse(json['created_on'] as String)
..accountId = json['account_id'] as String;
..accountId = json['account_id'] as String?;
}
Map<String, dynamic> _$BbUserToJson(BbUser instance) => <String, dynamic>{
@ -67,28 +67,28 @@ Map<String, dynamic> _$BbUserToJson(BbUser instance) => <String, dynamic>{
BbRepo _$BbRepoFromJson(Map<String, dynamic> json) {
return BbRepo()
..name = json['name'] as String
..name = json['name'] as String?
..owner = json['owner'] == null
? null
: BbRepoOwner.fromJson(json['owner'] as Map<String, dynamic>)
..website = json['website'] as String
..language = json['language'] as String
..size = json['size'] as int
..type = json['type'] as String
..isPrivate = json['is_private'] as bool
..website = json['website'] as String?
..language = json['language'] as String?
..size = json['size'] as int?
..type = json['type'] as String?
..isPrivate = json['is_private'] as bool?
..createdOn = json['created_on'] == null
? null
: DateTime.parse(json['created_on'] as String)
..updatedOn = json['updated_on'] == null
? null
: DateTime.parse(json['updated_on'] as String)
..description = json['description'] as String
..fullName = json['full_name'] as String
..slug = json['slug'] as String
..description = json['description'] as String?
..fullName = json['full_name'] as String?
..slug = json['slug'] as String?
..mainbranch = json['mainbranch'] == null
? null
: BbRepoMainbranch.fromJson(json['mainbranch'] as Map<String, dynamic>)
..links = json['links'] as Map<String, dynamic>;
..links = json['links'] as Map<String, dynamic>?;
}
Map<String, dynamic> _$BbRepoToJson(BbRepo instance) => <String, dynamic>{
@ -110,8 +110,8 @@ Map<String, dynamic> _$BbRepoToJson(BbRepo instance) => <String, dynamic>{
BbRepoMainbranch _$BbRepoMainbranchFromJson(Map<String, dynamic> json) {
return BbRepoMainbranch()
..type = json['type'] as String
..name = json['name'] as String;
..type = json['type'] as String?
..name = json['name'] as String?;
}
Map<String, dynamic> _$BbRepoMainbranchToJson(BbRepoMainbranch instance) =>
@ -122,10 +122,10 @@ Map<String, dynamic> _$BbRepoMainbranchToJson(BbRepoMainbranch instance) =>
BbTree _$BbTreeFromJson(Map<String, dynamic> json) {
return BbTree()
..type = json['type'] as String
..path = json['path'] as String
..size = json['size'] as int
..links = json['links'] as Map<String, dynamic>;
..type = json['type'] as String?
..path = json['path'] as String?
..size = json['size'] as int?
..links = json['links'] as Map<String, dynamic>?;
}
Map<String, dynamic> _$BbTreeToJson(BbTree instance) => <String, dynamic>{
@ -137,10 +137,10 @@ Map<String, dynamic> _$BbTreeToJson(BbTree instance) => <String, dynamic>{
BbCommit _$BbCommitFromJson(Map<String, dynamic> json) {
return BbCommit()
..message = json['message'] as String
..message = json['message'] as String?
..date =
json['date'] == null ? null : DateTime.parse(json['date'] as String)
..hash = json['hash'] as String
..hash = json['hash'] as String?
..author = json['author'] == null
? null
: BbCommitAuthor.fromJson(json['author'] as Map<String, dynamic>);
@ -155,7 +155,7 @@ Map<String, dynamic> _$BbCommitToJson(BbCommit instance) => <String, dynamic>{
BbCommitAuthor _$BbCommitAuthorFromJson(Map<String, dynamic> json) {
return BbCommitAuthor()
..raw = json['raw'] as String
..raw = json['raw'] as String?
..user = json['user'] == null
? null
: BbRepoOwner.fromJson(json['user'] as Map<String, dynamic>);
@ -169,19 +169,19 @@ Map<String, dynamic> _$BbCommitAuthorToJson(BbCommitAuthor instance) =>
BbIssues _$BbIssuesFromJson(Map<String, dynamic> json) {
return BbIssues()
..priority = json['priority'] as String
..state = json['state'] as String
..priority = json['priority'] as String?
..state = json['state'] as String?
..repository = json['repository'] == null
? null
: BbRepo.fromJson(json['repository'] as Map<String, dynamic>)
..title = json['title'] as String
..title = json['title'] as String?
..reporter = json['reporter'] == null
? null
: BbRepoOwner.fromJson(json['reporter'] as Map<String, dynamic>)
..createdOn = json['created_on'] == null
? null
: DateTime.parse(json['created_on'] as String)
..links = json['links'] as Map<String, dynamic>;
..links = json['links'] as Map<String, dynamic>?;
}
Map<String, dynamic> _$BbIssuesToJson(BbIssues instance) => <String, dynamic>{
@ -196,12 +196,12 @@ Map<String, dynamic> _$BbIssuesToJson(BbIssues instance) => <String, dynamic>{
BbPulls _$BbPullsFromJson(Map<String, dynamic> json) {
return BbPulls()
..description = json['description'] as String
..description = json['description'] as String?
..author = json['author'] == null
? null
: BbRepoOwner.fromJson(json['author'] as Map<String, dynamic>)
..title = json['title'] as String
..links = json['links'] as Map<String, dynamic>
..title = json['title'] as String?
..links = json['links'] as Map<String, dynamic>?
..createdOn = json['created_on'] == null
? null
: DateTime.parse(json['created_on'] as String);
@ -217,9 +217,9 @@ Map<String, dynamic> _$BbPullsToJson(BbPulls instance) => <String, dynamic>{
BbCommentContent _$BbCommentContentFromJson(Map<String, dynamic> json) {
return BbCommentContent()
..raw = json['raw'] as String
..markup = json['markup'] as String
..html = json['html'] as String;
..raw = json['raw'] as String?
..markup = json['markup'] as String?
..html = json['html'] as String?;
}
Map<String, dynamic> _$BbCommentContentToJson(BbCommentContent instance) =>
@ -231,8 +231,8 @@ Map<String, dynamic> _$BbCommentContentToJson(BbCommentContent instance) =>
BbComment _$BbCommentFromJson(Map<String, dynamic> json) {
return BbComment()
..createdOn = json['created_on'] as String
..updatedOn = json['updated_on'] as String
..createdOn = json['created_on'] as String?
..updatedOn = json['updated_on'] as String?
..content = json['content'] == null
? null
: BbCommentContent.fromJson(json['content'] as Map<String, dynamic>)
@ -250,8 +250,8 @@ Map<String, dynamic> _$BbCommentToJson(BbComment instance) => <String, dynamic>{
BbBranch _$BbBranchFromJson(Map<String, dynamic> json) {
return BbBranch()
..name = json['name'] as String
..type = json['type'] as String;
..name = json['name'] as String?
..type = json['type'] as String?;
}
Map<String, dynamic> _$BbBranchToJson(BbBranch instance) => <String, dynamic>{

View File

@ -39,16 +39,16 @@ class CodeModel with ChangeNotifier {
Fimber.d('read code: $vh, $vs, $vf');
if (themeMap.keys.contains(vh)) {
_theme = vh;
_theme = vh!;
}
if (themeMap.keys.contains(vdh)) {
_themeDark = vdh;
_themeDark = vdh!;
}
if (fontSizes.contains(vs)) {
_fontSize = vs;
_fontSize = vs!;
}
if (fontFamilies.contains(vf)) {
_fontFamily = vf;
_fontFamily = vf!;
}
notifyListeners();

View File

@ -4,11 +4,11 @@ part 'gitea.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaUser {
int id;
String login;
String fullName;
String avatarUrl;
DateTime created;
int? id;
String? login;
String? fullName;
String? avatarUrl;
DateTime? created;
GiteaUser();
factory GiteaUser.fromJson(Map<String, dynamic> json) =>
_$GiteaUserFromJson(json);
@ -16,13 +16,13 @@ class GiteaUser {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaOrg {
int id;
String username;
String fullName;
String avatarUrl;
String description;
String website;
String location;
int? id;
String? username;
String? fullName;
String? avatarUrl;
String? description;
String? website;
String? location;
GiteaOrg();
factory GiteaOrg.fromJson(Map<String, dynamic> json) =>
_$GiteaOrgFromJson(json);
@ -30,17 +30,17 @@ class GiteaOrg {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaRepository {
int id;
GiteaUser owner;
String name;
String description;
int starsCount;
int forksCount;
DateTime updatedAt;
String website;
int size;
int openIssuesCount;
int openPrCounter;
int? id;
GiteaUser? owner;
String? name;
String? description;
int? starsCount;
int? forksCount;
DateTime? updatedAt;
String? website;
int? size;
int? openIssuesCount;
int? openPrCounter;
GiteaRepository();
factory GiteaRepository.fromJson(Map<String, dynamic> json) =>
_$GiteaRepositoryFromJson(json);
@ -48,11 +48,11 @@ class GiteaRepository {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaTree {
String type;
String name;
String path;
int size;
String downloadUrl;
String? type;
String? name;
String? path;
int? size;
String? downloadUrl;
GiteaTree();
factory GiteaTree.fromJson(Map<String, dynamic> json) =>
_$GiteaTreeFromJson(json);
@ -60,7 +60,7 @@ class GiteaTree {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaBlob extends GiteaTree {
String content;
String? content;
GiteaBlob();
factory GiteaBlob.fromJson(Map<String, dynamic> json) =>
_$GiteaBlobFromJson(json);
@ -68,13 +68,13 @@ class GiteaBlob extends GiteaTree {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaCommit {
int number;
GiteaUser author;
String title;
String body;
GiteaCommitDetail commit;
String sha;
String htmlUrl;
int? number;
GiteaUser? author;
String? title;
String? body;
GiteaCommitDetail? commit;
String? sha;
String? htmlUrl;
GiteaCommit();
factory GiteaCommit.fromJson(Map<String, dynamic> json) =>
_$GiteaCommitFromJson(json);
@ -82,9 +82,9 @@ class GiteaCommit {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaCommitDetail {
String message;
GiteaCommitAuthor author;
GiteaCommitAuthor committer;
String? message;
GiteaCommitAuthor? author;
GiteaCommitAuthor? committer;
GiteaCommitDetail();
factory GiteaCommitDetail.fromJson(Map<String, dynamic> json) =>
_$GiteaCommitDetailFromJson(json);
@ -92,9 +92,9 @@ class GiteaCommitDetail {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaCommitAuthor {
String name;
String email;
DateTime date;
String? name;
String? email;
DateTime? date;
GiteaCommitAuthor();
factory GiteaCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$GiteaCommitAuthorFromJson(json);
@ -102,15 +102,15 @@ class GiteaCommitAuthor {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaIssue {
String title;
String body;
int number;
GiteaUser user;
int comments;
DateTime updatedAt;
String state;
String htmlUrl;
List<GiteaLabel> labels;
String? title;
String? body;
int? number;
GiteaUser? user;
int? comments;
DateTime? updatedAt;
String? state;
String? htmlUrl;
List<GiteaLabel>? labels;
GiteaIssue();
factory GiteaIssue.fromJson(Map<String, dynamic> json) =>
_$GiteaIssueFromJson(json);
@ -118,8 +118,8 @@ class GiteaIssue {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaLabel {
String color;
String name;
String? color;
String? name;
GiteaLabel();
factory GiteaLabel.fromJson(Map<String, dynamic> json) =>
_$GiteaLabelFromJson(json);
@ -127,8 +127,8 @@ class GiteaLabel {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaHeatmapItem {
int timestamp;
int contributions;
int? timestamp;
int? contributions;
GiteaHeatmapItem();
factory GiteaHeatmapItem.fromJson(Map<String, dynamic> json) =>
_$GiteaHeatmapItemFromJson(json);
@ -136,13 +136,13 @@ class GiteaHeatmapItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteaComment {
String body;
DateTime createdAt;
String htmlUrl;
String originalAuthor;
DateTime updatedAt;
int id;
GiteaUser user;
String? body;
DateTime? createdAt;
String? htmlUrl;
String? originalAuthor;
DateTime? updatedAt;
int? id;
GiteaUser? user;
GiteaComment();
factory GiteaComment.fromJson(Map<String, dynamic> json) =>
_$GiteaCommentFromJson(json);

View File

@ -8,10 +8,10 @@ part of 'gitea.dart';
GiteaUser _$GiteaUserFromJson(Map<String, dynamic> json) {
return GiteaUser()
..id = json['id'] as int
..login = json['login'] as String
..fullName = json['full_name'] as String
..avatarUrl = json['avatar_url'] as String
..id = json['id'] as int?
..login = json['login'] as String?
..fullName = json['full_name'] as String?
..avatarUrl = json['avatar_url'] as String?
..created = json['created'] == null
? null
: DateTime.parse(json['created'] as String);
@ -27,13 +27,13 @@ Map<String, dynamic> _$GiteaUserToJson(GiteaUser instance) => <String, dynamic>{
GiteaOrg _$GiteaOrgFromJson(Map<String, dynamic> json) {
return GiteaOrg()
..id = json['id'] as int
..username = json['username'] as String
..fullName = json['full_name'] as String
..avatarUrl = json['avatar_url'] as String
..description = json['description'] as String
..website = json['website'] as String
..location = json['location'] as String;
..id = json['id'] as int?
..username = json['username'] as String?
..fullName = json['full_name'] as String?
..avatarUrl = json['avatar_url'] as String?
..description = json['description'] as String?
..website = json['website'] as String?
..location = json['location'] as String?;
}
Map<String, dynamic> _$GiteaOrgToJson(GiteaOrg instance) => <String, dynamic>{
@ -48,21 +48,21 @@ Map<String, dynamic> _$GiteaOrgToJson(GiteaOrg instance) => <String, dynamic>{
GiteaRepository _$GiteaRepositoryFromJson(Map<String, dynamic> json) {
return GiteaRepository()
..id = json['id'] as int
..id = json['id'] as int?
..owner = json['owner'] == null
? null
: GiteaUser.fromJson(json['owner'] as Map<String, dynamic>)
..name = json['name'] as String
..description = json['description'] as String
..starsCount = json['stars_count'] as int
..forksCount = json['forks_count'] as int
..name = json['name'] as String?
..description = json['description'] as String?
..starsCount = json['stars_count'] as int?
..forksCount = json['forks_count'] as int?
..updatedAt = json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String)
..website = json['website'] as String
..size = json['size'] as int
..openIssuesCount = json['open_issues_count'] as int
..openPrCounter = json['open_pr_counter'] as int;
..website = json['website'] as String?
..size = json['size'] as int?
..openIssuesCount = json['open_issues_count'] as int?
..openPrCounter = json['open_pr_counter'] as int?;
}
Map<String, dynamic> _$GiteaRepositoryToJson(GiteaRepository instance) =>
@ -82,11 +82,11 @@ Map<String, dynamic> _$GiteaRepositoryToJson(GiteaRepository instance) =>
GiteaTree _$GiteaTreeFromJson(Map<String, dynamic> json) {
return GiteaTree()
..type = json['type'] as String
..name = json['name'] as String
..path = json['path'] as String
..size = json['size'] as int
..downloadUrl = json['download_url'] as String;
..type = json['type'] as String?
..name = json['name'] as String?
..path = json['path'] as String?
..size = json['size'] as int?
..downloadUrl = json['download_url'] as String?;
}
Map<String, dynamic> _$GiteaTreeToJson(GiteaTree instance) => <String, dynamic>{
@ -99,12 +99,12 @@ Map<String, dynamic> _$GiteaTreeToJson(GiteaTree instance) => <String, dynamic>{
GiteaBlob _$GiteaBlobFromJson(Map<String, dynamic> json) {
return GiteaBlob()
..type = json['type'] as String
..name = json['name'] as String
..path = json['path'] as String
..size = json['size'] as int
..downloadUrl = json['download_url'] as String
..content = json['content'] as String;
..type = json['type'] as String?
..name = json['name'] as String?
..path = json['path'] as String?
..size = json['size'] as int?
..downloadUrl = json['download_url'] as String?
..content = json['content'] as String?;
}
Map<String, dynamic> _$GiteaBlobToJson(GiteaBlob instance) => <String, dynamic>{
@ -118,17 +118,17 @@ Map<String, dynamic> _$GiteaBlobToJson(GiteaBlob instance) => <String, dynamic>{
GiteaCommit _$GiteaCommitFromJson(Map<String, dynamic> json) {
return GiteaCommit()
..number = json['number'] as int
..number = json['number'] as int?
..author = json['author'] == null
? null
: GiteaUser.fromJson(json['author'] as Map<String, dynamic>)
..title = json['title'] as String
..body = json['body'] as String
..title = json['title'] as String?
..body = json['body'] as String?
..commit = json['commit'] == null
? null
: GiteaCommitDetail.fromJson(json['commit'] as Map<String, dynamic>)
..sha = json['sha'] as String
..htmlUrl = json['html_url'] as String;
..sha = json['sha'] as String?
..htmlUrl = json['html_url'] as String?;
}
Map<String, dynamic> _$GiteaCommitToJson(GiteaCommit instance) =>
@ -144,7 +144,7 @@ Map<String, dynamic> _$GiteaCommitToJson(GiteaCommit instance) =>
GiteaCommitDetail _$GiteaCommitDetailFromJson(Map<String, dynamic> json) {
return GiteaCommitDetail()
..message = json['message'] as String
..message = json['message'] as String?
..author = json['author'] == null
? null
: GiteaCommitAuthor.fromJson(json['author'] as Map<String, dynamic>)
@ -162,8 +162,8 @@ Map<String, dynamic> _$GiteaCommitDetailToJson(GiteaCommitDetail instance) =>
GiteaCommitAuthor _$GiteaCommitAuthorFromJson(Map<String, dynamic> json) {
return GiteaCommitAuthor()
..name = json['name'] as String
..email = json['email'] as String
..name = json['name'] as String?
..email = json['email'] as String?
..date =
json['date'] == null ? null : DateTime.parse(json['date'] as String);
}
@ -177,22 +177,21 @@ Map<String, dynamic> _$GiteaCommitAuthorToJson(GiteaCommitAuthor instance) =>
GiteaIssue _$GiteaIssueFromJson(Map<String, dynamic> json) {
return GiteaIssue()
..title = json['title'] as String
..body = json['body'] as String
..number = json['number'] as int
..title = json['title'] as String?
..body = json['body'] as String?
..number = json['number'] as int?
..user = json['user'] == null
? null
: GiteaUser.fromJson(json['user'] as Map<String, dynamic>)
..comments = json['comments'] as int
..comments = json['comments'] as int?
..updatedAt = json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String)
..state = json['state'] as String
..htmlUrl = json['html_url'] as String
..labels = (json['labels'] as List)
?.map((e) =>
e == null ? null : GiteaLabel.fromJson(e as Map<String, dynamic>))
?.toList();
..state = json['state'] as String?
..htmlUrl = json['html_url'] as String?
..labels = (json['labels'] as List<dynamic>?)
?.map((e) => GiteaLabel.fromJson(e as Map<String, dynamic>))
.toList();
}
Map<String, dynamic> _$GiteaIssueToJson(GiteaIssue instance) =>
@ -210,8 +209,8 @@ Map<String, dynamic> _$GiteaIssueToJson(GiteaIssue instance) =>
GiteaLabel _$GiteaLabelFromJson(Map<String, dynamic> json) {
return GiteaLabel()
..color = json['color'] as String
..name = json['name'] as String;
..color = json['color'] as String?
..name = json['name'] as String?;
}
Map<String, dynamic> _$GiteaLabelToJson(GiteaLabel instance) =>
@ -222,8 +221,8 @@ Map<String, dynamic> _$GiteaLabelToJson(GiteaLabel instance) =>
GiteaHeatmapItem _$GiteaHeatmapItemFromJson(Map<String, dynamic> json) {
return GiteaHeatmapItem()
..timestamp = json['timestamp'] as int
..contributions = json['contributions'] as int;
..timestamp = json['timestamp'] as int?
..contributions = json['contributions'] as int?;
}
Map<String, dynamic> _$GiteaHeatmapItemToJson(GiteaHeatmapItem instance) =>
@ -234,16 +233,16 @@ Map<String, dynamic> _$GiteaHeatmapItemToJson(GiteaHeatmapItem instance) =>
GiteaComment _$GiteaCommentFromJson(Map<String, dynamic> json) {
return GiteaComment()
..body = json['body'] as String
..body = json['body'] as String?
..createdAt = json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String)
..htmlUrl = json['html_url'] as String
..originalAuthor = json['original_author'] as String
..htmlUrl = json['html_url'] as String?
..originalAuthor = json['original_author'] as String?
..updatedAt = json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String)
..id = json['id'] as int
..id = json['id'] as int?
..user = json['user'] == null
? null
: GiteaUser.fromJson(json['user'] as Map<String, dynamic>);

View File

@ -4,18 +4,18 @@ part 'gitee.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeUser {
String login;
String avatarUrl;
String name;
String htmlUrl;
String bio;
String blog;
int publicRepos;
int followers;
int following;
int stared;
int watched;
DateTime createdAt;
String? login;
String? avatarUrl;
String? name;
String? htmlUrl;
String? bio;
String? blog;
int? publicRepos;
int? followers;
int? following;
int? stared;
int? watched;
DateTime? createdAt;
GiteeUser();
factory GiteeUser.fromJson(Map<String, dynamic> json) =>
_$GiteeUserFromJson(json);
@ -23,10 +23,10 @@ class GiteeUser {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeListUser {
String login;
String avatarUrl;
String name;
String htmlUrl;
String? login;
String? avatarUrl;
String? name;
String? htmlUrl;
GiteeListUser();
factory GiteeListUser.fromJson(Map<String, dynamic> json) =>
_$GiteeListUserFromJson(json);
@ -34,23 +34,23 @@ class GiteeListUser {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeRepo {
GiteeRepoNamespace namespace;
GiteeRepoOwner owner;
String path;
String description;
bool private;
bool public;
bool internal;
bool fork;
int forksCount;
int stargazersCount;
int watchersCount;
DateTime updatedAt;
String license;
String homepage;
int openIssuesCount;
bool pullRequestsEnabled;
String defaultBranch;
GiteeRepoNamespace? namespace;
GiteeRepoOwner? owner;
String? path;
String? description;
bool? private;
bool? public;
bool? internal;
bool? fork;
int? forksCount;
int? stargazersCount;
int? watchersCount;
DateTime? updatedAt;
String? license;
String? homepage;
int? openIssuesCount;
bool? pullRequestsEnabled;
String? defaultBranch;
GiteeRepo();
factory GiteeRepo.fromJson(Map<String, dynamic> json) =>
_$GiteeRepoFromJson(json);
@ -58,8 +58,8 @@ class GiteeRepo {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeRepoOwner {
String login;
String avatarUrl;
String? login;
String? avatarUrl;
GiteeRepoOwner();
factory GiteeRepoOwner.fromJson(Map<String, dynamic> json) =>
_$GiteeRepoOwnerFromJson(json);
@ -67,7 +67,7 @@ class GiteeRepoOwner {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeRepoNamespace {
String path;
String? path;
GiteeRepoNamespace();
factory GiteeRepoNamespace.fromJson(Map<String, dynamic> json) =>
_$GiteeRepoNamespaceFromJson(json);
@ -75,11 +75,11 @@ class GiteeRepoNamespace {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommit {
GiteeUser author;
GiteeCommitDetail commit;
String sha;
String htmlUrl;
List<GiteeCommitFile> files;
GiteeUser? author;
GiteeCommitDetail? commit;
String? sha;
String? htmlUrl;
List<GiteeCommitFile>? files;
GiteeCommit();
factory GiteeCommit.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitFromJson(json);
@ -87,9 +87,9 @@ class GiteeCommit {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommitDetail {
String message;
GiteeCommitAuthor author;
GiteeCommitAuthor committer;
String? message;
GiteeCommitAuthor? author;
GiteeCommitAuthor? committer;
GiteeCommitDetail();
factory GiteeCommitDetail.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitDetailFromJson(json);
@ -97,9 +97,9 @@ class GiteeCommitDetail {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommitAuthor {
String name;
String email;
DateTime date;
String? name;
String? email;
DateTime? date;
GiteeCommitAuthor();
factory GiteeCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitAuthorFromJson(json);
@ -107,10 +107,10 @@ class GiteeCommitAuthor {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeTreeItem {
String path;
String type;
String sha;
int size;
String? path;
String? type;
String? sha;
int? size;
GiteeTreeItem();
factory GiteeTreeItem.fromJson(Map<String, dynamic> json) =>
_$GiteeTreeItemFromJson(json);
@ -118,7 +118,7 @@ class GiteeTreeItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeBlob {
String content;
String? content;
GiteeBlob();
factory GiteeBlob.fromJson(Map<String, dynamic> json) =>
_$GiteeBlobFromJson(json);
@ -126,8 +126,8 @@ class GiteeBlob {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeLabel {
String color;
String name;
String? color;
String? name;
GiteeLabel();
factory GiteeLabel.fromJson(Map<String, dynamic> json) =>
_$GiteeLabelFromJson(json);
@ -135,20 +135,20 @@ class GiteeLabel {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeIssue {
int comments;
String commentsUrl;
String createdAt;
String htmlUrl;
String updatedAt;
String body;
String bodyHtml;
String title;
String state;
GiteeRepo repository;
GiteeRepoOwner user;
String number;
List<GiteeLabel> labels;
int id;
int? comments;
String? commentsUrl;
String? createdAt;
String? htmlUrl;
String? updatedAt;
String? body;
String? bodyHtml;
String? title;
String? state;
GiteeRepo? repository;
GiteeRepoOwner? user;
String? number;
List<GiteeLabel>? labels;
int? id;
GiteeIssue();
factory GiteeIssue.fromJson(Map<String, dynamic> json) =>
_$GiteeIssueFromJson(json);
@ -156,18 +156,18 @@ class GiteeIssue {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteePull {
String commentsUrl;
String createdAt;
String htmlUrl;
String updatedAt;
String body;
String bodyHtml;
String title;
String state;
GiteeRepoOwner user;
List<GiteeLabel> labels;
int number;
int id;
String? commentsUrl;
String? createdAt;
String? htmlUrl;
String? updatedAt;
String? body;
String? bodyHtml;
String? title;
String? state;
GiteeRepoOwner? user;
List<GiteeLabel>? labels;
int? number;
int? id;
GiteePull();
factory GiteePull.fromJson(Map<String, dynamic> json) =>
_$GiteePullFromJson(json);
@ -175,10 +175,10 @@ class GiteePull {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeComment {
int id;
String body;
String createdAt;
GiteeRepoOwner user;
int? id;
String? body;
String? createdAt;
GiteeRepoOwner? user;
GiteeComment();
factory GiteeComment.fromJson(Map<String, dynamic> json) =>
_$GiteeCommentFromJson(json);
@ -186,7 +186,7 @@ class GiteeComment {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteePatch {
String diff;
String? diff;
GiteePatch();
factory GiteePatch.fromJson(Map<String, dynamic> json) =>
_$GiteePatchFromJson(json);
@ -196,13 +196,13 @@ class GiteePatch {
// for additions, deletions, patch
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteePullFile {
String additions;
String deletions;
String blobUrl;
String filename;
String sha;
String status;
GiteePatch patch;
String? additions;
String? deletions;
String? blobUrl;
String? filename;
String? sha;
String? status;
GiteePatch? patch;
GiteePullFile();
factory GiteePullFile.fromJson(Map<String, dynamic> json) =>
_$GiteePullFileFromJson(json);
@ -210,14 +210,14 @@ class GiteePullFile {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommitFile {
int additions;
int deletions;
int changes;
String blobUrl;
String filename;
String sha;
String status;
String patch;
int? additions;
int? deletions;
int? changes;
String? blobUrl;
String? filename;
String? sha;
String? status;
String? patch;
GiteeCommitFile();
factory GiteeCommitFile.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitFileFromJson(json);
@ -225,8 +225,8 @@ class GiteeCommitFile {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeContributor {
String name;
int contributions;
String? name;
int? contributions;
GiteeContributor();
factory GiteeContributor.fromJson(Map<String, dynamic> json) =>
_$GiteeContributorFromJson(json);
@ -234,7 +234,7 @@ class GiteeContributor {
@JsonSerializable(fieldRename: FieldRename.snake)
class GiteeBranch {
String name;
String? name;
GiteeBranch();
factory GiteeBranch.fromJson(Map<String, dynamic> json) =>
_$GiteeBranchFromJson(json);

View File

@ -8,17 +8,17 @@ part of 'gitee.dart';
GiteeUser _$GiteeUserFromJson(Map<String, dynamic> json) {
return GiteeUser()
..login = json['login'] as String
..avatarUrl = json['avatar_url'] as String
..name = json['name'] as String
..htmlUrl = json['html_url'] as String
..bio = json['bio'] as String
..blog = json['blog'] as String
..publicRepos = json['public_repos'] as int
..followers = json['followers'] as int
..following = json['following'] as int
..stared = json['stared'] as int
..watched = json['watched'] as int
..login = json['login'] as String?
..avatarUrl = json['avatar_url'] as String?
..name = json['name'] as String?
..htmlUrl = json['html_url'] as String?
..bio = json['bio'] as String?
..blog = json['blog'] as String?
..publicRepos = json['public_repos'] as int?
..followers = json['followers'] as int?
..following = json['following'] as int?
..stared = json['stared'] as int?
..watched = json['watched'] as int?
..createdAt = json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String);
@ -41,10 +41,10 @@ Map<String, dynamic> _$GiteeUserToJson(GiteeUser instance) => <String, dynamic>{
GiteeListUser _$GiteeListUserFromJson(Map<String, dynamic> json) {
return GiteeListUser()
..login = json['login'] as String
..avatarUrl = json['avatar_url'] as String
..name = json['name'] as String
..htmlUrl = json['html_url'] as String;
..login = json['login'] as String?
..avatarUrl = json['avatar_url'] as String?
..name = json['name'] as String?
..htmlUrl = json['html_url'] as String?;
}
Map<String, dynamic> _$GiteeListUserToJson(GiteeListUser instance) =>
@ -63,23 +63,23 @@ GiteeRepo _$GiteeRepoFromJson(Map<String, dynamic> json) {
..owner = json['owner'] == null
? null
: GiteeRepoOwner.fromJson(json['owner'] as Map<String, dynamic>)
..path = json['path'] as String
..description = json['description'] as String
..private = json['private'] as bool
..public = json['public'] as bool
..internal = json['internal'] as bool
..fork = json['fork'] as bool
..forksCount = json['forks_count'] as int
..stargazersCount = json['stargazers_count'] as int
..watchersCount = json['watchers_count'] as int
..path = json['path'] as String?
..description = json['description'] as String?
..private = json['private'] as bool?
..public = json['public'] as bool?
..internal = json['internal'] as bool?
..fork = json['fork'] as bool?
..forksCount = json['forks_count'] as int?
..stargazersCount = json['stargazers_count'] as int?
..watchersCount = json['watchers_count'] as int?
..updatedAt = json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String)
..license = json['license'] as String
..homepage = json['homepage'] as String
..openIssuesCount = json['open_issues_count'] as int
..pullRequestsEnabled = json['pull_requests_enabled'] as bool
..defaultBranch = json['default_branch'] as String;
..license = json['license'] as String?
..homepage = json['homepage'] as String?
..openIssuesCount = json['open_issues_count'] as int?
..pullRequestsEnabled = json['pull_requests_enabled'] as bool?
..defaultBranch = json['default_branch'] as String?;
}
Map<String, dynamic> _$GiteeRepoToJson(GiteeRepo instance) => <String, dynamic>{
@ -104,8 +104,8 @@ Map<String, dynamic> _$GiteeRepoToJson(GiteeRepo instance) => <String, dynamic>{
GiteeRepoOwner _$GiteeRepoOwnerFromJson(Map<String, dynamic> json) {
return GiteeRepoOwner()
..login = json['login'] as String
..avatarUrl = json['avatar_url'] as String;
..login = json['login'] as String?
..avatarUrl = json['avatar_url'] as String?;
}
Map<String, dynamic> _$GiteeRepoOwnerToJson(GiteeRepoOwner instance) =>
@ -115,7 +115,7 @@ Map<String, dynamic> _$GiteeRepoOwnerToJson(GiteeRepoOwner instance) =>
};
GiteeRepoNamespace _$GiteeRepoNamespaceFromJson(Map<String, dynamic> json) {
return GiteeRepoNamespace()..path = json['path'] as String;
return GiteeRepoNamespace()..path = json['path'] as String?;
}
Map<String, dynamic> _$GiteeRepoNamespaceToJson(GiteeRepoNamespace instance) =>
@ -131,13 +131,11 @@ GiteeCommit _$GiteeCommitFromJson(Map<String, dynamic> json) {
..commit = json['commit'] == null
? null
: GiteeCommitDetail.fromJson(json['commit'] as Map<String, dynamic>)
..sha = json['sha'] as String
..htmlUrl = json['html_url'] as String
..files = (json['files'] as List)
?.map((e) => e == null
? null
: GiteeCommitFile.fromJson(e as Map<String, dynamic>))
?.toList();
..sha = json['sha'] as String?
..htmlUrl = json['html_url'] as String?
..files = (json['files'] as List<dynamic>?)
?.map((e) => GiteeCommitFile.fromJson(e as Map<String, dynamic>))
.toList();
}
Map<String, dynamic> _$GiteeCommitToJson(GiteeCommit instance) =>
@ -151,7 +149,7 @@ Map<String, dynamic> _$GiteeCommitToJson(GiteeCommit instance) =>
GiteeCommitDetail _$GiteeCommitDetailFromJson(Map<String, dynamic> json) {
return GiteeCommitDetail()
..message = json['message'] as String
..message = json['message'] as String?
..author = json['author'] == null
? null
: GiteeCommitAuthor.fromJson(json['author'] as Map<String, dynamic>)
@ -169,8 +167,8 @@ Map<String, dynamic> _$GiteeCommitDetailToJson(GiteeCommitDetail instance) =>
GiteeCommitAuthor _$GiteeCommitAuthorFromJson(Map<String, dynamic> json) {
return GiteeCommitAuthor()
..name = json['name'] as String
..email = json['email'] as String
..name = json['name'] as String?
..email = json['email'] as String?
..date =
json['date'] == null ? null : DateTime.parse(json['date'] as String);
}
@ -184,10 +182,10 @@ Map<String, dynamic> _$GiteeCommitAuthorToJson(GiteeCommitAuthor instance) =>
GiteeTreeItem _$GiteeTreeItemFromJson(Map<String, dynamic> json) {
return GiteeTreeItem()
..path = json['path'] as String
..type = json['type'] as String
..sha = json['sha'] as String
..size = json['size'] as int;
..path = json['path'] as String?
..type = json['type'] as String?
..sha = json['sha'] as String?
..size = json['size'] as int?;
}
Map<String, dynamic> _$GiteeTreeItemToJson(GiteeTreeItem instance) =>
@ -199,7 +197,7 @@ Map<String, dynamic> _$GiteeTreeItemToJson(GiteeTreeItem instance) =>
};
GiteeBlob _$GiteeBlobFromJson(Map<String, dynamic> json) {
return GiteeBlob()..content = json['content'] as String;
return GiteeBlob()..content = json['content'] as String?;
}
Map<String, dynamic> _$GiteeBlobToJson(GiteeBlob instance) => <String, dynamic>{
@ -208,8 +206,8 @@ Map<String, dynamic> _$GiteeBlobToJson(GiteeBlob instance) => <String, dynamic>{
GiteeLabel _$GiteeLabelFromJson(Map<String, dynamic> json) {
return GiteeLabel()
..color = json['color'] as String
..name = json['name'] as String;
..color = json['color'] as String?
..name = json['name'] as String?;
}
Map<String, dynamic> _$GiteeLabelToJson(GiteeLabel instance) =>
@ -220,27 +218,26 @@ Map<String, dynamic> _$GiteeLabelToJson(GiteeLabel instance) =>
GiteeIssue _$GiteeIssueFromJson(Map<String, dynamic> json) {
return GiteeIssue()
..comments = json['comments'] as int
..commentsUrl = json['comments_url'] as String
..createdAt = json['created_at'] as String
..htmlUrl = json['html_url'] as String
..updatedAt = json['updated_at'] as String
..body = json['body'] as String
..bodyHtml = json['body_html'] as String
..title = json['title'] as String
..state = json['state'] as String
..comments = json['comments'] as int?
..commentsUrl = json['comments_url'] as String?
..createdAt = json['created_at'] as String?
..htmlUrl = json['html_url'] as String?
..updatedAt = json['updated_at'] as String?
..body = json['body'] as String?
..bodyHtml = json['body_html'] as String?
..title = json['title'] as String?
..state = json['state'] as String?
..repository = json['repository'] == null
? null
: GiteeRepo.fromJson(json['repository'] as Map<String, dynamic>)
..user = json['user'] == null
? null
: GiteeRepoOwner.fromJson(json['user'] as Map<String, dynamic>)
..number = json['number'] as String
..labels = (json['labels'] as List)
?.map((e) =>
e == null ? null : GiteeLabel.fromJson(e as Map<String, dynamic>))
?.toList()
..id = json['id'] as int;
..number = json['number'] as String?
..labels = (json['labels'] as List<dynamic>?)
?.map((e) => GiteeLabel.fromJson(e as Map<String, dynamic>))
.toList()
..id = json['id'] as int?;
}
Map<String, dynamic> _$GiteeIssueToJson(GiteeIssue instance) =>
@ -263,23 +260,22 @@ Map<String, dynamic> _$GiteeIssueToJson(GiteeIssue instance) =>
GiteePull _$GiteePullFromJson(Map<String, dynamic> json) {
return GiteePull()
..commentsUrl = json['comments_url'] as String
..createdAt = json['created_at'] as String
..htmlUrl = json['html_url'] as String
..updatedAt = json['updated_at'] as String
..body = json['body'] as String
..bodyHtml = json['body_html'] as String
..title = json['title'] as String
..state = json['state'] as String
..commentsUrl = json['comments_url'] as String?
..createdAt = json['created_at'] as String?
..htmlUrl = json['html_url'] as String?
..updatedAt = json['updated_at'] as String?
..body = json['body'] as String?
..bodyHtml = json['body_html'] as String?
..title = json['title'] as String?
..state = json['state'] as String?
..user = json['user'] == null
? null
: GiteeRepoOwner.fromJson(json['user'] as Map<String, dynamic>)
..labels = (json['labels'] as List)
?.map((e) =>
e == null ? null : GiteeLabel.fromJson(e as Map<String, dynamic>))
?.toList()
..number = json['number'] as int
..id = json['id'] as int;
..labels = (json['labels'] as List<dynamic>?)
?.map((e) => GiteeLabel.fromJson(e as Map<String, dynamic>))
.toList()
..number = json['number'] as int?
..id = json['id'] as int?;
}
Map<String, dynamic> _$GiteePullToJson(GiteePull instance) => <String, dynamic>{
@ -299,9 +295,9 @@ Map<String, dynamic> _$GiteePullToJson(GiteePull instance) => <String, dynamic>{
GiteeComment _$GiteeCommentFromJson(Map<String, dynamic> json) {
return GiteeComment()
..id = json['id'] as int
..body = json['body'] as String
..createdAt = json['created_at'] as String
..id = json['id'] as int?
..body = json['body'] as String?
..createdAt = json['created_at'] as String?
..user = json['user'] == null
? null
: GiteeRepoOwner.fromJson(json['user'] as Map<String, dynamic>);
@ -316,7 +312,7 @@ Map<String, dynamic> _$GiteeCommentToJson(GiteeComment instance) =>
};
GiteePatch _$GiteePatchFromJson(Map<String, dynamic> json) {
return GiteePatch()..diff = json['diff'] as String;
return GiteePatch()..diff = json['diff'] as String?;
}
Map<String, dynamic> _$GiteePatchToJson(GiteePatch instance) =>
@ -326,12 +322,12 @@ Map<String, dynamic> _$GiteePatchToJson(GiteePatch instance) =>
GiteePullFile _$GiteePullFileFromJson(Map<String, dynamic> json) {
return GiteePullFile()
..additions = json['additions'] as String
..deletions = json['deletions'] as String
..blobUrl = json['blob_url'] as String
..filename = json['filename'] as String
..sha = json['sha'] as String
..status = json['status'] as String
..additions = json['additions'] as String?
..deletions = json['deletions'] as String?
..blobUrl = json['blob_url'] as String?
..filename = json['filename'] as String?
..sha = json['sha'] as String?
..status = json['status'] as String?
..patch = json['patch'] == null
? null
: GiteePatch.fromJson(json['patch'] as Map<String, dynamic>);
@ -350,14 +346,14 @@ Map<String, dynamic> _$GiteePullFileToJson(GiteePullFile instance) =>
GiteeCommitFile _$GiteeCommitFileFromJson(Map<String, dynamic> json) {
return GiteeCommitFile()
..additions = json['additions'] as int
..deletions = json['deletions'] as int
..changes = json['changes'] as int
..blobUrl = json['blob_url'] as String
..filename = json['filename'] as String
..sha = json['sha'] as String
..status = json['status'] as String
..patch = json['patch'] as String;
..additions = json['additions'] as int?
..deletions = json['deletions'] as int?
..changes = json['changes'] as int?
..blobUrl = json['blob_url'] as String?
..filename = json['filename'] as String?
..sha = json['sha'] as String?
..status = json['status'] as String?
..patch = json['patch'] as String?;
}
Map<String, dynamic> _$GiteeCommitFileToJson(GiteeCommitFile instance) =>
@ -374,8 +370,8 @@ Map<String, dynamic> _$GiteeCommitFileToJson(GiteeCommitFile instance) =>
GiteeContributor _$GiteeContributorFromJson(Map<String, dynamic> json) {
return GiteeContributor()
..name = json['name'] as String
..contributions = json['contributions'] as int;
..name = json['name'] as String?
..contributions = json['contributions'] as int?;
}
Map<String, dynamic> _$GiteeContributorToJson(GiteeContributor instance) =>
@ -385,7 +381,7 @@ Map<String, dynamic> _$GiteeContributorToJson(GiteeContributor instance) =>
};
GiteeBranch _$GiteeBranchFromJson(Map<String, dynamic> json) {
return GiteeBranch()..name = json['name'] as String;
return GiteeBranch()..name = json['name'] as String?;
}
Map<String, dynamic> _$GiteeBranchToJson(GiteeBranch instance) =>

View File

@ -6,25 +6,25 @@ part 'github.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEvent {
GithubEventUser actor;
String type;
GithubEventRepo repo;
DateTime createdAt;
GithubEventPayload payload;
GithubEventUser? actor;
String? type;
GithubEventRepo? repo;
DateTime? createdAt;
GithubEventPayload? payload;
Tuple2<String, String> _repo;
Tuple2<String, String>? _repo;
String get repoOwner {
if (_repo == null) {
_repo = parseRepositoryFullName(repo.name);
_repo = parseRepositoryFullName(repo!.name!);
}
return _repo.item1;
return _repo!.item1;
}
String get repoName {
if (_repo == null) {
_repo = parseRepositoryFullName(repo.name);
_repo = parseRepositoryFullName(repo!.name!);
}
return _repo.item2;
return _repo!.item2;
}
GithubEvent();
@ -35,8 +35,8 @@ class GithubEvent {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventUser {
String login;
String avatarUrl;
String? login;
String? avatarUrl;
GithubEventUser();
@ -46,7 +46,7 @@ class GithubEventUser {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventRepo {
String name;
String? name;
GithubEventRepo();
@ -56,26 +56,26 @@ class GithubEventRepo {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventPayload {
GithubEventIssue issue;
GithubEventIssue pullRequest;
GithubEventComment comment;
GithubEventRelease release;
String action;
String ref;
String refType;
String before;
String head;
List<GithubEventCommit> commits;
Map<String, dynamic> forkee;
List<GithubPagesItem> pages;
GithubSecurityItem securityAdvisory;
GithubAlertItem alert;
GithubProjectItem project;
GithubProjectColumnItem projectColumn;
GithubInstallationRepositoriesItem installation;
GithubCheckrunItem checkRun;
GithubCheckSuiteItem checkSuite;
GithubContentReferenceItem contentReference;
GithubEventIssue? issue;
GithubEventIssue? pullRequest;
GithubEventComment? comment;
GithubEventRelease? release;
String? action;
String? ref;
String? refType;
String? before;
String? head;
List<GithubEventCommit>? commits;
Map<String, dynamic>? forkee;
List<GithubPagesItem>? pages;
GithubSecurityItem? securityAdvisory;
GithubAlertItem? alert;
GithubProjectItem? project;
GithubProjectColumnItem? projectColumn;
GithubInstallationRepositoriesItem? installation;
GithubCheckrunItem? checkRun;
GithubCheckSuiteItem? checkSuite;
GithubContentReferenceItem? contentReference;
GithubEventPayload();
factory GithubEventPayload.fromJson(Map<String, dynamic> json) =>
@ -84,15 +84,15 @@ class GithubEventPayload {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventIssue {
String title;
GithubEventUser user;
int number;
String body;
String? title;
GithubEventUser? user;
int? number;
String? body;
dynamic pullRequest;
String state;
int comments;
bool merged;
DateTime createdAt;
String? state;
int? comments;
bool? merged;
DateTime? createdAt;
bool get isPullRequestComment => pullRequest != null;
@ -104,10 +104,10 @@ class GithubEventIssue {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventComment {
String body;
GithubEventUser user;
String commitId;
String htmlUrl;
String? body;
GithubEventUser? user;
String? commitId;
String? htmlUrl;
GithubEventComment();
@ -117,8 +117,8 @@ class GithubEventComment {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventCommit {
String sha;
String message;
String? sha;
String? message;
GithubEventCommit();
@ -128,8 +128,8 @@ class GithubEventCommit {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventRelease {
String htmlUrl;
String tagName;
String? htmlUrl;
String? tagName;
GithubEventRelease();
@ -140,14 +140,14 @@ class GithubEventRelease {
// Notification
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubNotificationItem {
String id;
GithubNotificationItemSubject subject;
DateTime updatedAt;
GithubNotificationItemRepo repository;
bool unread;
String? id;
GithubNotificationItemSubject? subject;
DateTime? updatedAt;
GithubNotificationItemRepo? repository;
bool? unread;
@JsonKey(ignore: true)
String state;
String? state;
String get key => '_$hashCode';
@ -159,12 +159,12 @@ class GithubNotificationItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubNotificationItemSubject {
String title;
String type;
String url;
String? title;
String? type;
String? url;
int _number;
int get number {
int? _number;
int? get number {
if (_number == null) {
_number = int.parse(url?.split('/')?.last ?? '0');
}
@ -179,21 +179,21 @@ class GithubNotificationItemSubject {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubNotificationItemRepo {
String fullName;
String? fullName;
Tuple2<String, String> _repo;
Tuple2<String, String>? _repo;
String get owner {
if (_repo == null) {
_repo = parseRepositoryFullName(fullName);
_repo = parseRepositoryFullName(fullName!);
}
return _repo.item1;
return _repo!.item1;
}
String get name {
if (_repo == null) {
_repo = parseRepositoryFullName(fullName);
_repo = parseRepositoryFullName(fullName!);
}
return _repo.item2;
return _repo!.item2;
}
GithubNotificationItemRepo();
@ -204,12 +204,12 @@ class GithubNotificationItemRepo {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubTreeItem {
String name;
String path;
int size;
String type;
String downloadUrl;
String content;
String? name;
String? path;
int? size;
String? type;
String? downloadUrl;
String? content;
GithubTreeItem();
factory GithubTreeItem.fromJson(Map<String, dynamic> json) =>
_$GithubTreeItemFromJson(json);
@ -217,9 +217,9 @@ class GithubTreeItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubPagesItem {
String pageName;
String title;
String action;
String? pageName;
String? title;
String? action;
GithubPagesItem();
factory GithubPagesItem.fromJson(Map<String, dynamic> json) =>
_$GithubPagesItemFromJson(json);
@ -227,9 +227,9 @@ class GithubPagesItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubSecurityItem {
String summary;
String description;
String severity;
String? summary;
String? description;
String? severity;
GithubSecurityItem();
factory GithubSecurityItem.fromJson(Map<String, dynamic> json) =>
_$GithubSecurityItemFromJson(json);
@ -237,8 +237,8 @@ class GithubSecurityItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubAlertItem {
String affectedPackageName;
String affectedRange;
String? affectedPackageName;
String? affectedRange;
GithubAlertItem();
factory GithubAlertItem.fromJson(Map<String, dynamic> json) =>
_$GithubAlertItemFromJson(json);
@ -246,10 +246,10 @@ class GithubAlertItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubProjectItem {
String name;
String state;
String body;
String htmlUrl;
String? name;
String? state;
String? body;
String? htmlUrl;
GithubProjectItem();
factory GithubProjectItem.fromJson(Map<String, dynamic> json) =>
_$GithubProjectItemFromJson(json);
@ -257,9 +257,9 @@ class GithubProjectItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubProjectColumnItem {
String htmlUrl;
String columnsUrl;
String name;
String? htmlUrl;
String? columnsUrl;
String? name;
GithubProjectColumnItem();
factory GithubProjectColumnItem.fromJson(Map<String, dynamic> json) =>
_$GithubProjectColumnItemFromJson(json);
@ -267,9 +267,9 @@ class GithubProjectColumnItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubInstallationRepositoriesItem {
List<GithubNotificationItemRepo> repositoriesAdded, repositoriesRemoved;
String repositoriesSelection;
int id;
List<GithubNotificationItemRepo>? repositoriesAdded, repositoriesRemoved;
String? repositoriesSelection;
int? id;
GithubInstallationRepositoriesItem();
factory GithubInstallationRepositoriesItem.fromJson(
Map<String, dynamic> json) =>
@ -278,9 +278,9 @@ class GithubInstallationRepositoriesItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubCheckrunItem {
String status;
String name;
int id;
String? status;
String? name;
int? id;
GithubCheckrunItem();
factory GithubCheckrunItem.fromJson(Map<String, dynamic> json) =>
_$GithubCheckrunItemFromJson(json);
@ -288,8 +288,8 @@ class GithubCheckrunItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubCheckSuiteItem {
String status;
String conclusion;
String? status;
String? conclusion;
GithubCheckSuiteItem();
factory GithubCheckSuiteItem.fromJson(Map<String, dynamic> json) =>
_$GithubCheckSuiteItemFromJson(json);
@ -297,8 +297,8 @@ class GithubCheckSuiteItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubContentReferenceItem {
int id;
String reference;
int? id;
String? reference;
GithubContentReferenceItem();
factory GithubContentReferenceItem.fromJson(Map<String, dynamic> json) =>
_$GithubContentReferenceItemFromJson(json);
@ -306,11 +306,11 @@ class GithubContentReferenceItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubContributorItem {
int id;
String login;
String avatarUrl;
String htmlUrl;
int contributions;
int? id;
String? login;
String? avatarUrl;
String? htmlUrl;
int? contributions;
GithubContributorItem();
factory GithubContributorItem.fromJson(Map<String, dynamic> json) =>
_$GithubContributorItemFromJson(json);
@ -318,11 +318,11 @@ class GithubContributorItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubUserOrganizationItem {
int id;
String login;
String avatarUrl;
String description;
String url;
int? id;
String? login;
String? avatarUrl;
String? description;
String? url;
GithubUserOrganizationItem();
factory GithubUserOrganizationItem.fromJson(Map<String, dynamic> json) =>
_$GithubUserOrganizationItemFromJson(json);
@ -339,13 +339,13 @@ class GistFiles {
this.truncated,
this.content,
});
String filename;
int size;
String rawUrl;
String type;
String language;
bool truncated;
String content;
String? filename;
int? size;
String? rawUrl;
String? type;
String? language;
bool? truncated;
String? content;
factory GistFiles.fromJson(Map<String, dynamic> json) =>
_$GistFilesFromJson(json);
@ -353,21 +353,21 @@ class GistFiles {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubGistsItem {
String id;
String description;
bool public;
Map<String, GistFiles> files;
GithubEventUser owner;
String? id;
String? description;
bool? public;
Map<String, GistFiles>? files;
GithubEventUser? owner;
List<GistFiles> get fileNames {
List<GistFiles> filenames = [];
files.forEach((String key, GistFiles value) {
files!.forEach((String key, GistFiles value) {
filenames.add(value);
});
return filenames;
}
DateTime createdAt;
DateTime updatedAt;
DateTime? createdAt;
DateTime? updatedAt;
GithubGistsItem();
factory GithubGistsItem.fromJson(Map<String, dynamic> json) =>
@ -376,12 +376,12 @@ class GithubGistsItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubFilesItem {
String filename;
String status;
int additions;
int deletions;
int changes;
String patch;
String? filename;
String? status;
int? additions;
int? deletions;
int? changes;
String? patch;
GithubFilesItem();
factory GithubFilesItem.fromJson(Map<String, dynamic> json) =>
_$GithubFilesItemFromJson(json);
@ -389,10 +389,10 @@ class GithubFilesItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GithubComparisonItem {
List<GithubFilesItem> files;
String status;
int aheadBy;
int behindBy;
List<GithubFilesItem>? files;
String? status;
int? aheadBy;
int? behindBy;
GithubComparisonItem();
factory GithubComparisonItem.fromJson(Map<String, dynamic> json) =>
_$GithubComparisonItemFromJson(json);

View File

@ -11,7 +11,7 @@ GithubEvent _$GithubEventFromJson(Map<String, dynamic> json) {
..actor = json['actor'] == null
? null
: GithubEventUser.fromJson(json['actor'] as Map<String, dynamic>)
..type = json['type'] as String
..type = json['type'] as String?
..repo = json['repo'] == null
? null
: GithubEventRepo.fromJson(json['repo'] as Map<String, dynamic>)
@ -34,8 +34,8 @@ Map<String, dynamic> _$GithubEventToJson(GithubEvent instance) =>
GithubEventUser _$GithubEventUserFromJson(Map<String, dynamic> json) {
return GithubEventUser()
..login = json['login'] as String
..avatarUrl = json['avatar_url'] as String;
..login = json['login'] as String?
..avatarUrl = json['avatar_url'] as String?;
}
Map<String, dynamic> _$GithubEventUserToJson(GithubEventUser instance) =>
@ -45,7 +45,7 @@ Map<String, dynamic> _$GithubEventUserToJson(GithubEventUser instance) =>
};
GithubEventRepo _$GithubEventRepoFromJson(Map<String, dynamic> json) {
return GithubEventRepo()..name = json['name'] as String;
return GithubEventRepo()..name = json['name'] as String?;
}
Map<String, dynamic> _$GithubEventRepoToJson(GithubEventRepo instance) =>
@ -68,22 +68,18 @@ GithubEventPayload _$GithubEventPayloadFromJson(Map<String, dynamic> json) {
..release = json['release'] == null
? null
: GithubEventRelease.fromJson(json['release'] as Map<String, dynamic>)
..action = json['action'] as String
..ref = json['ref'] as String
..refType = json['ref_type'] as String
..before = json['before'] as String
..head = json['head'] as String
..commits = (json['commits'] as List)
?.map((e) => e == null
? null
: GithubEventCommit.fromJson(e as Map<String, dynamic>))
?.toList()
..forkee = json['forkee'] as Map<String, dynamic>
..pages = (json['pages'] as List)
?.map((e) => e == null
? null
: GithubPagesItem.fromJson(e as Map<String, dynamic>))
?.toList()
..action = json['action'] as String?
..ref = json['ref'] as String?
..refType = json['ref_type'] as String?
..before = json['before'] as String?
..head = json['head'] as String?
..commits = (json['commits'] as List<dynamic>?)
?.map((e) => GithubEventCommit.fromJson(e as Map<String, dynamic>))
.toList()
..forkee = json['forkee'] as Map<String, dynamic>?
..pages = (json['pages'] as List<dynamic>?)
?.map((e) => GithubPagesItem.fromJson(e as Map<String, dynamic>))
.toList()
..securityAdvisory = json['security_advisory'] == null
? null
: GithubSecurityItem.fromJson(
@ -141,16 +137,16 @@ Map<String, dynamic> _$GithubEventPayloadToJson(GithubEventPayload instance) =>
GithubEventIssue _$GithubEventIssueFromJson(Map<String, dynamic> json) {
return GithubEventIssue()
..title = json['title'] as String
..title = json['title'] as String?
..user = json['user'] == null
? null
: GithubEventUser.fromJson(json['user'] as Map<String, dynamic>)
..number = json['number'] as int
..body = json['body'] as String
..number = json['number'] as int?
..body = json['body'] as String?
..pullRequest = json['pull_request']
..state = json['state'] as String
..comments = json['comments'] as int
..merged = json['merged'] as bool
..state = json['state'] as String?
..comments = json['comments'] as int?
..merged = json['merged'] as bool?
..createdAt = json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String);
@ -171,12 +167,12 @@ Map<String, dynamic> _$GithubEventIssueToJson(GithubEventIssue instance) =>
GithubEventComment _$GithubEventCommentFromJson(Map<String, dynamic> json) {
return GithubEventComment()
..body = json['body'] as String
..body = json['body'] as String?
..user = json['user'] == null
? null
: GithubEventUser.fromJson(json['user'] as Map<String, dynamic>)
..commitId = json['commit_id'] as String
..htmlUrl = json['html_url'] as String;
..commitId = json['commit_id'] as String?
..htmlUrl = json['html_url'] as String?;
}
Map<String, dynamic> _$GithubEventCommentToJson(GithubEventComment instance) =>
@ -189,8 +185,8 @@ Map<String, dynamic> _$GithubEventCommentToJson(GithubEventComment instance) =>
GithubEventCommit _$GithubEventCommitFromJson(Map<String, dynamic> json) {
return GithubEventCommit()
..sha = json['sha'] as String
..message = json['message'] as String;
..sha = json['sha'] as String?
..message = json['message'] as String?;
}
Map<String, dynamic> _$GithubEventCommitToJson(GithubEventCommit instance) =>
@ -201,8 +197,8 @@ Map<String, dynamic> _$GithubEventCommitToJson(GithubEventCommit instance) =>
GithubEventRelease _$GithubEventReleaseFromJson(Map<String, dynamic> json) {
return GithubEventRelease()
..htmlUrl = json['html_url'] as String
..tagName = json['tag_name'] as String;
..htmlUrl = json['html_url'] as String?
..tagName = json['tag_name'] as String?;
}
Map<String, dynamic> _$GithubEventReleaseToJson(GithubEventRelease instance) =>
@ -214,7 +210,7 @@ Map<String, dynamic> _$GithubEventReleaseToJson(GithubEventRelease instance) =>
GithubNotificationItem _$GithubNotificationItemFromJson(
Map<String, dynamic> json) {
return GithubNotificationItem()
..id = json['id'] as String
..id = json['id'] as String?
..subject = json['subject'] == null
? null
: GithubNotificationItemSubject.fromJson(
@ -226,7 +222,7 @@ GithubNotificationItem _$GithubNotificationItemFromJson(
? null
: GithubNotificationItemRepo.fromJson(
json['repository'] as Map<String, dynamic>)
..unread = json['unread'] as bool;
..unread = json['unread'] as bool?;
}
Map<String, dynamic> _$GithubNotificationItemToJson(
@ -242,9 +238,9 @@ Map<String, dynamic> _$GithubNotificationItemToJson(
GithubNotificationItemSubject _$GithubNotificationItemSubjectFromJson(
Map<String, dynamic> json) {
return GithubNotificationItemSubject()
..title = json['title'] as String
..type = json['type'] as String
..url = json['url'] as String;
..title = json['title'] as String?
..type = json['type'] as String?
..url = json['url'] as String?;
}
Map<String, dynamic> _$GithubNotificationItemSubjectToJson(
@ -257,7 +253,7 @@ Map<String, dynamic> _$GithubNotificationItemSubjectToJson(
GithubNotificationItemRepo _$GithubNotificationItemRepoFromJson(
Map<String, dynamic> json) {
return GithubNotificationItemRepo()..fullName = json['full_name'] as String;
return GithubNotificationItemRepo()..fullName = json['full_name'] as String?;
}
Map<String, dynamic> _$GithubNotificationItemRepoToJson(
@ -268,12 +264,12 @@ Map<String, dynamic> _$GithubNotificationItemRepoToJson(
GithubTreeItem _$GithubTreeItemFromJson(Map<String, dynamic> json) {
return GithubTreeItem()
..name = json['name'] as String
..path = json['path'] as String
..size = json['size'] as int
..type = json['type'] as String
..downloadUrl = json['download_url'] as String
..content = json['content'] as String;
..name = json['name'] as String?
..path = json['path'] as String?
..size = json['size'] as int?
..type = json['type'] as String?
..downloadUrl = json['download_url'] as String?
..content = json['content'] as String?;
}
Map<String, dynamic> _$GithubTreeItemToJson(GithubTreeItem instance) =>
@ -288,9 +284,9 @@ Map<String, dynamic> _$GithubTreeItemToJson(GithubTreeItem instance) =>
GithubPagesItem _$GithubPagesItemFromJson(Map<String, dynamic> json) {
return GithubPagesItem()
..pageName = json['page_name'] as String
..title = json['title'] as String
..action = json['action'] as String;
..pageName = json['page_name'] as String?
..title = json['title'] as String?
..action = json['action'] as String?;
}
Map<String, dynamic> _$GithubPagesItemToJson(GithubPagesItem instance) =>
@ -302,9 +298,9 @@ Map<String, dynamic> _$GithubPagesItemToJson(GithubPagesItem instance) =>
GithubSecurityItem _$GithubSecurityItemFromJson(Map<String, dynamic> json) {
return GithubSecurityItem()
..summary = json['summary'] as String
..description = json['description'] as String
..severity = json['severity'] as String;
..summary = json['summary'] as String?
..description = json['description'] as String?
..severity = json['severity'] as String?;
}
Map<String, dynamic> _$GithubSecurityItemToJson(GithubSecurityItem instance) =>
@ -316,8 +312,8 @@ Map<String, dynamic> _$GithubSecurityItemToJson(GithubSecurityItem instance) =>
GithubAlertItem _$GithubAlertItemFromJson(Map<String, dynamic> json) {
return GithubAlertItem()
..affectedPackageName = json['affected_package_name'] as String
..affectedRange = json['affected_range'] as String;
..affectedPackageName = json['affected_package_name'] as String?
..affectedRange = json['affected_range'] as String?;
}
Map<String, dynamic> _$GithubAlertItemToJson(GithubAlertItem instance) =>
@ -328,10 +324,10 @@ Map<String, dynamic> _$GithubAlertItemToJson(GithubAlertItem instance) =>
GithubProjectItem _$GithubProjectItemFromJson(Map<String, dynamic> json) {
return GithubProjectItem()
..name = json['name'] as String
..state = json['state'] as String
..body = json['body'] as String
..htmlUrl = json['html_url'] as String;
..name = json['name'] as String?
..state = json['state'] as String?
..body = json['body'] as String?
..htmlUrl = json['html_url'] as String?;
}
Map<String, dynamic> _$GithubProjectItemToJson(GithubProjectItem instance) =>
@ -345,9 +341,9 @@ Map<String, dynamic> _$GithubProjectItemToJson(GithubProjectItem instance) =>
GithubProjectColumnItem _$GithubProjectColumnItemFromJson(
Map<String, dynamic> json) {
return GithubProjectColumnItem()
..htmlUrl = json['html_url'] as String
..columnsUrl = json['columns_url'] as String
..name = json['name'] as String;
..htmlUrl = json['html_url'] as String?
..columnsUrl = json['columns_url'] as String?
..name = json['name'] as String?;
}
Map<String, dynamic> _$GithubProjectColumnItemToJson(
@ -361,18 +357,16 @@ Map<String, dynamic> _$GithubProjectColumnItemToJson(
GithubInstallationRepositoriesItem _$GithubInstallationRepositoriesItemFromJson(
Map<String, dynamic> json) {
return GithubInstallationRepositoriesItem()
..repositoriesAdded = (json['repositories_added'] as List)
?.map((e) => e == null
? null
: GithubNotificationItemRepo.fromJson(e as Map<String, dynamic>))
?.toList()
..repositoriesRemoved = (json['repositories_removed'] as List)
?.map((e) => e == null
? null
: GithubNotificationItemRepo.fromJson(e as Map<String, dynamic>))
?.toList()
..repositoriesSelection = json['repositories_selection'] as String
..id = json['id'] as int;
..repositoriesAdded = (json['repositories_added'] as List<dynamic>?)
?.map((e) =>
GithubNotificationItemRepo.fromJson(e as Map<String, dynamic>))
.toList()
..repositoriesRemoved = (json['repositories_removed'] as List<dynamic>?)
?.map((e) =>
GithubNotificationItemRepo.fromJson(e as Map<String, dynamic>))
.toList()
..repositoriesSelection = json['repositories_selection'] as String?
..id = json['id'] as int?;
}
Map<String, dynamic> _$GithubInstallationRepositoriesItemToJson(
@ -386,9 +380,9 @@ Map<String, dynamic> _$GithubInstallationRepositoriesItemToJson(
GithubCheckrunItem _$GithubCheckrunItemFromJson(Map<String, dynamic> json) {
return GithubCheckrunItem()
..status = json['status'] as String
..name = json['name'] as String
..id = json['id'] as int;
..status = json['status'] as String?
..name = json['name'] as String?
..id = json['id'] as int?;
}
Map<String, dynamic> _$GithubCheckrunItemToJson(GithubCheckrunItem instance) =>
@ -400,8 +394,8 @@ Map<String, dynamic> _$GithubCheckrunItemToJson(GithubCheckrunItem instance) =>
GithubCheckSuiteItem _$GithubCheckSuiteItemFromJson(Map<String, dynamic> json) {
return GithubCheckSuiteItem()
..status = json['status'] as String
..conclusion = json['conclusion'] as String;
..status = json['status'] as String?
..conclusion = json['conclusion'] as String?;
}
Map<String, dynamic> _$GithubCheckSuiteItemToJson(
@ -414,8 +408,8 @@ Map<String, dynamic> _$GithubCheckSuiteItemToJson(
GithubContentReferenceItem _$GithubContentReferenceItemFromJson(
Map<String, dynamic> json) {
return GithubContentReferenceItem()
..id = json['id'] as int
..reference = json['reference'] as String;
..id = json['id'] as int?
..reference = json['reference'] as String?;
}
Map<String, dynamic> _$GithubContentReferenceItemToJson(
@ -428,11 +422,11 @@ Map<String, dynamic> _$GithubContentReferenceItemToJson(
GithubContributorItem _$GithubContributorItemFromJson(
Map<String, dynamic> json) {
return GithubContributorItem()
..id = json['id'] as int
..login = json['login'] as String
..avatarUrl = json['avatar_url'] as String
..htmlUrl = json['html_url'] as String
..contributions = json['contributions'] as int;
..id = json['id'] as int?
..login = json['login'] as String?
..avatarUrl = json['avatar_url'] as String?
..htmlUrl = json['html_url'] as String?
..contributions = json['contributions'] as int?;
}
Map<String, dynamic> _$GithubContributorItemToJson(
@ -448,11 +442,11 @@ Map<String, dynamic> _$GithubContributorItemToJson(
GithubUserOrganizationItem _$GithubUserOrganizationItemFromJson(
Map<String, dynamic> json) {
return GithubUserOrganizationItem()
..id = json['id'] as int
..login = json['login'] as String
..avatarUrl = json['avatar_url'] as String
..description = json['description'] as String
..url = json['url'] as String;
..id = json['id'] as int?
..login = json['login'] as String?
..avatarUrl = json['avatar_url'] as String?
..description = json['description'] as String?
..url = json['url'] as String?;
}
Map<String, dynamic> _$GithubUserOrganizationItemToJson(
@ -467,13 +461,13 @@ Map<String, dynamic> _$GithubUserOrganizationItemToJson(
GistFiles _$GistFilesFromJson(Map<String, dynamic> json) {
return GistFiles(
filename: json['filename'] as String,
size: json['size'] as int,
rawUrl: json['raw_url'] as String,
type: json['type'] as String,
language: json['language'] as String,
truncated: json['truncated'] as bool,
content: json['content'] as String,
filename: json['filename'] as String?,
size: json['size'] as int?,
rawUrl: json['raw_url'] as String?,
type: json['type'] as String?,
language: json['language'] as String?,
truncated: json['truncated'] as bool?,
content: json['content'] as String?,
);
}
@ -489,12 +483,11 @@ Map<String, dynamic> _$GistFilesToJson(GistFiles instance) => <String, dynamic>{
GithubGistsItem _$GithubGistsItemFromJson(Map<String, dynamic> json) {
return GithubGistsItem()
..id = json['id'] as String
..description = json['description'] as String
..public = json['public'] as bool
..files = (json['files'] as Map<String, dynamic>)?.map(
(k, e) => MapEntry(
k, e == null ? null : GistFiles.fromJson(e as Map<String, dynamic>)),
..id = json['id'] as String?
..description = json['description'] as String?
..public = json['public'] as bool?
..files = (json['files'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, GistFiles.fromJson(e as Map<String, dynamic>)),
)
..owner = json['owner'] == null
? null
@ -520,12 +513,12 @@ Map<String, dynamic> _$GithubGistsItemToJson(GithubGistsItem instance) =>
GithubFilesItem _$GithubFilesItemFromJson(Map<String, dynamic> json) {
return GithubFilesItem()
..filename = json['filename'] as String
..status = json['status'] as String
..additions = json['additions'] as int
..deletions = json['deletions'] as int
..changes = json['changes'] as int
..patch = json['patch'] as String;
..filename = json['filename'] as String?
..status = json['status'] as String?
..additions = json['additions'] as int?
..deletions = json['deletions'] as int?
..changes = json['changes'] as int?
..patch = json['patch'] as String?;
}
Map<String, dynamic> _$GithubFilesItemToJson(GithubFilesItem instance) =>
@ -540,14 +533,12 @@ Map<String, dynamic> _$GithubFilesItemToJson(GithubFilesItem instance) =>
GithubComparisonItem _$GithubComparisonItemFromJson(Map<String, dynamic> json) {
return GithubComparisonItem()
..files = (json['files'] as List)
?.map((e) => e == null
? null
: GithubFilesItem.fromJson(e as Map<String, dynamic>))
?.toList()
..status = json['status'] as String
..aheadBy = json['ahead_by'] as int
..behindBy = json['behind_by'] as int;
..files = (json['files'] as List<dynamic>?)
?.map((e) => GithubFilesItem.fromJson(e as Map<String, dynamic>))
.toList()
..status = json['status'] as String?
..aheadBy = json['ahead_by'] as int?
..behindBy = json['behind_by'] as int?;
}
Map<String, dynamic> _$GithubComparisonItemToJson(

View File

@ -4,13 +4,13 @@ part 'gitlab.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabUser {
int id;
String username;
String name;
String avatarUrl;
String bio;
DateTime createdAt;
int accessLevel;
int? id;
String? username;
String? name;
String? avatarUrl;
String? bio;
DateTime? createdAt;
int? accessLevel;
GitlabUser();
factory GitlabUser.fromJson(Map<String, dynamic> json) =>
_$GitlabUserFromJson(json);
@ -18,12 +18,12 @@ class GitlabUser {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabGroup {
int id;
String path;
String name;
String avatarUrl;
String description;
List<GitlabProject> projects;
int? id;
String? path;
String? name;
String? avatarUrl;
String? description;
List<GitlabProject>? projects;
GitlabGroup();
factory GitlabGroup.fromJson(Map<String, dynamic> json) =>
_$GitlabGroupFromJson(json);
@ -31,7 +31,7 @@ class GitlabGroup {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTodoProject {
String pathWithNamespace;
String? pathWithNamespace;
GitlabTodoProject();
factory GitlabTodoProject.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoProjectFromJson(json);
@ -39,11 +39,11 @@ class GitlabTodoProject {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTodo {
GitlabUser author;
GitlabTodoProject project;
String actionName;
String targetType;
GitlabTodoTarget target;
GitlabUser? author;
GitlabTodoProject? project;
String? actionName;
String? targetType;
GitlabTodoTarget? target;
GitlabTodo();
factory GitlabTodo.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoFromJson(json);
@ -51,12 +51,12 @@ class GitlabTodo {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTodoTarget {
int iid;
int projectId;
String title;
GitlabUser author;
String description;
DateTime createdAt;
int? iid;
int? projectId;
String? title;
GitlabUser? author;
String? description;
DateTime? createdAt;
GitlabTodoTarget();
factory GitlabTodoTarget.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoTargetFromJson(json);
@ -64,10 +64,10 @@ class GitlabTodoTarget {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabIssueNote {
GitlabUser author;
String body;
bool system;
DateTime createdAt;
GitlabUser? author;
String? body;
bool? system;
DateTime? createdAt;
GitlabIssueNote();
factory GitlabIssueNote.fromJson(Map<String, dynamic> json) =>
_$GitlabIssueNoteFromJson(json);
@ -75,24 +75,24 @@ class GitlabIssueNote {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProject {
int id;
String name;
String avatarUrl;
String description;
int starCount;
int forksCount;
String visibility;
String readmeUrl;
String webUrl;
GitlabProjectNamespace namespace;
GitlabUser owner;
bool issuesEnabled;
int openIssuesCount;
bool mergeRequestsEnabled;
GitlabProjectStatistics statistics;
DateTime lastActivityAt;
DateTime createdAt;
String defaultBranch;
int? id;
String? name;
String? avatarUrl;
String? description;
int? starCount;
int? forksCount;
String? visibility;
String? readmeUrl;
String? webUrl;
GitlabProjectNamespace? namespace;
GitlabUser? owner;
bool? issuesEnabled;
int? openIssuesCount;
bool? mergeRequestsEnabled;
GitlabProjectStatistics? statistics;
DateTime? lastActivityAt;
DateTime? createdAt;
String? defaultBranch;
GitlabProject();
factory GitlabProject.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectFromJson(json);
@ -100,7 +100,7 @@ class GitlabProject {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProjectBadge {
String renderedImageUrl;
String? renderedImageUrl;
GitlabProjectBadge();
factory GitlabProjectBadge.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectBadgeFromJson(json);
@ -108,8 +108,8 @@ class GitlabProjectBadge {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProjectStatistics {
int commitCount;
int repositorySize;
int? commitCount;
int? repositorySize;
GitlabProjectStatistics();
factory GitlabProjectStatistics.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectStatisticsFromJson(json);
@ -117,10 +117,10 @@ class GitlabProjectStatistics {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProjectNamespace {
int id;
String name;
String path;
String kind;
int? id;
String? name;
String? path;
String? kind;
GitlabProjectNamespace();
factory GitlabProjectNamespace.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectNamespaceFromJson(json);
@ -128,9 +128,9 @@ class GitlabProjectNamespace {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTreeItem {
String type;
String path;
String name;
String? type;
String? path;
String? name;
GitlabTreeItem();
factory GitlabTreeItem.fromJson(Map<String, dynamic> json) =>
_$GitlabTreeItemFromJson(json);
@ -138,7 +138,7 @@ class GitlabTreeItem {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabBlob {
String content;
String? content;
GitlabBlob();
factory GitlabBlob.fromJson(Map<String, dynamic> json) =>
_$GitlabBlobFromJson(json);
@ -146,10 +146,10 @@ class GitlabBlob {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabEvent {
GitlabUser author;
String actionName;
String targetType;
GitlabEventNote note;
GitlabUser? author;
String? actionName;
String? targetType;
GitlabEventNote? note;
GitlabEvent();
factory GitlabEvent.fromJson(Map<String, dynamic> json) =>
_$GitlabEventFromJson(json);
@ -157,9 +157,9 @@ class GitlabEvent {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabEventNote {
String body;
String noteableType;
int noteableIid;
String? body;
String? noteableType;
int? noteableIid;
GitlabEventNote();
factory GitlabEventNote.fromJson(Map<String, dynamic> json) =>
_$GitlabEventNoteFromJson(json);
@ -167,12 +167,12 @@ class GitlabEventNote {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabCommit {
String id;
String shortId;
String title;
DateTime createdAt;
String authorName;
String message;
String? id;
String? shortId;
String? title;
DateTime? createdAt;
String? authorName;
String? message;
GitlabCommit();
factory GitlabCommit.fromJson(Map<String, dynamic> json) =>
_$GitlabCommitFromJson(json);
@ -180,9 +180,9 @@ class GitlabCommit {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabDiff {
String diff;
String newPath;
String oldPath;
String? diff;
String? newPath;
String? oldPath;
GitlabDiff();
factory GitlabDiff.fromJson(Map<String, dynamic> json) =>
_$GitlabDiffFromJson(json);
@ -190,13 +190,13 @@ class GitlabDiff {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabIssue {
String title;
int iid;
int projectId;
GitlabUser author;
int userNotesCount;
DateTime updatedAt;
List<String> labels;
String? title;
int? iid;
int? projectId;
GitlabUser? author;
int? userNotesCount;
DateTime? updatedAt;
List<String>? labels;
GitlabIssue();
factory GitlabIssue.fromJson(Map<String, dynamic> json) =>
_$GitlabIssueFromJson(json);
@ -204,8 +204,8 @@ class GitlabIssue {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabStarrer {
DateTime starredSince;
GitlabUser user;
DateTime? starredSince;
GitlabUser? user;
GitlabStarrer();
factory GitlabStarrer.fromJson(Map<String, dynamic> json) =>
_$GitlabStarrerFromJson(json);
@ -213,8 +213,8 @@ class GitlabStarrer {
@JsonSerializable(fieldRename: FieldRename.snake)
class GitlabBranch {
String name;
bool merged;
String? name;
bool? merged;
GitlabBranch();
factory GitlabBranch.fromJson(Map<String, dynamic> json) =>
_$GitlabBranchFromJson(json);

View File

@ -8,15 +8,15 @@ part of 'gitlab.dart';
GitlabUser _$GitlabUserFromJson(Map<String, dynamic> json) {
return GitlabUser()
..id = json['id'] as int
..username = json['username'] as String
..name = json['name'] as String
..avatarUrl = json['avatar_url'] as String
..bio = json['bio'] as String
..id = json['id'] as int?
..username = json['username'] as String?
..name = json['name'] as String?
..avatarUrl = json['avatar_url'] as String?
..bio = json['bio'] as String?
..createdAt = json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String)
..accessLevel = json['access_level'] as int;
..accessLevel = json['access_level'] as int?;
}
Map<String, dynamic> _$GitlabUserToJson(GitlabUser instance) =>
@ -32,16 +32,14 @@ Map<String, dynamic> _$GitlabUserToJson(GitlabUser instance) =>
GitlabGroup _$GitlabGroupFromJson(Map<String, dynamic> json) {
return GitlabGroup()
..id = json['id'] as int
..path = json['path'] as String
..name = json['name'] as String
..avatarUrl = json['avatar_url'] as String
..description = json['description'] as String
..projects = (json['projects'] as List)
?.map((e) => e == null
? null
: GitlabProject.fromJson(e as Map<String, dynamic>))
?.toList();
..id = json['id'] as int?
..path = json['path'] as String?
..name = json['name'] as String?
..avatarUrl = json['avatar_url'] as String?
..description = json['description'] as String?
..projects = (json['projects'] as List<dynamic>?)
?.map((e) => GitlabProject.fromJson(e as Map<String, dynamic>))
.toList();
}
Map<String, dynamic> _$GitlabGroupToJson(GitlabGroup instance) =>
@ -56,7 +54,7 @@ Map<String, dynamic> _$GitlabGroupToJson(GitlabGroup instance) =>
GitlabTodoProject _$GitlabTodoProjectFromJson(Map<String, dynamic> json) {
return GitlabTodoProject()
..pathWithNamespace = json['path_with_namespace'] as String;
..pathWithNamespace = json['path_with_namespace'] as String?;
}
Map<String, dynamic> _$GitlabTodoProjectToJson(GitlabTodoProject instance) =>
@ -72,8 +70,8 @@ GitlabTodo _$GitlabTodoFromJson(Map<String, dynamic> json) {
..project = json['project'] == null
? null
: GitlabTodoProject.fromJson(json['project'] as Map<String, dynamic>)
..actionName = json['action_name'] as String
..targetType = json['target_type'] as String
..actionName = json['action_name'] as String?
..targetType = json['target_type'] as String?
..target = json['target'] == null
? null
: GitlabTodoTarget.fromJson(json['target'] as Map<String, dynamic>);
@ -90,13 +88,13 @@ Map<String, dynamic> _$GitlabTodoToJson(GitlabTodo instance) =>
GitlabTodoTarget _$GitlabTodoTargetFromJson(Map<String, dynamic> json) {
return GitlabTodoTarget()
..iid = json['iid'] as int
..projectId = json['project_id'] as int
..title = json['title'] as String
..iid = json['iid'] as int?
..projectId = json['project_id'] as int?
..title = json['title'] as String?
..author = json['author'] == null
? null
: GitlabUser.fromJson(json['author'] as Map<String, dynamic>)
..description = json['description'] as String
..description = json['description'] as String?
..createdAt = json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String);
@ -117,8 +115,8 @@ GitlabIssueNote _$GitlabIssueNoteFromJson(Map<String, dynamic> json) {
..author = json['author'] == null
? null
: GitlabUser.fromJson(json['author'] as Map<String, dynamic>)
..body = json['body'] as String
..system = json['system'] as bool
..body = json['body'] as String?
..system = json['system'] as bool?
..createdAt = json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String);
@ -134,15 +132,15 @@ Map<String, dynamic> _$GitlabIssueNoteToJson(GitlabIssueNote instance) =>
GitlabProject _$GitlabProjectFromJson(Map<String, dynamic> json) {
return GitlabProject()
..id = json['id'] as int
..name = json['name'] as String
..avatarUrl = json['avatar_url'] as String
..description = json['description'] as String
..starCount = json['star_count'] as int
..forksCount = json['forks_count'] as int
..visibility = json['visibility'] as String
..readmeUrl = json['readme_url'] as String
..webUrl = json['web_url'] as String
..id = json['id'] as int?
..name = json['name'] as String?
..avatarUrl = json['avatar_url'] as String?
..description = json['description'] as String?
..starCount = json['star_count'] as int?
..forksCount = json['forks_count'] as int?
..visibility = json['visibility'] as String?
..readmeUrl = json['readme_url'] as String?
..webUrl = json['web_url'] as String?
..namespace = json['namespace'] == null
? null
: GitlabProjectNamespace.fromJson(
@ -150,9 +148,9 @@ GitlabProject _$GitlabProjectFromJson(Map<String, dynamic> json) {
..owner = json['owner'] == null
? null
: GitlabUser.fromJson(json['owner'] as Map<String, dynamic>)
..issuesEnabled = json['issues_enabled'] as bool
..openIssuesCount = json['open_issues_count'] as int
..mergeRequestsEnabled = json['merge_requests_enabled'] as bool
..issuesEnabled = json['issues_enabled'] as bool?
..openIssuesCount = json['open_issues_count'] as int?
..mergeRequestsEnabled = json['merge_requests_enabled'] as bool?
..statistics = json['statistics'] == null
? null
: GitlabProjectStatistics.fromJson(
@ -163,7 +161,7 @@ GitlabProject _$GitlabProjectFromJson(Map<String, dynamic> json) {
..createdAt = json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String)
..defaultBranch = json['default_branch'] as String;
..defaultBranch = json['default_branch'] as String?;
}
Map<String, dynamic> _$GitlabProjectToJson(GitlabProject instance) =>
@ -190,7 +188,7 @@ Map<String, dynamic> _$GitlabProjectToJson(GitlabProject instance) =>
GitlabProjectBadge _$GitlabProjectBadgeFromJson(Map<String, dynamic> json) {
return GitlabProjectBadge()
..renderedImageUrl = json['rendered_image_url'] as String;
..renderedImageUrl = json['rendered_image_url'] as String?;
}
Map<String, dynamic> _$GitlabProjectBadgeToJson(GitlabProjectBadge instance) =>
@ -201,8 +199,8 @@ Map<String, dynamic> _$GitlabProjectBadgeToJson(GitlabProjectBadge instance) =>
GitlabProjectStatistics _$GitlabProjectStatisticsFromJson(
Map<String, dynamic> json) {
return GitlabProjectStatistics()
..commitCount = json['commit_count'] as int
..repositorySize = json['repository_size'] as int;
..commitCount = json['commit_count'] as int?
..repositorySize = json['repository_size'] as int?;
}
Map<String, dynamic> _$GitlabProjectStatisticsToJson(
@ -215,10 +213,10 @@ Map<String, dynamic> _$GitlabProjectStatisticsToJson(
GitlabProjectNamespace _$GitlabProjectNamespaceFromJson(
Map<String, dynamic> json) {
return GitlabProjectNamespace()
..id = json['id'] as int
..name = json['name'] as String
..path = json['path'] as String
..kind = json['kind'] as String;
..id = json['id'] as int?
..name = json['name'] as String?
..path = json['path'] as String?
..kind = json['kind'] as String?;
}
Map<String, dynamic> _$GitlabProjectNamespaceToJson(
@ -232,9 +230,9 @@ Map<String, dynamic> _$GitlabProjectNamespaceToJson(
GitlabTreeItem _$GitlabTreeItemFromJson(Map<String, dynamic> json) {
return GitlabTreeItem()
..type = json['type'] as String
..path = json['path'] as String
..name = json['name'] as String;
..type = json['type'] as String?
..path = json['path'] as String?
..name = json['name'] as String?;
}
Map<String, dynamic> _$GitlabTreeItemToJson(GitlabTreeItem instance) =>
@ -245,7 +243,7 @@ Map<String, dynamic> _$GitlabTreeItemToJson(GitlabTreeItem instance) =>
};
GitlabBlob _$GitlabBlobFromJson(Map<String, dynamic> json) {
return GitlabBlob()..content = json['content'] as String;
return GitlabBlob()..content = json['content'] as String?;
}
Map<String, dynamic> _$GitlabBlobToJson(GitlabBlob instance) =>
@ -258,8 +256,8 @@ GitlabEvent _$GitlabEventFromJson(Map<String, dynamic> json) {
..author = json['author'] == null
? null
: GitlabUser.fromJson(json['author'] as Map<String, dynamic>)
..actionName = json['action_name'] as String
..targetType = json['target_type'] as String
..actionName = json['action_name'] as String?
..targetType = json['target_type'] as String?
..note = json['note'] == null
? null
: GitlabEventNote.fromJson(json['note'] as Map<String, dynamic>);
@ -275,9 +273,9 @@ Map<String, dynamic> _$GitlabEventToJson(GitlabEvent instance) =>
GitlabEventNote _$GitlabEventNoteFromJson(Map<String, dynamic> json) {
return GitlabEventNote()
..body = json['body'] as String
..noteableType = json['noteable_type'] as String
..noteableIid = json['noteable_iid'] as int;
..body = json['body'] as String?
..noteableType = json['noteable_type'] as String?
..noteableIid = json['noteable_iid'] as int?;
}
Map<String, dynamic> _$GitlabEventNoteToJson(GitlabEventNote instance) =>
@ -289,14 +287,14 @@ Map<String, dynamic> _$GitlabEventNoteToJson(GitlabEventNote instance) =>
GitlabCommit _$GitlabCommitFromJson(Map<String, dynamic> json) {
return GitlabCommit()
..id = json['id'] as String
..shortId = json['short_id'] as String
..title = json['title'] as String
..id = json['id'] as String?
..shortId = json['short_id'] as String?
..title = json['title'] as String?
..createdAt = json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String)
..authorName = json['author_name'] as String
..message = json['message'] as String;
..authorName = json['author_name'] as String?
..message = json['message'] as String?;
}
Map<String, dynamic> _$GitlabCommitToJson(GitlabCommit instance) =>
@ -311,9 +309,9 @@ Map<String, dynamic> _$GitlabCommitToJson(GitlabCommit instance) =>
GitlabDiff _$GitlabDiffFromJson(Map<String, dynamic> json) {
return GitlabDiff()
..diff = json['diff'] as String
..newPath = json['new_path'] as String
..oldPath = json['old_path'] as String;
..diff = json['diff'] as String?
..newPath = json['new_path'] as String?
..oldPath = json['old_path'] as String?;
}
Map<String, dynamic> _$GitlabDiffToJson(GitlabDiff instance) =>
@ -325,17 +323,18 @@ Map<String, dynamic> _$GitlabDiffToJson(GitlabDiff instance) =>
GitlabIssue _$GitlabIssueFromJson(Map<String, dynamic> json) {
return GitlabIssue()
..title = json['title'] as String
..iid = json['iid'] as int
..projectId = json['project_id'] as int
..title = json['title'] as String?
..iid = json['iid'] as int?
..projectId = json['project_id'] as int?
..author = json['author'] == null
? null
: GitlabUser.fromJson(json['author'] as Map<String, dynamic>)
..userNotesCount = json['user_notes_count'] as int
..userNotesCount = json['user_notes_count'] as int?
..updatedAt = json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String)
..labels = (json['labels'] as List)?.map((e) => e as String)?.toList();
..labels =
(json['labels'] as List<dynamic>?)?.map((e) => e as String).toList();
}
Map<String, dynamic> _$GitlabIssueToJson(GitlabIssue instance) =>
@ -367,8 +366,8 @@ Map<String, dynamic> _$GitlabStarrerToJson(GitlabStarrer instance) =>
GitlabBranch _$GitlabBranchFromJson(Map<String, dynamic> json) {
return GitlabBranch()
..name = json['name'] as String
..merged = json['merged'] as bool;
..name = json['name'] as String?
..merged = json['merged'] as bool?;
}
Map<String, dynamic> _$GitlabBranchToJson(GitlabBranch instance) =>

View File

@ -4,11 +4,11 @@ part 'gogs.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsUser {
int id;
String username;
String fullName;
String avatarUrl;
String email;
int? id;
String? username;
String? fullName;
String? avatarUrl;
String? email;
GogsUser();
factory GogsUser.fromJson(Map<String, dynamic> json) =>
_$GogsUserFromJson(json);
@ -16,19 +16,19 @@ class GogsUser {
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsRepository {
int id;
String fullName;
bool private;
GogsUser owner;
String htmlUrl;
String description;
String defaultBranch;
DateTime createdAt;
DateTime updatedAt;
int starsCount;
int forksCount;
String website;
int watchersCount;
int? id;
String? fullName;
bool? private;
GogsUser? owner;
String? htmlUrl;
String? description;
String? defaultBranch;
DateTime? createdAt;
DateTime? updatedAt;
int? starsCount;
int? forksCount;
String? website;
int? watchersCount;
GogsRepository();
factory GogsRepository.fromJson(Map<String, dynamic> json) =>
_$GogsRepositoryFromJson(json);
@ -36,13 +36,13 @@ class GogsRepository {
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsOrg {
int id;
String username;
String fullName;
String avatarUrl;
String description;
String location;
String website;
int? id;
String? username;
String? fullName;
String? avatarUrl;
String? description;
String? location;
String? website;
GogsOrg();
factory GogsOrg.fromJson(Map<String, dynamic> json) =>
_$GogsOrgFromJson(json);
@ -50,11 +50,11 @@ class GogsOrg {
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsTree {
String type;
String name;
String path;
int size;
String downloadUrl;
String? type;
String? name;
String? path;
int? size;
String? downloadUrl;
GogsTree();
factory GogsTree.fromJson(Map<String, dynamic> json) =>
_$GogsTreeFromJson(json);
@ -62,7 +62,7 @@ class GogsTree {
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsBlob extends GogsTree {
String content;
String? content;
GogsBlob();
factory GogsBlob.fromJson(Map<String, dynamic> json) =>
_$GogsBlobFromJson(json);
@ -70,7 +70,7 @@ class GogsBlob extends GogsTree {
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsBranch {
String name;
String? name;
GogsBranch();
factory GogsBranch.fromJson(Map<String, dynamic> json) =>
_$GogsBranchFromJson(json);
@ -78,10 +78,10 @@ class GogsBranch {
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsCommit {
GogsUser author;
GogsCommitDetail commit;
String sha;
String htmlUrl;
GogsUser? author;
GogsCommitDetail? commit;
String? sha;
String? htmlUrl;
GogsCommit();
factory GogsCommit.fromJson(Map<String, dynamic> json) =>
_$GogsCommitFromJson(json);
@ -89,9 +89,9 @@ class GogsCommit {
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsCommitDetail {
String message;
GogsCommitAuthor author;
GogsCommitAuthor committer;
String? message;
GogsCommitAuthor? author;
GogsCommitAuthor? committer;
GogsCommitDetail();
factory GogsCommitDetail.fromJson(Map<String, dynamic> json) =>
_$GogsCommitDetailFromJson(json);
@ -99,9 +99,9 @@ class GogsCommitDetail {
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsCommitAuthor {
String name;
String email;
DateTime date;
String? name;
String? email;
DateTime? date;
GogsCommitAuthor();
factory GogsCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$GogsCommitAuthorFromJson(json);
@ -109,15 +109,15 @@ class GogsCommitAuthor {
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsIssue {
int number;
String state;
String title;
String body;
GogsUser user;
List<GogsLabel> labels;
DateTime createdAt;
DateTime updatedAt;
int comments;
int? number;
String? state;
String? title;
String? body;
GogsUser? user;
List<GogsLabel>? labels;
DateTime? createdAt;
DateTime? updatedAt;
int? comments;
GogsIssue();
factory GogsIssue.fromJson(Map<String, dynamic> json) =>
_$GogsIssueFromJson(json);
@ -125,8 +125,8 @@ class GogsIssue {
@JsonSerializable(fieldRename: FieldRename.snake)
class GogsLabel {
String name;
String color;
String? name;
String? color;
GogsLabel();
factory GogsLabel.fromJson(Map<String, dynamic> json) =>
_$GogsLabelFromJson(json);

View File

@ -8,11 +8,11 @@ part of 'gogs.dart';
GogsUser _$GogsUserFromJson(Map<String, dynamic> json) {
return GogsUser()
..id = json['id'] as int
..username = json['username'] as String
..fullName = json['full_name'] as String
..avatarUrl = json['avatar_url'] as String
..email = json['email'] as String;
..id = json['id'] as int?
..username = json['username'] as String?
..fullName = json['full_name'] as String?
..avatarUrl = json['avatar_url'] as String?
..email = json['email'] as String?;
}
Map<String, dynamic> _$GogsUserToJson(GogsUser instance) => <String, dynamic>{
@ -25,25 +25,25 @@ Map<String, dynamic> _$GogsUserToJson(GogsUser instance) => <String, dynamic>{
GogsRepository _$GogsRepositoryFromJson(Map<String, dynamic> json) {
return GogsRepository()
..id = json['id'] as int
..fullName = json['full_name'] as String
..private = json['private'] as bool
..id = json['id'] as int?
..fullName = json['full_name'] as String?
..private = json['private'] as bool?
..owner = json['owner'] == null
? null
: GogsUser.fromJson(json['owner'] as Map<String, dynamic>)
..htmlUrl = json['html_url'] as String
..description = json['description'] as String
..defaultBranch = json['default_branch'] as String
..htmlUrl = json['html_url'] as String?
..description = json['description'] as String?
..defaultBranch = json['default_branch'] as String?
..createdAt = json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String)
..updatedAt = json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String)
..starsCount = json['stars_count'] as int
..forksCount = json['forks_count'] as int
..website = json['website'] as String
..watchersCount = json['watchers_count'] as int;
..starsCount = json['stars_count'] as int?
..forksCount = json['forks_count'] as int?
..website = json['website'] as String?
..watchersCount = json['watchers_count'] as int?;
}
Map<String, dynamic> _$GogsRepositoryToJson(GogsRepository instance) =>
@ -65,13 +65,13 @@ Map<String, dynamic> _$GogsRepositoryToJson(GogsRepository instance) =>
GogsOrg _$GogsOrgFromJson(Map<String, dynamic> json) {
return GogsOrg()
..id = json['id'] as int
..username = json['username'] as String
..fullName = json['full_name'] as String
..avatarUrl = json['avatar_url'] as String
..description = json['description'] as String
..location = json['location'] as String
..website = json['website'] as String;
..id = json['id'] as int?
..username = json['username'] as String?
..fullName = json['full_name'] as String?
..avatarUrl = json['avatar_url'] as String?
..description = json['description'] as String?
..location = json['location'] as String?
..website = json['website'] as String?;
}
Map<String, dynamic> _$GogsOrgToJson(GogsOrg instance) => <String, dynamic>{
@ -86,11 +86,11 @@ Map<String, dynamic> _$GogsOrgToJson(GogsOrg instance) => <String, dynamic>{
GogsTree _$GogsTreeFromJson(Map<String, dynamic> json) {
return GogsTree()
..type = json['type'] as String
..name = json['name'] as String
..path = json['path'] as String
..size = json['size'] as int
..downloadUrl = json['download_url'] as String;
..type = json['type'] as String?
..name = json['name'] as String?
..path = json['path'] as String?
..size = json['size'] as int?
..downloadUrl = json['download_url'] as String?;
}
Map<String, dynamic> _$GogsTreeToJson(GogsTree instance) => <String, dynamic>{
@ -103,12 +103,12 @@ Map<String, dynamic> _$GogsTreeToJson(GogsTree instance) => <String, dynamic>{
GogsBlob _$GogsBlobFromJson(Map<String, dynamic> json) {
return GogsBlob()
..type = json['type'] as String
..name = json['name'] as String
..path = json['path'] as String
..size = json['size'] as int
..downloadUrl = json['download_url'] as String
..content = json['content'] as String;
..type = json['type'] as String?
..name = json['name'] as String?
..path = json['path'] as String?
..size = json['size'] as int?
..downloadUrl = json['download_url'] as String?
..content = json['content'] as String?;
}
Map<String, dynamic> _$GogsBlobToJson(GogsBlob instance) => <String, dynamic>{
@ -121,7 +121,7 @@ Map<String, dynamic> _$GogsBlobToJson(GogsBlob instance) => <String, dynamic>{
};
GogsBranch _$GogsBranchFromJson(Map<String, dynamic> json) {
return GogsBranch()..name = json['name'] as String;
return GogsBranch()..name = json['name'] as String?;
}
Map<String, dynamic> _$GogsBranchToJson(GogsBranch instance) =>
@ -137,8 +137,8 @@ GogsCommit _$GogsCommitFromJson(Map<String, dynamic> json) {
..commit = json['commit'] == null
? null
: GogsCommitDetail.fromJson(json['commit'] as Map<String, dynamic>)
..sha = json['sha'] as String
..htmlUrl = json['html_url'] as String;
..sha = json['sha'] as String?
..htmlUrl = json['html_url'] as String?;
}
Map<String, dynamic> _$GogsCommitToJson(GogsCommit instance) =>
@ -151,7 +151,7 @@ Map<String, dynamic> _$GogsCommitToJson(GogsCommit instance) =>
GogsCommitDetail _$GogsCommitDetailFromJson(Map<String, dynamic> json) {
return GogsCommitDetail()
..message = json['message'] as String
..message = json['message'] as String?
..author = json['author'] == null
? null
: GogsCommitAuthor.fromJson(json['author'] as Map<String, dynamic>)
@ -169,8 +169,8 @@ Map<String, dynamic> _$GogsCommitDetailToJson(GogsCommitDetail instance) =>
GogsCommitAuthor _$GogsCommitAuthorFromJson(Map<String, dynamic> json) {
return GogsCommitAuthor()
..name = json['name'] as String
..email = json['email'] as String
..name = json['name'] as String?
..email = json['email'] as String?
..date =
json['date'] == null ? null : DateTime.parse(json['date'] as String);
}
@ -184,24 +184,23 @@ Map<String, dynamic> _$GogsCommitAuthorToJson(GogsCommitAuthor instance) =>
GogsIssue _$GogsIssueFromJson(Map<String, dynamic> json) {
return GogsIssue()
..number = json['number'] as int
..state = json['state'] as String
..title = json['title'] as String
..body = json['body'] as String
..number = json['number'] as int?
..state = json['state'] as String?
..title = json['title'] as String?
..body = json['body'] as String?
..user = json['user'] == null
? null
: GogsUser.fromJson(json['user'] as Map<String, dynamic>)
..labels = (json['labels'] as List)
?.map((e) =>
e == null ? null : GogsLabel.fromJson(e as Map<String, dynamic>))
?.toList()
..labels = (json['labels'] as List<dynamic>?)
?.map((e) => GogsLabel.fromJson(e as Map<String, dynamic>))
.toList()
..createdAt = json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String)
..updatedAt = json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String)
..comments = json['comments'] as int;
..comments = json['comments'] as int?;
}
Map<String, dynamic> _$GogsIssueToJson(GogsIssue instance) => <String, dynamic>{
@ -218,8 +217,8 @@ Map<String, dynamic> _$GogsIssueToJson(GogsIssue instance) => <String, dynamic>{
GogsLabel _$GogsLabelFromJson(Map<String, dynamic> json) {
return GogsLabel()
..name = json['name'] as String
..color = json['color'] as String;
..name = json['name'] as String?
..color = json['color'] as String?;
}
Map<String, dynamic> _$GogsLabelToJson(GogsLabel instance) => <String, dynamic>{

View File

@ -5,22 +5,22 @@ import 'package:tuple/tuple.dart';
import '../utils/utils.dart';
class NotificationGroup {
String fullName;
String? fullName;
List<GithubNotificationItem> items = [];
Tuple2<String, String> _repo;
Tuple2<String, String>? _repo;
String get owner {
if (_repo == null) {
_repo = parseRepositoryFullName(fullName);
_repo = parseRepositoryFullName(fullName!);
}
return _repo.item1;
return _repo!.item1;
}
String get name {
if (_repo == null) {
_repo = parseRepositoryFullName(fullName);
_repo = parseRepositoryFullName(fullName!);
}
return _repo.item2;
return _repo!.item2;
}
String get key => '_$hashCode';

View File

@ -11,12 +11,6 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class DialogOption<T> {
final T value;
final Widget widget;
DialogOption({this.value, this.widget});
}
class AppThemeType {
static const material = 0;
static const cupertino = 1;
@ -42,19 +36,19 @@ class AppMarkdownType {
class PickerItem<T> {
final T value;
final String text;
PickerItem(this.value, {@required this.text});
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;
final Function(T value)? onChange;
final Function(T value)? onClose;
PickerGroupItem({
@required this.value,
@required this.items,
required this.value,
required this.items,
this.onChange,
this.onClose,
});
@ -63,18 +57,18 @@ class PickerGroupItem<T> {
class SelectorItem<T> {
T value;
String text;
SelectorItem({@required this.value, @required this.text});
SelectorItem({required this.value, required this.text});
}
// No animation. For replacing route
// TODO: Go back
class StaticRoute extends PageRouteBuilder {
final WidgetBuilder builder;
final WidgetBuilder? builder;
StaticRoute({this.builder})
: super(
pageBuilder: (BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) {
return builder(context);
return builder!(context);
},
transitionsBuilder: (BuildContext context,
Animation<double> animation,
@ -95,21 +89,21 @@ class Palette {
final Color border;
const Palette({
this.primary,
this.text,
this.secondaryText,
this.tertiaryText,
this.background,
this.grayBackground,
this.border,
required this.primary,
required this.text,
required this.secondaryText,
required this.tertiaryText,
required this.background,
required this.grayBackground,
required this.border,
});
}
class ThemeModel with ChangeNotifier {
String markdownCss;
String? markdownCss;
int _theme;
int get theme => _theme;
int? _theme;
int? get theme => _theme;
bool get ready => _theme != null;
Brightness systemBrightness = Brightness.light;
@ -122,8 +116,8 @@ class ThemeModel with ChangeNotifier {
}
}
int _brightnessValue = AppBrightnessType.followSystem;
int get brighnessValue => _brightnessValue;
int? _brightnessValue = AppBrightnessType.followSystem;
int? get brighnessValue => _brightnessValue;
// could be null
Brightness get brightness {
@ -146,8 +140,8 @@ class ThemeModel with ChangeNotifier {
}
// markdown render engine
int _markdown;
int get markdown => _markdown;
int? _markdown;
int? get markdown => _markdown;
Future<void> setMarkdown(int v) async {
_markdown = v;
final prefs = await SharedPreferences.getInstance();
@ -169,8 +163,8 @@ class ThemeModel with ChangeNotifier {
}
// supported languages
String _locale;
String get locale => _locale;
String? _locale;
String? get locale => _locale;
Future<void> setLocale(String v) async {
_locale = v;
@ -284,7 +278,7 @@ class ThemeModel with ChangeNotifier {
);
}
Future<bool> showConfirm(BuildContext context, Widget content) {
Future<bool?> showConfirm(BuildContext context, Widget content) {
return showCupertinoDialog(
context: context,
builder: (context) {
@ -333,10 +327,10 @@ class ThemeModel with ChangeNotifier {
// );
}
static Timer _debounce;
String _selectedItem;
static Timer? _debounce;
String? _selectedItem;
showPicker(BuildContext context, PickerGroupItem<String> groupItem) async {
showPicker(BuildContext context, PickerGroupItem<String?> groupItem) async {
await showCupertinoModalPopup(
context: context,
builder: (context) {
@ -372,7 +366,7 @@ class ThemeModel with ChangeNotifier {
child: Text('Confirm'),
onPressed: () {
Navigator.pop(context);
groupItem.onClose(_selectedItem);
groupItem.onClose!(_selectedItem);
},
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
@ -388,7 +382,7 @@ class ThemeModel with ChangeNotifier {
backgroundColor: palette.background,
children: <Widget>[
for (var v in groupItem.items)
Text(v.text, style: TextStyle(color: palette.text)),
Text(v.text!, style: TextStyle(color: palette.text)),
],
itemExtent: 40,
scrollController: FixedExtentScrollController(
@ -400,11 +394,11 @@ class ThemeModel with ChangeNotifier {
if (groupItem.onChange != null) {
if (_debounce?.isActive ?? false) {
_debounce.cancel();
_debounce!.cancel();
}
_debounce = Timer(const Duration(milliseconds: 500), () {
groupItem.onChange(_selectedItem);
groupItem.onChange!(_selectedItem);
});
}
},
@ -425,7 +419,7 @@ class ThemeModel with ChangeNotifier {
title: Text('Actions'),
actions: actionItems.asMap().entries.map((entry) {
return CupertinoActionSheetAction(
child: Text(entry.value.text),
child: Text(entry.value.text!),
isDestructiveAction: entry.value.isDestructiveAction,
onPressed: () {
Navigator.pop(context, entry.key);
@ -444,7 +438,7 @@ class ThemeModel with ChangeNotifier {
);
if (value != null) {
actionItems[value].onTap(context);
actionItems[value].onTap!(context);
}
}
}

View File

@ -127,7 +127,7 @@ class GithubRouter {
GithubRouter.releases,
];
static final user = RouterScreen('/:login', (context, parameters) {
final login = parameters['login'].first;
final login = parameters['login']!.first;
final tab = parameters['tab']?.first;
switch (tab) {
case 'followers':
@ -154,94 +154,94 @@ class GithubRouter {
});
static final repo = RouterScreen('/:owner/:name', (context, parameters) {
if (parameters['ref'] == null) {
return GhRepoScreen(parameters['owner'].first, parameters['name'].first);
return GhRepoScreen(parameters['owner']!.first, parameters['name']!.first);
} else {
return GhRepoScreen(parameters['owner'].first, parameters['name'].first,
branch: parameters['ref'].first);
return GhRepoScreen(parameters['owner']!.first, parameters['name']!.first,
branch: parameters['ref']!.first);
}
});
static final gistObject =
RouterScreen('/:login/gists/:id/:file', (context, parameters) {
return GistObjectScreen(
parameters['login'].first,
parameters['id'].first,
parameters['file'].first,
parameters['login']!.first,
parameters['id']!.first,
parameters['file']!.first,
raw: parameters['raw']?.first,
content: parameters['content'].first,
content: parameters['content']!.first,
);
});
static final gistFiles =
RouterScreen('/:login/gists/:id', (context, parameters) {
return GhGistsFilesScreen(
parameters['login'].first, parameters['id'].first);
parameters['login']!.first, parameters['id']!.first);
});
static final issueAdd =
RouterScreen('/:owner/:name/issues/new', (context, parameters) {
return GhIssueFormScreen(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
});
static final issues = RouterScreen(
'/:owner/:name/issues',
(context, parameters) =>
GhIssuesScreen(parameters['owner'].first, parameters['name'].first));
GhIssuesScreen(parameters['owner']!.first, parameters['name']!.first));
static final pulls = RouterScreen(
'/:owner/:name/pulls',
(context, parameters) =>
GhPullsScreen(parameters['owner'].first, parameters['name'].first));
GhPullsScreen(parameters['owner']!.first, parameters['name']!.first));
static final issue = RouterScreen(
'/:owner/:name/issues/:number',
(context, parameters) => GhIssueScreen(parameters['owner'].first,
parameters['name'].first, int.parse(parameters['number'].first)));
(context, parameters) => GhIssueScreen(parameters['owner']!.first,
parameters['name']!.first, int.parse(parameters['number']!.first)));
static final pull = RouterScreen(
'/:owner/:name/pull/:number',
(context, parameters) => GhIssueScreen(parameters['owner'].first,
parameters['name'].first, int.parse(parameters['number'].first)));
(context, parameters) => GhIssueScreen(parameters['owner']!.first,
parameters['name']!.first, int.parse(parameters['number']!.first)));
static final files = RouterScreen(
'/:owner/:name/pull/:number/files',
(context, parameters) => GhFilesScreen(
parameters['owner'].first,
parameters['name'].first,
int.parse(parameters['number'].first),
parameters['owner']!.first,
parameters['name']!.first,
int.parse(parameters['number']!.first),
));
static final compare = RouterScreen(
'/:owner/:name/compare/:before/:head',
(context, parameters) => GhComparisonScreen(
parameters['owner'].first,
parameters['name'].first,
parameters['before'].first,
parameters['head'].first));
parameters['owner']!.first,
parameters['name']!.first,
parameters['before']!.first,
parameters['head']!.first));
static final commits = RouterScreen(
'/:owner/:name/commits/:branch',
(context, parameters) => GhCommits(
parameters['owner'].first, parameters['name'].first,
branch: parameters['branch'].first));
parameters['owner']!.first, parameters['name']!.first,
branch: parameters['branch']!.first));
static final object =
RouterScreen('/:owner/:name/blob/:ref', (context, parameters) {
return GhObjectScreen(
parameters['owner'].first,
parameters['name'].first,
parameters['ref'].first,
parameters['owner']!.first,
parameters['name']!.first,
parameters['ref']!.first,
path: parameters['path']?.first,
raw: parameters['raw']?.first,
);
});
static final stargazers =
RouterScreen('/:owner/:name/stargazers', (context, parameters) {
return GhStargazers(parameters['owner'].first, parameters['name'].first);
return GhStargazers(parameters['owner']!.first, parameters['name']!.first);
});
static final watchers =
RouterScreen('/:owner/:name/watchers', (context, parameters) {
return GhWachers(parameters['owner'].first, parameters['name'].first);
return GhWachers(parameters['owner']!.first, parameters['name']!.first);
});
static final contributors =
RouterScreen('/:owner/:name/contributors', (context, parameters) {
return GhContributorsScreen(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
});
static final releases =
RouterScreen('/:owner/:name/releases', (context, parameters) {
return GhReleasesScreen(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
});
}
@ -264,80 +264,80 @@ class GitlabRouter {
GitlabRouter.issue,
];
static final user = RouterScreen('/user/:id',
(context, parameters) => GlUserScreen(int.parse(parameters['id'].first)));
(context, parameters) => GlUserScreen(int.parse(parameters['id']!.first)));
static final group = RouterScreen(
'/group/:id',
(context, parameters) =>
GlGroupScreen(int.parse(parameters['id'].first)));
GlGroupScreen(int.parse(parameters['id']!.first)));
static final blob = RouterScreen(
'/projects/:id/blob/:ref',
(context, parameters) => GlBlobScreen(
int.parse(parameters['id'].first), parameters['ref'].first,
int.parse(parameters['id']!.first), parameters['ref']!.first,
path: parameters['path']?.first));
static final tree = RouterScreen(
'/projects/:id/tree/:ref',
(context, parameters) => GlTreeScreen(
int.parse(parameters['id'].first), parameters['ref'].first,
int.parse(parameters['id']!.first), parameters['ref']!.first,
path: parameters['path']?.first));
static final project = RouterScreen('/projects/:id', (context, parameters) {
if (parameters['branch'] == null) {
return GlProjectScreen(int.parse(parameters['id'].first));
return GlProjectScreen(int.parse(parameters['id']!.first));
} else {
return GlProjectScreen(int.parse(parameters['id'].first),
branch: parameters['branch'].first);
return GlProjectScreen(int.parse(parameters['id']!.first),
branch: parameters['branch']!.first);
}
});
static final starrers = RouterScreen(
'/projects/:id/starrers',
(context, parameters) =>
GlStarrersScreen(int.parse(parameters['id'].first)));
GlStarrersScreen(int.parse(parameters['id']!.first)));
static final issues = RouterScreen(
'/projects/:id/issues',
(context, parameters) => GlIssuesScreen(
parameters['id'].first,
prefix: parameters['prefix'].first,
parameters['id']!.first,
prefix: parameters['prefix']!.first,
));
static final mergeRequests = RouterScreen(
'/projects/:id/merge_requests',
(context, parameters) => GlMergeRequestsScreen(
parameters['id'].first,
prefix: parameters['prefix'].first,
parameters['id']!.first,
prefix: parameters['prefix']!.first,
));
static final commits =
RouterScreen('/projects/:id/commits', (context, parameters) {
if (parameters['branch'] == null) {
return GlCommitsScreen(parameters['id'].first,
prefix: parameters['prefix'].first);
return GlCommitsScreen(parameters['id']!.first,
prefix: parameters['prefix']!.first);
} else {
return GlCommitsScreen(parameters['id'].first,
prefix: parameters['prefix'].first,
branch: parameters['branch'].first);
return GlCommitsScreen(parameters['id']!.first,
prefix: parameters['prefix']!.first,
branch: parameters['branch']!.first);
}
});
static final commit = RouterScreen(
'/projects/:id/commit/:sha',
(context, parameters) =>
GlCommitScreen(parameters['id'].first, sha: parameters['sha'].first));
GlCommitScreen(parameters['id']!.first, sha: parameters['sha']!.first));
static final projectMembers = RouterScreen(
'/projects/:id/members',
(context, parameters) =>
GlMembersScreen(int.parse(parameters['id'].first), 'projects'));
GlMembersScreen(int.parse(parameters['id']!.first), 'projects'));
static final groupMembers = RouterScreen(
'/groups/:id/members',
(context, parameters) =>
GlMembersScreen(int.parse(parameters['id'].first), 'groups'));
GlMembersScreen(int.parse(parameters['id']!.first), 'groups'));
static final issue = RouterScreen(
'/projects/:id/issues/:iid',
(context, parameters) {
return GlIssueScreen(
int.parse(parameters['id'].first),
int.parse(parameters['iid'].first),
int.parse(parameters['id']!.first),
int.parse(parameters['iid']!.first),
);
},
);
static final issueAdd =
RouterScreen('/projects/:id/issues/new', (context, parameters) {
return GlIssueFormScreen(int.parse(parameters['id'].first));
return GlIssueFormScreen(int.parse(parameters['id']!.first));
});
}
@ -361,7 +361,7 @@ class GiteaRouter {
static final status =
RouterScreen('/status', (context, parameters) => GtStatusScreen());
static final user = RouterScreen('/:login', (context, parameters) {
final login = parameters['login'].first;
final login = parameters['login']!.first;
final tab = parameters['tab']?.first;
switch (tab) {
case 'followers':
@ -385,58 +385,58 @@ class GiteaRouter {
static final repo = RouterScreen(
'/:owner/:name',
(context, parameters) =>
GtRepoScreen(parameters['owner'].first, parameters['name'].first),
GtRepoScreen(parameters['owner']!.first, parameters['name']!.first),
);
static final object = RouterScreen(
'/:owner/:name/blob',
(context, parameters) => GtObjectScreen(
parameters['owner'].first,
parameters['name'].first,
parameters['owner']!.first,
parameters['name']!.first,
path: parameters['path']?.first,
),
);
static final stargazers =
RouterScreen('/:owner/:name/stargazers', (context, parameters) {
return GtUsersScreen.stargazers(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
});
static final watchers =
RouterScreen('/:owner/:name/watchers', (context, parameters) {
return GtUsersScreen.watchers(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
});
static final forks =
RouterScreen('/:owner/:name/forks', (context, parameters) {
return GtReposScreen.forks(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
});
static final commits = RouterScreen(
'/:owner/:name/commits',
(context, parameters) =>
GtCommitsScreen(parameters['owner'].first, parameters['name'].first));
GtCommitsScreen(parameters['owner']!.first, parameters['name']!.first));
static final issues = RouterScreen(
'/:owner/:name/issues',
(context, parameters) =>
GtIssuesScreen(parameters['owner'].first, parameters['name'].first));
GtIssuesScreen(parameters['owner']!.first, parameters['name']!.first));
static final pulls = RouterScreen(
'/:owner/:name/pulls',
(context, parameters) => GtIssuesScreen(
parameters['owner'].first, parameters['name'].first,
parameters['owner']!.first, parameters['name']!.first,
isPr: true));
static final issueAdd = RouterScreen(
'/:owner/:name/issues/new',
(context, parameters) => GtIssueFormScreen(
parameters['owner'].first, parameters['name'].first));
parameters['owner']!.first, parameters['name']!.first));
static final issue = RouterScreen(
'/:owner/:name/issues/:number',
(context, parameters) => GtIssueScreen(parameters['owner'].first,
parameters['name'].first, parameters['number'].first));
(context, parameters) => GtIssueScreen(parameters['owner']!.first,
parameters['name']!.first, parameters['number']!.first));
static final issueComment = RouterScreen(
'/:owner/:name/issues/:number/comment',
(context, parameters) => GtIssueCommentScreen(parameters['owner'].first,
parameters['name'].first, parameters['number'].first,
body: parameters['body'] != null ? parameters['body'].first : '',
id: parameters['id'] != null ? parameters['id'].first : ''));
(context, parameters) => GtIssueCommentScreen(parameters['owner']!.first,
parameters['name']!.first, parameters['number']!.first,
body: parameters['body'] != null ? parameters['body']!.first : '',
id: parameters['id'] != null ? parameters['id']!.first : ''));
}
class BitbucketRouter {
@ -454,49 +454,49 @@ class BitbucketRouter {
];
static final user = RouterScreen(
'/:login',
(context, parameters) => BbUserScreen(parameters['login'].first,
isTeam: parameters['team'].first == '1'));
(context, parameters) => BbUserScreen(parameters['login']!.first,
isTeam: parameters['team']!.first == '1'));
static final repo = RouterScreen('/:owner/:name', (context, parameters) {
if (parameters['branch'] == null) {
return BbRepoScreen(parameters['owner'].first, parameters['name'].first);
return BbRepoScreen(parameters['owner']!.first, parameters['name']!.first);
} else {
return BbRepoScreen(parameters['owner'].first, parameters['name'].first,
branch: parameters['branch'].first);
return BbRepoScreen(parameters['owner']!.first, parameters['name']!.first,
branch: parameters['branch']!.first);
}
});
static final object = RouterScreen(
'/:owner/:name/src/:ref',
(context, parameters) => BbObjectScreen(
parameters['owner'].first,
parameters['name'].first,
parameters['ref'].first,
parameters['owner']!.first,
parameters['name']!.first,
parameters['ref']!.first,
path: parameters['path']?.first,
),
);
static final issues = RouterScreen(
'/:owner/:name/issues',
(context, parameters) =>
BbIssuesScreen(parameters['owner'].first, parameters['name'].first));
BbIssuesScreen(parameters['owner']!.first, parameters['name']!.first));
static final commits = RouterScreen(
'/:owner/:name/commits/:ref',
(context, parameters) => BbCommitsScreen(parameters['owner'].first,
parameters['name'].first, parameters['ref'].first));
(context, parameters) => BbCommitsScreen(parameters['owner']!.first,
parameters['name']!.first, parameters['ref']!.first));
static final pulls = RouterScreen(
'/:owner/:name/pulls',
(context, parameters) =>
BbPullsScreen(parameters['owner'].first, parameters['name'].first));
BbPullsScreen(parameters['owner']!.first, parameters['name']!.first));
static final issueAdd = RouterScreen(
'/:owner/:name/issues/new',
(context, parameters) => BbIssueFormScreen(
parameters['owner'].first, parameters['name'].first));
parameters['owner']!.first, parameters['name']!.first));
static final issue = RouterScreen(
'/:owner/:name/issues/:number',
(context, parameters) => BbIssueScreen(parameters['owner'].first,
parameters['name'].first, parameters['number'].first));
(context, parameters) => BbIssueScreen(parameters['owner']!.first,
parameters['name']!.first, parameters['number']!.first));
static final issueComment = RouterScreen(
'/:owner/:name/issues/:number/comment',
(context, parameters) => BbIssueCommentScreen(parameters['owner'].first,
parameters['name'].first, parameters['number'].first));
(context, parameters) => BbIssueCommentScreen(parameters['owner']!.first,
parameters['name']!.first, parameters['number']!.first));
}
class GiteeRouter {
@ -526,7 +526,7 @@ class GiteeRouter {
return GeSearchScreen();
});
static final user = RouterScreen('/:login', (context, parameters) {
final login = parameters['login'].first;
final login = parameters['login']!.first;
final tab = parameters['tab']?.first;
switch (tab) {
case 'followers':
@ -547,122 +547,122 @@ class GiteeRouter {
(context, parameters) {
if (parameters['branch'] == null) {
return GeRepoScreen(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
} else {
return GeRepoScreen(parameters['owner'].first, parameters['name'].first,
branch: parameters['branch'].first);
return GeRepoScreen(parameters['owner']!.first, parameters['name']!.first,
branch: parameters['branch']!.first);
}
},
);
static final stargazers =
RouterScreen('/:owner/:name/stargazers', (context, parameters) {
return GeUsersScreen.stargazers(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
});
static final watchers =
RouterScreen('/:owner/:name/watchers', (context, parameters) {
return GeUsersScreen.watchers(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
});
static final forks =
RouterScreen('/:owner/:name/forks', (context, parameters) {
return GeReposScreen.forks(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
});
static final commits = RouterScreen(
'/:owner/:name/commits',
(context, parameters) => GeCommitsScreen(
parameters['owner'].first, parameters['name'].first,
parameters['owner']!.first, parameters['name']!.first,
branch:
parameters['branch'] != null ? parameters['branch'].first : null),
parameters['branch'] != null ? parameters['branch']!.first : null),
);
static final tree = RouterScreen(
'/:owner/:name/tree/:sha',
(context, parameters) {
return GeTreeScreen(parameters['owner'].first, parameters['name'].first,
parameters['sha'].first);
return GeTreeScreen(parameters['owner']!.first, parameters['name']!.first,
parameters['sha']!.first);
},
);
static final blob = RouterScreen(
'/:owner/:name/blob/:sha',
(context, parameters) {
return GeBlobScreen(
parameters['owner'].first,
parameters['name'].first,
parameters['sha'].first,
parameters['path'].first,
parameters['owner']!.first,
parameters['name']!.first,
parameters['sha']!.first,
parameters['path']!.first,
);
},
);
static final issues = RouterScreen(
'/:owner/:name/issues',
(context, parameters) {
return GeIssuesScreen(parameters['owner'].first, parameters['name'].first,
return GeIssuesScreen(parameters['owner']!.first, parameters['name']!.first,
isPr: false);
},
);
static final issue =
RouterScreen('/:owner/:name/issues/:number', (context, parameters) {
return GeIssueScreen(parameters['owner'].first, parameters['name'].first,
parameters['number'].first,
return GeIssueScreen(parameters['owner']!.first, parameters['name']!.first,
parameters['number']!.first,
isPr: false);
});
static final pulls = RouterScreen(
'/:owner/:name/pulls',
(context, parameters) {
return GePullsScreen(parameters['owner'].first, parameters['name'].first,
return GePullsScreen(parameters['owner']!.first, parameters['name']!.first,
isPr: true);
},
);
static final issueAdd =
RouterScreen('/:owner/:name/issues/new', (context, parameters) {
return GeIssueFormScreen(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
});
static final issueComment = RouterScreen(
'/:owner/:name/issues/:number/comment', (context, parameters) {
return GeIssueCommentScreen(
parameters['owner'].first,
parameters['name'].first,
parameters['number'].first,
parameters['owner']!.first,
parameters['name']!.first,
parameters['number']!.first,
isPr: false,
body: parameters['body'] != null ? parameters['body'].first : '',
id: parameters['id'] != null ? parameters['id'].first : '',
body: parameters['body'] != null ? parameters['body']!.first : '',
id: parameters['id'] != null ? parameters['id']!.first : '',
);
});
static final pull = RouterScreen(
'/:owner/:name/pulls/:number',
(context, parameters) {
return GePullScreen(parameters['owner'].first, parameters['name'].first,
parameters['number'].first,
return GePullScreen(parameters['owner']!.first, parameters['name']!.first,
parameters['number']!.first,
isPr: true);
},
);
static final pullComment = RouterScreen('/:owner/:name/pulls/:number/comment',
(context, parameters) {
return GeIssueCommentScreen(
parameters['owner'].first,
parameters['name'].first,
parameters['number'].first,
parameters['owner']!.first,
parameters['name']!.first,
parameters['number']!.first,
isPr: true,
body: parameters['body'] != null ? parameters['body'].first : '',
id: parameters['id'] != null ? parameters['id'].first : '',
body: parameters['body'] != null ? parameters['body']!.first : '',
id: parameters['id'] != null ? parameters['id']!.first : '',
);
});
static final files =
RouterScreen('/:owner/:name/pulls/:number/files', (context, parameters) {
return GeFilesScreen(parameters['owner'].first, parameters['name'].first,
parameters['number'].first);
return GeFilesScreen(parameters['owner']!.first, parameters['name']!.first,
parameters['number']!.first);
});
static final commit = RouterScreen(
'/:owner/:name/commits/:sha',
(context, parameters) => GeCommitScreen(parameters['owner'].first,
parameters['name'].first, parameters['sha'].first),
(context, parameters) => GeCommitScreen(parameters['owner']!.first,
parameters['name']!.first, parameters['sha']!.first),
);
static final contributors = RouterScreen(
'/:owner/:name/contributors',
(context, parameters) => GeContributorsScreen(
parameters['owner'].first, parameters['name'].first),
parameters['owner']!.first, parameters['name']!.first),
);
}
@ -676,7 +676,7 @@ class GogsRouter {
GogsRouter.issues,
];
static final user = RouterScreen('/:login', (context, parameters) {
final login = parameters['login'].first;
final login = parameters['login']!.first;
final tab = parameters['tab']?.first;
final isViewer = parameters['isViewer']?.first;
switch (tab) {
@ -691,7 +691,7 @@ class GogsRouter {
return GoOrgsScreen.ofUser(login,
isViewer: isViewer == 'false' ? false : true); // handle better?
default:
return GoUserScreen(parameters['login'].first);
return GoUserScreen(parameters['login']!.first);
}
});
static final repo = RouterScreen(
@ -699,18 +699,18 @@ class GogsRouter {
(context, parameters) {
if (parameters['branch'] == null) {
return GoRepoScreen(
parameters['owner'].first, parameters['name'].first);
parameters['owner']!.first, parameters['name']!.first);
} else {
return GoRepoScreen(parameters['owner'].first, parameters['name'].first,
branch: parameters['branch'].first);
return GoRepoScreen(parameters['owner']!.first, parameters['name']!.first,
branch: parameters['branch']!.first);
}
},
);
static final object = RouterScreen(
'/:owner/:name/blob',
(context, parameters) => GoObjectScreen(
parameters['owner'].first,
parameters['name'].first,
parameters['owner']!.first,
parameters['name']!.first,
path: parameters['path']?.first,
ref: parameters['ref']?.first,
),
@ -718,10 +718,10 @@ class GogsRouter {
static final commits = RouterScreen(
'/:owner/:name/commits',
(context, parameters) => GoCommitsScreen(
parameters['owner'].first, parameters['name'].first,
parameters['owner']!.first, parameters['name']!.first,
branch: parameters['ref']?.first));
static final issues = RouterScreen(
'/:owner/:name/issues',
(context, parameters) =>
GoIssuesScreen(parameters['owner'].first, parameters['name'].first));
GoIssuesScreen(parameters['owner']!.first, parameters['name']!.first));
}

View File

@ -6,12 +6,12 @@ import 'package:provider/provider.dart';
class CommonScaffold extends StatelessWidget {
final Widget title;
final Widget body;
final Widget action;
final PreferredSizeWidget bottom;
final Widget? action;
final PreferredSizeWidget? bottom;
CommonScaffold({
@required this.title,
@required this.body,
required this.title,
required this.body,
this.action,
this.bottom,
});
@ -36,7 +36,7 @@ class CommonScaffold extends StatelessWidget {
appBar: AppBar(
title: title,
actions: [
if (action != null) action,
if (action != null) action!,
],
bottom: bottom,
),

View File

@ -11,27 +11,27 @@ import '../widgets/empty.dart';
class ListPayload<T, K> {
K cursor;
Iterable<T> items;
bool hasMore;
Iterable<T>? items;
bool? hasMore;
ListPayload({
@required this.items,
@required this.cursor,
@required this.hasMore,
required this.items,
required this.cursor,
required this.hasMore,
});
}
// This is a scaffold for infinite scroll screens
class ListStatefulScaffold<T, K> extends StatefulWidget {
final Widget title;
final Widget Function() actionBuilder;
final Widget Function()? actionBuilder;
final Widget Function(T payload) itemBuilder;
final Future<ListPayload<T, K>> Function(K cursor) fetch;
ListStatefulScaffold({
@required this.title,
@required this.itemBuilder,
@required this.fetch,
required this.title,
required this.itemBuilder,
required this.fetch,
this.actionBuilder,
});
@ -41,14 +41,14 @@ class ListStatefulScaffold<T, K> extends StatefulWidget {
}
class _ListStatefulScaffoldState<T, K>
extends State<ListStatefulScaffold<T, K>> {
extends State<ListStatefulScaffold<T, K?>> {
bool loading = false;
bool loadingMore = false;
String error = '';
List<T> items = [];
K cursor;
bool hasMore;
K? cursor;
bool? hasMore;
ScrollController _controller = ScrollController();
@ -71,7 +71,7 @@ class _ListStatefulScaffoldState<T, K>
!_controller.position.outOfRange &&
!loading &&
!loadingMore &&
hasMore) {
hasMore!) {
_loadMore();
}
}
@ -95,8 +95,8 @@ class _ListStatefulScaffoldState<T, K>
}
});
try {
final _payload = await widget.fetch(null);
items = _payload.items.toList();
final ListPayload<T, K?> _payload = await widget.fetch(null);
items = _payload.items!.toList();
cursor = _payload.cursor;
hasMore = _payload.hasMore;
} catch (err) {
@ -118,8 +118,8 @@ class _ListStatefulScaffoldState<T, K>
loadingMore = true;
});
try {
var _payload = await widget.fetch(cursor);
items.addAll(_payload.items);
ListPayload<T, K?> _payload = await widget.fetch(cursor);
items.addAll(_payload.items!);
cursor = _payload.cursor;
hasMore = _payload.hasMore;
} catch (err) {
@ -137,7 +137,7 @@ class _ListStatefulScaffoldState<T, K>
Widget _buildItem(BuildContext context, int index) {
if (index == 2 * items.length) {
if (hasMore) {
if (hasMore!) {
return Loading(more: true);
} else {
return Container();
@ -213,7 +213,7 @@ class _ListStatefulScaffoldState<T, K>
return CommonScaffold(
title: widget.title,
body: _buildBody(),
action: widget.actionBuilder == null ? null : widget.actionBuilder(),
action: widget.actionBuilder == null ? null : widget.actionBuilder!(),
);
}
}

View File

@ -9,11 +9,11 @@ import '../widgets/link.dart';
import '../widgets/error_reload.dart';
class LongListPayload<T, K> {
T header;
int totalCount;
String cursor;
List<K> leadingItems;
List<K> trailingItems;
T? header;
int? totalCount;
String? cursor;
List<K>? leadingItems;
List<K>? trailingItems;
LongListPayload({
this.header,
@ -30,19 +30,19 @@ class LongListPayload<T, K> {
// 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)? 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;
final Future<LongListPayload<T, K>> Function(String? cursor) onLoadMore;
LongListStatefulScaffold({
@required this.title,
required this.title,
this.trailingBuilder,
@required this.headerBuilder,
@required this.itemBuilder,
@required this.onRefresh,
@required this.onLoadMore,
required this.headerBuilder,
required this.itemBuilder,
required this.onRefresh,
required this.onLoadMore,
});
@override
@ -51,12 +51,12 @@ class LongListStatefulScaffold<T, K> extends StatefulWidget {
}
class _LongListStatefulScaffoldState<T, K>
extends State<LongListStatefulScaffold<T, K>> {
bool loading;
extends State<LongListStatefulScaffold<T?, K>> {
late bool loading;
bool loadingMore = false;
String error = '';
LongListPayload<T, K> payload;
LongListPayload<T?, K>? payload;
@override
void initState() {
@ -90,10 +90,11 @@ class _LongListStatefulScaffoldState<T, K>
loadingMore = true;
});
try {
var _payload = await widget.onLoadMore(payload.cursor);
payload.totalCount = _payload.totalCount;
payload.cursor = _payload.cursor;
payload.leadingItems.addAll(_payload.leadingItems);
LongListPayload<T?, K> _payload =
await widget.onLoadMore(payload!.cursor);
payload!.totalCount = _payload.totalCount;
payload!.cursor = _payload.cursor;
payload!.leadingItems!.addAll(_payload.leadingItems!);
} finally {
if (mounted) {
setState(() {
@ -112,16 +113,16 @@ class _LongListStatefulScaffoldState<T, K>
int realIndex = index ~/ 2;
if (realIndex < payload.leadingItems.length) {
return widget.itemBuilder(payload.leadingItems[realIndex]);
} else if (realIndex == payload.leadingItems.length) {
var count = payload.totalCount -
payload.leadingItems.length +
payload.trailingItems.length;
if (realIndex < payload!.leadingItems!.length) {
return widget.itemBuilder(payload!.leadingItems![realIndex]);
} else if (realIndex == payload!.leadingItems!.length) {
var count = payload!.totalCount! -
payload!.leadingItems!.length +
payload!.trailingItems!.length;
return Container(
padding: CommonStyle.padding,
child: Center(
child: Link(
child: LinkWidget(
onTap: _loadMore,
child: Container(
padding: CommonStyle.padding,
@ -148,14 +149,14 @@ class _LongListStatefulScaffoldState<T, K>
),
);
} else {
return widget.itemBuilder(
payload.trailingItems[realIndex - payload.leadingItems.length - 1]);
return widget.itemBuilder(payload!
.trailingItems![realIndex - payload!.leadingItems!.length - 1]);
}
}
int get _itemCount {
int count = payload.leadingItems.length + payload.trailingItems.length;
if (payload.totalCount > count) {
int count = payload!.leadingItems!.length + payload!.trailingItems!.length;
if (payload!.totalCount! > count) {
count++;
}
return 2 * count; // including bottom border
@ -185,7 +186,7 @@ class _LongListStatefulScaffoldState<T, K>
];
if (payload != null) {
slivers.add(
SliverToBoxAdapter(child: widget.headerBuilder(payload.header)),
SliverToBoxAdapter(child: widget.headerBuilder(payload!.header)),
);
}
slivers.add(_buildSliver());
@ -193,8 +194,9 @@ class _LongListStatefulScaffoldState<T, K>
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: widget.title,
trailing:
payload == null ? null : widget.trailingBuilder(payload.header),
trailing: payload == null
? null
: widget.trailingBuilder!(payload!.header),
),
child: SafeArea(
child: CupertinoScrollbar(
@ -208,7 +210,7 @@ class _LongListStatefulScaffoldState<T, K>
title: widget.title,
actions: payload == null
? null
: [widget.trailingBuilder(payload.header)],
: [widget.trailingBuilder!(payload!.header)],
),
body: RefreshIndicator(
onRefresh: _refresh,
@ -216,7 +218,7 @@ class _LongListStatefulScaffoldState<T, K>
child: CustomScrollView(slivers: [
if (payload != null)
SliverToBoxAdapter(
child: widget.headerBuilder(payload.header)),
child: widget.headerBuilder(payload!.header)),
_buildSliver(),
]),
),

View File

@ -5,16 +5,16 @@ 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 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 Widget? Function(T data, void Function(T newData) setData)? actionBuilder;
final Widget? action;
final canRefresh;
RefreshStatefulScaffold({
@required this.title,
@required this.bodyBuilder,
@required this.fetch,
required this.title,
required this.bodyBuilder,
required this.fetch,
this.actionBuilder,
this.action,
this.canRefresh = true,
@ -26,9 +26,9 @@ class RefreshStatefulScaffold<T> extends StatefulWidget {
}
class _RefreshStatefulScaffoldState<T>
extends State<RefreshStatefulScaffold<T>> {
extends State<RefreshStatefulScaffold<T?>> {
// bool _loading;
T _data;
T? _data;
String _error = '';
@override
@ -57,10 +57,10 @@ class _RefreshStatefulScaffoldState<T>
}
}
Widget get _action {
Widget? get _action {
if (widget.action != null) return widget.action;
if (widget.actionBuilder == null || _data == null) return null;
return widget.actionBuilder(_data, (v) {
return widget.actionBuilder!(_data, (v) {
setState(() {
_data = v;
});

View File

@ -4,11 +4,11 @@ import 'package:git_touch/scaffolds/common.dart';
class SingleScaffold extends StatelessWidget {
final Widget title;
final Widget body;
final Widget action;
final Widget? action;
SingleScaffold({
@required this.title,
@required this.body,
required this.title,
required this.body,
this.action,
});

View File

@ -8,20 +8,20 @@ import 'package:provider/provider.dart';
class TabScaffold extends StatelessWidget {
final Widget title;
final Widget body;
final Widget action;
final Widget? action;
final void Function() onRefresh;
final List<String> tabs;
final int activeTab;
final Function(int index) onTabSwitch;
TabScaffold({
@required this.title,
@required this.body,
required this.title,
required this.body,
this.action,
@required this.onRefresh,
@required this.tabs,
@required this.activeTab,
@required this.onTabSwitch,
required this.onRefresh,
required this.tabs,
required this.activeTab,
required this.onTabSwitch,
});
Widget _buildTitle(BuildContext context) {
@ -32,9 +32,12 @@ class TabScaffold extends StatelessWidget {
child: Row(
children: [
Expanded(
child: CupertinoSlidingSegmentedControl(
child: CupertinoSlidingSegmentedControl<int>(
groupValue: activeTab,
onValueChanged: onTabSwitch,
onValueChanged: (v) {
if (v == null) return;
onTabSwitch(v);
},
children: tabs.asMap().map((key, text) => MapEntry(
key,
Padding(

View File

@ -8,13 +8,13 @@ class TabStatefulScaffold<T> extends StatefulWidget {
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;
final Widget Function(T payload, void Function() refresh)? actionBuilder;
TabStatefulScaffold({
@required this.title,
@required this.bodyBuilder,
@required this.fetchData,
@required this.tabs,
required this.title,
required this.bodyBuilder,
required this.fetchData,
required this.tabs,
this.actionBuilder,
});
@ -22,15 +22,15 @@ class TabStatefulScaffold<T> extends StatefulWidget {
_TabStatefulScaffoldState<T> createState() => _TabStatefulScaffoldState();
}
class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> {
bool _loading;
T _payload0;
T _payload1;
T _payload2;
class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T?>> {
late bool _loading;
T? _payload0;
T? _payload1;
T? _payload2;
String _error = '';
int _activeTab = 0;
T _getPayload(int selected) {
T? _getPayload(int selected) {
switch (selected) {
case 0:
return _payload0;
@ -43,9 +43,9 @@ class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> {
}
}
T get _payload => _getPayload(_activeTab);
T? get _payload => _getPayload(_activeTab);
set _payload(T v) {
set _payload(T? v) {
switch (_activeTab) {
case 0:
_payload0 = v;
@ -84,27 +84,25 @@ class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> {
}
}
Future<void> _switch(int selected) async {
if (_loading) return;
setState(() {
_activeTab = selected;
});
if (_getPayload(selected) == null) {
await _refresh();
}
}
@override
Widget build(BuildContext context) {
return TabScaffold(
title: widget.title,
action: widget.actionBuilder == null
? null
: widget.actionBuilder(_payload, _refresh),
: widget.actionBuilder!(_payload, _refresh),
tabs: widget.tabs,
activeTab: _activeTab,
onTabSwitch: _switch,
onTabSwitch: (selected) async {
if (_loading) return;
setState(() {
_activeTab = selected;
});
if (_getPayload(selected) == null) {
await _refresh();
}
},
onRefresh: _refresh,
body: ErrorLoadingWrapper(
bodyBuilder: () => widget.bodyBuilder(_payload, _activeTab),

View File

@ -10,8 +10,8 @@ class RefreshWrapper extends StatelessWidget {
final void Function() onRefresh;
RefreshWrapper({
@required this.onRefresh,
@required this.body,
required this.onRefresh,
required this.body,
});
@override
@ -21,14 +21,15 @@ class RefreshWrapper extends StatelessWidget {
return CupertinoScrollbar(
child: CustomScrollView(
slivers: <Widget>[
CupertinoSliverRefreshControl(onRefresh: onRefresh),
CupertinoSliverRefreshControl(
onRefresh: onRefresh as Future<void> Function()?),
SliverToBoxAdapter(child: body),
],
),
);
default:
return RefreshIndicator(
onRefresh: onRefresh,
onRefresh: onRefresh as Future<void> Function(),
child: Scrollbar(
child: SingleChildScrollView(child: body),
),
@ -41,13 +42,13 @@ class ErrorLoadingWrapper extends StatelessWidget {
final String error;
final bool loading;
final void Function() reload;
final Widget Function() bodyBuilder;
final Widget? Function() bodyBuilder;
ErrorLoadingWrapper({
@required this.error,
@required this.loading,
@required this.reload,
@required this.bodyBuilder,
required this.error,
required this.loading,
required this.reload,
required this.bodyBuilder,
});
@override
@ -60,11 +61,6 @@ class ErrorLoadingWrapper extends StatelessWidget {
return Loading();
}
return bodyBuilder();
return bodyBuilder()!;
}
}
Widget wrapBuilder(Widget Function() builder) {
if (builder == null) return null;
return builder();
}

View File

@ -16,8 +16,8 @@ class BbCommitsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context);
return ListStatefulScaffold<BbCommit, String>(
title: AppBarTitle(AppLocalizations.of(context).commits),
return ListStatefulScaffold<BbCommit, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.commits),
fetch: (nextUrl) async {
final res = await context.read<AuthModel>().fetchBbWithPage(
nextUrl ?? '/repositories/$owner/$name/commits/$ref');
@ -25,16 +25,16 @@ class BbCommitsScreen extends StatelessWidget {
cursor: res.cursor,
hasMore: res.hasMore,
items: <BbCommit>[
for (var v in res.data) BbCommit.fromJson(v),
for (var v in res.data!) BbCommit.fromJson(v),
],
);
},
itemBuilder: (v) {
return CommitItem(
url: '${auth.activeAccount.domain}/$owner/$name/commits/${v.hash}',
avatarUrl: v.author.user?.avatarUrl,
url: '${auth.activeAccount!.domain}/$owner/$name/commits/${v.hash}',
avatarUrl: v.author!.user?.avatarUrl,
avatarLink: null,
author: v.author.raw.replaceFirst(RegExp(r' <.*>'), ''),
author: v.author!.raw!.replaceFirst(RegExp(r' <.*>'), ''),
createdAt: v.date,
message: v.message,
);

View File

@ -10,8 +10,8 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class BbExploreScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<BbRepo, String>(
title: AppBarTitle(AppLocalizations.of(context).explore),
return ListStatefulScaffold<BbRepo, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.explore),
fetch: (nextUrl) async {
final res = await context.read<AuthModel>().fetchBbWithPage(
nextUrl ?? '/repositories?role=member&sort=-updated_on');
@ -19,7 +19,7 @@ class BbExploreScreen extends StatelessWidget {
cursor: res.cursor,
hasMore: res.hasMore,
items: <BbRepo>[
for (var v in res.data) BbRepo.fromJson(v),
for (var v in res.data!) BbRepo.fromJson(v),
],
);
},

View File

@ -48,12 +48,12 @@ class BbIssueScreen extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Link(
LinkWidget(
url: '/bitbucket/$owner/$name',
child: Row(
children: <Widget>[
Avatar(
url: issue.reporter.avatarUrl,
url: issue.reporter!.avatarUrl,
size: AvatarSize.extraSmall,
),
SizedBox(width: 4),
@ -77,7 +77,7 @@ class BbIssueScreen extends StatelessWidget {
),
SizedBox(height: 8),
Text(
issue.title,
issue.title!,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
@ -95,12 +95,12 @@ class BbIssueScreen extends StatelessWidget {
padding: EdgeInsets.only(left: 10),
child: CommentItem(
avatar: Avatar(
url: comment.user.avatarUrl,
linkUrl: '/bitbucket/${comment.user.displayName}',
url: comment.user!.avatarUrl,
linkUrl: '/bitbucket/${comment.user!.displayName}',
),
createdAt: DateTime.parse(comment.createdOn),
body: comment.content.raw,
login: comment.user.displayName,
createdAt: DateTime.parse(comment.createdOn!),
body: comment.content!.raw,
login: comment.user!.displayName,
prefix: 'bitbucket')),
CommonStyle.border,
SizedBox(height: 16),

View File

@ -16,8 +16,8 @@ class BbIssuesScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<BbIssues, String>(
title: AppBarTitle(AppLocalizations.of(context).issues),
return ListStatefulScaffold<BbIssues, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.issues),
actionBuilder: () {
return ActionEntry(
iconData: Octicons.plus, url: '/bitbucket/$owner/$name/issues/new');
@ -30,16 +30,16 @@ class BbIssuesScreen extends StatelessWidget {
cursor: res.cursor,
hasMore: res.hasMore,
items: <BbIssues>[
for (var v in res.data) BbIssues.fromJson(v),
for (var v in res.data!) BbIssues.fromJson(v),
],
);
},
itemBuilder: (v) {
int issueNumber =
int.parse(v.issueLink.replaceFirst(RegExp(r'.*\/'), ''));
int.parse(v.issueLink!.replaceFirst(RegExp(r'.*\/'), ''));
return IssueItem(
avatarUrl: v.reporter.avatarUrl,
author: v.reporter.displayName,
avatarUrl: v.reporter!.avatarUrl,
author: v.reporter!.displayName,
title: v.title,
subtitle: '#' + issueNumber.toString(),
commentCount: 0,

View File

@ -16,7 +16,7 @@ class BbObjectScreen extends StatelessWidget {
final String owner;
final String name;
final String ref;
final String path;
final String? path;
BbObjectScreen(this.owner, this.name, this.ref, {this.path});
@override
@ -34,7 +34,7 @@ class BbObjectScreen extends StatelessWidget {
.values;
}
},
actionBuilder: (p, _) {
actionBuilder: (dynamic p, _) {
if (p is String) {
return ActionEntry(
iconData: Ionicons.cog,
@ -44,7 +44,7 @@ class BbObjectScreen extends StatelessWidget {
return null;
}
},
bodyBuilder: (pl, _) {
bodyBuilder: (dynamic pl, _) {
if (pl is String) {
return BlobView(path, text: pl);
} else if (pl is List) {
@ -55,12 +55,12 @@ class BbObjectScreen extends StatelessWidget {
return ObjectTree(items: [
for (var v in items)
ObjectTreeItem(
name: p.basename(v.path),
name: p.basename(v.path!),
type: v.type,
size: v.type == 'commit_file' ? v.size : null,
url:
'/bitbucket/$owner/$name/src/$ref?path=${v.path.urlencode}',
downloadUrl: v.links['self']['href'] as String,
'/bitbucket/$owner/$name/src/$ref?path=${v.path!.urlencode}',
downloadUrl: v.links!['self']['href'] as String?,
),
]);
} else {

View File

@ -15,8 +15,8 @@ class BbPullsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context);
return ListStatefulScaffold<BbPulls, String>(
title: AppBarTitle(AppLocalizations.of(context).pullRequests),
return ListStatefulScaffold<BbPulls, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.pullRequests),
fetch: (nextUrl) async {
final res = await context.read<AuthModel>().fetchBbWithPage(
nextUrl ?? '/repositories/$owner/$name/pullrequests');
@ -24,22 +24,22 @@ class BbPullsScreen extends StatelessWidget {
cursor: res.cursor,
hasMore: res.hasMore,
items: <BbPulls>[
for (var v in res.data) BbPulls.fromJson(v),
for (var v in res.data!) BbPulls.fromJson(v),
],
);
},
itemBuilder: (v) {
int pullNumber =
int.parse(v.pullRequestLink.replaceFirst(RegExp(r'.*\/'), ''));
int.parse(v.pullRequestLink!.replaceFirst(RegExp(r'.*\/'), ''));
return IssueItem(
avatarUrl: v.author.avatarUrl,
author: v.author.displayName,
avatarUrl: v.author!.avatarUrl,
author: v.author!.displayName,
title: v.title,
subtitle: '#' + pullNumber.toString(),
commentCount: 0,
updatedAt: v.createdOn,
url:
'${auth.activeAccount.domain}/$owner/$name/pull-requests/$pullNumber',
'${auth.activeAccount!.domain}/$owner/$name/pull-requests/$pullNumber',
);
},
);

View File

@ -18,25 +18,25 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class BbRepoScreen extends StatelessWidget {
final String owner;
final String name;
final String branch;
final String? branch;
BbRepoScreen(this.owner, this.name, {this.branch});
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<Tuple3<BbRepo, String, List<BbBranch>>>(
title: AppBarTitle(AppLocalizations.of(context).repository),
return RefreshStatefulScaffold<Tuple3<BbRepo, String?, List<BbBranch>>>(
title: AppBarTitle(AppLocalizations.of(context)!.repository),
fetch: () async {
final auth = context.read<AuthModel>();
final r = await auth.fetchBbJson('/repositories/$owner/$name');
final repo = BbRepo.fromJson(r);
final res = await auth.fetchBb(
'/repositories/$owner/$name/src/${repo.mainbranch.name}/README.md');
'/repositories/$owner/$name/src/${repo.mainbranch!.name}/README.md');
final readme =
res.statusCode >= 400 ? null : utf8.decode(res.bodyBytes);
final branches = await auth
.fetchBbWithPage('/repositories/$owner/$name/refs/branches')
.then((v) {
return [for (var branch in v.data) BbBranch.fromJson(branch)];
return [for (var branch in v.data!) BbBranch.fromJson(branch)];
});
return Tuple3(repo, readme, branches);
},
@ -64,7 +64,7 @@ class BbRepoScreen extends StatelessWidget {
text: Text('Code'),
rightWidget: Text(filesize(p.size)),
url:
'/bitbucket/$owner/$name/src/${branch == null ? p.mainbranch.name : branch}',
'/bitbucket/$owner/$name/src/${branch == null ? p.mainbranch!.name : branch}',
),
TableViewItem(
leftIconData: Octicons.issue_opened,
@ -80,14 +80,14 @@ class BbRepoScreen extends StatelessWidget {
leftIconData: Octicons.history,
text: Text('Commits'),
url:
'/bitbucket/$owner/$name/commits/${branch == null ? p.mainbranch.name : branch}',
'/bitbucket/$owner/$name/commits/${branch == null ? p.mainbranch!.name : branch}',
),
if (branches != null)
TableViewItem(
leftIconData: Octicons.git_branch,
text: Text(AppLocalizations.of(context).branches),
text: Text(AppLocalizations.of(context)!.branches),
rightWidget: Text(
(branch == null ? p.mainbranch.name : branch) +
(branch == null ? p.mainbranch!.name : branch)! +
'' +
branches.length.toString()),
onTap: () async {

View File

@ -11,8 +11,8 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class BbTeamsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<BbUser, String>(
title: AppBarTitle(AppLocalizations.of(context).teams),
return ListStatefulScaffold<BbUser, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.teams),
fetch: (nextUrl) async {
final res = await context
.read<AuthModel>()
@ -21,7 +21,7 @@ class BbTeamsScreen extends StatelessWidget {
cursor: res.cursor,
hasMore: res.hasMore,
items: <BbUser>[
for (var v in res.data) BbUser.fromJson(v),
for (var v in res.data!) BbUser.fromJson(v),
],
);
},
@ -30,7 +30,7 @@ class BbTeamsScreen extends StatelessWidget {
login: v.username,
name: v.nickname,
avatarUrl: v.avatarUrl,
bio: Text('Created ${timeago.format(v.createdOn)}'),
bio: Text('Created ${timeago.format(v.createdOn!)}'),
);
},
);

View File

@ -11,7 +11,7 @@ import 'package:tuple/tuple.dart';
import 'package:git_touch/utils/utils.dart';
class BbUserScreen extends StatelessWidget {
final String login;
final String? login;
final bool isTeam;
BbUserScreen(this.login, {this.isTeam = false});
bool get isViewer => login == null;
@ -19,8 +19,8 @@ class BbUserScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context);
final _accountId = auth.activeAccount.accountId;
final _login = login ?? auth.activeAccount.login;
final _accountId = auth.activeAccount!.accountId;
final _login = login ?? auth.activeAccount!.login;
return RefreshStatefulScaffold<Tuple2<BbUser, Iterable<BbRepo>>>(
title: Text(isViewer
? 'Me'

View File

@ -39,16 +39,16 @@ class MyApp extends StatelessWidget {
var theme = Provider.of<ThemeModel>(context);
return SingleScaffold(
title: AppBarTitle(AppLocalizations.of(context).codeTheme),
title: AppBarTitle(AppLocalizations.of(context)!.codeTheme),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
CommonStyle.verticalGap,
TableView(
headerText: AppLocalizations.of(context).fontStyle,
headerText: AppLocalizations.of(context)!.fontStyle,
items: [
TableViewItem(
text: Text(AppLocalizations.of(context).fontSize),
text: Text(AppLocalizations.of(context)!.fontSize),
rightWidget: Text(codeProvider.fontSize.toString()),
onTap: () {
theme.showPicker(
@ -60,14 +60,14 @@ class MyApp extends StatelessWidget {
PickerItem(v.toString(), text: v.toString()))
.toList(),
onChange: (value) {
codeProvider.setFontSize(int.tryParse(value) ?? 16);
codeProvider.setFontSize(int.tryParse(value!) ?? 16);
},
),
);
},
),
TableViewItem(
text: Text(AppLocalizations.of(context).fontFamily),
text: Text(AppLocalizations.of(context)!.fontFamily),
rightWidget: Text(codeProvider.fontFamily),
onTap: () {
theme.showPicker(
@ -77,8 +77,8 @@ class MyApp extends StatelessWidget {
items: CodeModel.fontFamilies
.map((v) => PickerItem(v, text: v))
.toList(),
onChange: (String value) {
codeProvider.setFontFamily(value);
onChange: (String? value) {
codeProvider.setFontFamily(value!);
},
),
);
@ -88,10 +88,10 @@ class MyApp extends StatelessWidget {
),
CommonStyle.verticalGap,
TableView(
headerText: AppLocalizations.of(context).syntaxHighlighting,
headerText: AppLocalizations.of(context)!.syntaxHighlighting,
items: [
TableViewItem(
text: Text(AppLocalizations.of(context).light),
text: Text(AppLocalizations.of(context)!.light),
rightWidget: Text(codeProvider.theme),
onTap: () {
theme.showPicker(
@ -102,14 +102,14 @@ class MyApp extends StatelessWidget {
.map((v) => PickerItem(v, text: v))
.toList(),
onChange: (value) {
codeProvider.setTheme(value);
codeProvider.setTheme(value!);
},
),
);
},
),
TableViewItem(
text: Text(AppLocalizations.of(context).dark),
text: Text(AppLocalizations.of(context)!.dark),
rightWidget: Text(codeProvider.themeDark),
onTap: () {
theme.showPicker(
@ -120,7 +120,7 @@ class MyApp extends StatelessWidget {
.map((v) => PickerItem(v, text: v))
.toList(),
onChange: (value) {
codeProvider.setThemeDark(value);
codeProvider.setThemeDark(value!);
},
),
);
@ -131,7 +131,7 @@ class MyApp extends StatelessWidget {
HighlightView(
_getCode(false),
language: 'dart',
theme: themeMap[codeProvider.theme],
theme: themeMap[codeProvider.theme]!,
textStyle: TextStyle(
fontSize: codeProvider.fontSize.toDouble(),
fontFamily: codeProvider.fontFamilyUsed,
@ -141,7 +141,7 @@ class MyApp extends StatelessWidget {
HighlightView(
_getCode(true),
language: 'dart',
theme: themeMap[codeProvider.themeDark],
theme: themeMap[codeProvider.themeDark]!,
textStyle: TextStyle(
fontSize: codeProvider.fontSize.toDouble(),
fontFamily: codeProvider.fontFamilyUsed,

View File

@ -18,8 +18,8 @@ class GeBlobScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<String>(
title: AppBarTitle(AppLocalizations.of(context).file),
return RefreshStatefulScaffold<String?>(
title: AppBarTitle(AppLocalizations.of(context)!.file),
fetch: () async {
final auth = context.read<AuthModel>();
final res = await auth.fetchGitee('/repos/$owner/$name/git/blobs/$sha');

View File

@ -35,12 +35,12 @@ class GeCommitScreen extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Link(
LinkWidget(
url: '/gitee/$owner/$name',
child: Row(
children: <Widget>[
Avatar(
url: data.author.avatarUrl,
url: data.author!.avatarUrl,
size: AvatarSize.extraSmall,
),
SizedBox(width: 4),
@ -64,7 +64,7 @@ class GeCommitScreen extends StatelessWidget {
),
SizedBox(height: 8),
Text(
data.commit.message,
data.commit!.message!,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
@ -73,7 +73,7 @@ class GeCommitScreen extends StatelessWidget {
],
)),
Wrap(
children: data.files
children: data.files!
.map<Widget>((file) => FilesItem(
filename: file.filename,
additions: file.additions,

View File

@ -10,13 +10,13 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class GeCommitsScreen extends StatelessWidget {
final String owner;
final String name;
final String branch;
final String? branch;
GeCommitsScreen(this.owner, this.name, {this.branch});
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GiteeCommit, int>(
title: AppBarTitle(AppLocalizations.of(context).commits),
title: AppBarTitle(AppLocalizations.of(context)!.commits),
fetch: (page) async {
final res = await context.read<AuthModel>().fetchGiteeWithPage(
'/repos/$owner/$name/commits?sha=$branch',
@ -29,11 +29,11 @@ class GeCommitsScreen extends StatelessWidget {
},
itemBuilder: (c) {
return CommitItem(
author: c.commit.author.name,
avatarUrl: c.author.avatarUrl,
avatarLink: '/gitee/${c.author.login}',
createdAt: c.commit.author.date,
message: c.commit.message,
author: c.commit!.author!.name,
avatarUrl: c.author!.avatarUrl,
avatarLink: '/gitee/${c.author!.login}',
createdAt: c.commit!.author!.date,
message: c.commit!.message,
url: '/gitee/$owner/$name/commits/${c.sha}',
);
},

View File

@ -16,7 +16,7 @@ class GeContributorsScreen extends StatelessWidget {
Widget build(BuildContext context) {
return ListStatefulScaffold<GiteeContributor, int>(
title: AppBarTitle(AppLocalizations.of(context).contributors),
title: AppBarTitle(AppLocalizations.of(context)!.contributors),
fetch: (page) async {
page = page ?? 1;
final res = await context
@ -49,7 +49,7 @@ class GeContributorsScreen extends StatelessWidget {
Row(
children: <Widget>[
Text(
v.name,
v.name!,
style: TextStyle(
color: theme.palette.primary,
fontSize: 18,

View File

@ -17,7 +17,7 @@ class GeFilesScreen extends StatelessWidget {
Widget build(BuildContext context) {
return ListStatefulScaffold<GiteePullFile, int>(
title: AppBarTitle(AppLocalizations.of(context).files),
title: AppBarTitle(AppLocalizations.of(context)!.files),
actionBuilder: () {
return ActionButton(
title: 'Actions',
@ -46,10 +46,10 @@ class GeFilesScreen extends StatelessWidget {
itemBuilder: (v) {
return FilesItem(
filename: v.filename,
additions: int.parse(v.additions),
deletions: int.parse(v.deletions),
additions: int.parse(v.additions!),
deletions: int.parse(v.deletions!),
status: v.status,
patch: v.patch.diff,
patch: v.patch!.diff,
);
},
);

View File

@ -80,12 +80,12 @@ class GeIssueScreen extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Link(
LinkWidget(
url: '/gitee/$owner/$name',
child: Row(
children: <Widget>[
Avatar(
url: issue.user.avatarUrl,
url: issue.user!.avatarUrl,
size: AvatarSize.extraSmall,
),
SizedBox(width: 4),
@ -109,7 +109,7 @@ class GeIssueScreen extends StatelessWidget {
),
SizedBox(height: 8),
Text(
issue.title,
issue.title!,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
@ -131,12 +131,12 @@ class GeIssueScreen extends StatelessWidget {
padding: EdgeInsets.only(left: 10),
child: CommentItem(
avatar: Avatar(
url: comment.user.avatarUrl,
linkUrl: '/gitee/${comment.user.login}',
url: comment.user!.avatarUrl,
linkUrl: '/gitee/${comment.user!.login}',
),
createdAt: DateTime.parse(comment.createdAt),
createdAt: DateTime.parse(comment.createdAt!),
body: comment.body,
login: comment.user.login,
login: comment.user!.login,
prefix: 'gitee',
commentActionItemList:
_buildCommentActionItem(context, comment),

View File

@ -34,17 +34,17 @@ class GeIssuesScreen extends StatelessWidget {
url: '/gitee/$owner/$name/issues/new',
),
itemBuilder: (p) => IssueItem(
author: p.user.login,
avatarUrl: p.user.avatarUrl,
author: p.user!.login,
avatarUrl: p.user!.avatarUrl,
commentCount: p.comments,
subtitle: '#' + p.number,
subtitle: '#' + p.number!,
title: p.title,
updatedAt: DateTime.parse(p.updatedAt),
updatedAt: DateTime.parse(p.updatedAt!),
url: '/gitee/$owner/$name/issues/${p.number}',
labels: p.labels.isEmpty
labels: p.labels!.isEmpty
? null
: Wrap(spacing: 4, runSpacing: 4, children: [
for (var label in p.labels)
for (var label in p.labels!)
MyLabel(name: label.name, cssColor: label.color)
]),
),

View File

@ -86,8 +86,8 @@ class GePullScreen extends StatelessWidget {
var additions = 0;
var deletions = 0;
for (var file in files) {
additions += int.parse(file.additions);
deletions += int.parse(file.deletions);
additions += int.parse(file.additions!);
deletions += int.parse(file.deletions!);
}
return Column(children: <Widget>[
Container(
@ -95,18 +95,18 @@ class GePullScreen extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Link(
LinkWidget(
child: Container(
padding: EdgeInsets.symmetric(vertical: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Link(
LinkWidget(
url: '/gitee/$owner/$name',
child: Row(
children: <Widget>[
Avatar(
url: pull.user.avatarUrl,
url: pull.user!.avatarUrl,
size: AvatarSize.extraSmall,
),
SizedBox(width: 4),
@ -130,7 +130,7 @@ class GePullScreen extends StatelessWidget {
),
SizedBox(height: 8),
Text(
pull.title,
pull.title!,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
@ -145,7 +145,7 @@ class GePullScreen extends StatelessWidget {
SizedBox(height: 16),
CommonStyle.border,
CommonStyle.border,
Link(
LinkWidget(
url: '/gitee/$owner/$name/pulls/$number/files',
child: Container(
padding: EdgeInsets.symmetric(vertical: 8),
@ -201,7 +201,7 @@ class GePullScreen extends StatelessWidget {
),
children: [
for (var commit in commits) ...[
Link(
LinkWidget(
url:
'/gitee/$owner/$name/commits/${commit.sha}',
child: Container(
@ -212,7 +212,7 @@ class GePullScreen extends StatelessWidget {
MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'${commit.sha.substring(0, 7)}',
'${commit.sha!.substring(0, 7)}',
style: TextStyle(
color: theme.palette.primary,
fontSize: 17,
@ -240,12 +240,12 @@ class GePullScreen extends StatelessWidget {
padding: EdgeInsets.only(left: 10),
child: CommentItem(
avatar: Avatar(
url: comment.user.avatarUrl,
linkUrl: '/gitee/${comment.user.login}',
url: comment.user!.avatarUrl,
linkUrl: '/gitee/${comment.user!.login}',
),
createdAt: DateTime.parse(comment.createdAt),
createdAt: DateTime.parse(comment.createdAt!),
body: comment.body,
login: comment.user.login,
login: comment.user!.login,
prefix: 'gitee',
commentActionItemList:
_buildCommentActionItem(context, comment),

View File

@ -28,17 +28,17 @@ class GePullsScreen extends StatelessWidget {
);
},
itemBuilder: (p) => IssueItem(
author: p.user.login,
avatarUrl: p.user.avatarUrl,
author: p.user!.login,
avatarUrl: p.user!.avatarUrl,
commentCount: 0, // fix this
subtitle: '#' + p.number.toString(),
title: p.title,
updatedAt: DateTime.parse(p.updatedAt),
updatedAt: DateTime.parse(p.updatedAt!),
url: '/gitee/$owner/$name/pulls/${p.number}',
labels: p.labels.isEmpty
labels: p.labels!.isEmpty
? null
: Wrap(spacing: 4, runSpacing: 4, children: [
for (var label in p.labels)
for (var label in p.labels!)
MyLabel(name: label.name, cssColor: label.color)
]),
),

View File

@ -26,14 +26,14 @@ class StatusPayload {
class GeRepoScreen extends StatelessWidget {
final String owner;
final String name;
final String branch;
final String? branch;
GeRepoScreen(this.owner, this.name, {this.branch});
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<
Tuple4<GiteeRepo, MarkdownViewData, List<GiteeBranch>, StatusPayload>>(
title: AppBarTitle(AppLocalizations.of(context).repository),
title: AppBarTitle(AppLocalizations.of(context)!.repository),
fetch: () async {
final auth = context.read<AuthModel>();
final repo = await auth.fetchGitee('/repos/$owner/$name').then((v) {
@ -42,11 +42,11 @@ class GeRepoScreen extends StatelessWidget {
final md =
() => auth.fetchGitee('/repos/$owner/$name/readme').then((v) {
return (v['content'] as String)?.base64ToUtf8;
return (v['content'] as String?)?.base64ToUtf8 ?? '';
});
final html = () => md().then((v) async {
final res = await http.post(
Uri.parse('${auth.activeAccount.domain}/api/v5/markdown'),
Uri.parse('${auth.activeAccount!.domain}/api/v5/markdown'),
headers: {'Authorization': 'token ${auth.token}'},
body: {'text': v},
);
@ -75,9 +75,9 @@ class GeRepoScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
RepoHeader(
avatarUrl: p.owner.avatarUrl,
avatarLink: '/gitee/${p.namespace.path}',
owner: p.namespace.path,
avatarUrl: p.owner!.avatarUrl,
avatarLink: '/gitee/${p.namespace!.path}',
owner: p.namespace!.path,
name: p.path,
description: p.description,
homepageUrl: p.homepage,
@ -148,7 +148,7 @@ class GeRepoScreen extends StatelessWidget {
rightWidget: Text(numberFormat.format(p.openIssuesCount)),
url: '/gitee/$owner/$name/issues',
),
if (p.pullRequestsEnabled)
if (p.pullRequestsEnabled!)
TableViewItem(
leftIconData: Octicons.git_pull_request,
text: Text('Pull requests'),
@ -163,9 +163,9 @@ class GeRepoScreen extends StatelessWidget {
if (branches != null)
TableViewItem(
leftIconData: Octicons.git_branch,
text: Text(AppLocalizations.of(context).branches),
text: Text(AppLocalizations.of(context)!.branches),
rightWidget: Text(
(branch == null ? p.defaultBranch : branch) +
(branch == null ? p.defaultBranch : branch)! +
'' +
branches.length.toString()),
onTap: () async {

View File

@ -36,15 +36,15 @@ class GeReposScreen extends StatelessWidget {
},
itemBuilder: (v) {
return RepositoryItem(
owner: v.namespace.path,
avatarUrl: v.owner.avatarUrl,
owner: v.namespace!.path,
avatarUrl: v.owner!.avatarUrl,
name: v.path,
description: v.description,
starCount: v.stargazersCount,
forkCount: v.forksCount,
note: 'Updated ${timeago.format(v.updatedAt)}',
url: '/gitee/${v.namespace.path}/${v.path}',
avatarLink: '/gitee/${v.namespace.path}',
note: 'Updated ${timeago.format(v.updatedAt!)}',
url: '/gitee/${v.namespace!.path}/${v.path}',
avatarLink: '/gitee/${v.namespace!.path}',
);
},
);

View File

@ -20,12 +20,12 @@ class GeSearchScreen extends StatefulWidget {
}
class _GeSearchScreenState extends State<GeSearchScreen> {
int _activeTab = 0;
int? _activeTab = 0;
bool _loading = false;
List<List> _payloads = [[], [], []];
TextEditingController _controller;
String get _keyword => _controller.text?.trim() ?? '';
TextEditingController? _controller;
String get _keyword => _controller!.text?.trim() ?? '';
@override
void initState() {
@ -35,14 +35,14 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
@override
void dispose() {
_controller.dispose();
_controller!.dispose();
super.dispose();
}
Future<void> _query() async {
if (_loading || _keyword.isEmpty) return;
var keyword = _controller.text;
var keyword = _controller!.text;
setState(() {
_loading = true;
});
@ -84,7 +84,7 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
Icon(Octicons.search, size: 20, color: PrimerColors.gray400),
],
),
placeholder: AppLocalizations.of(context).search,
placeholder: AppLocalizations.of(context)!.search,
clearButtonMode: OverlayVisibilityMode.editing,
textInputAction: TextInputAction.go,
onSubmitted: (_) => _query(),
@ -94,7 +94,7 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
default:
return TextField(
decoration: InputDecoration.collapsed(
hintText: AppLocalizations.of(context).search),
hintText: AppLocalizations.of(context)!.search),
textInputAction: TextInputAction.go,
onSubmitted: (_) => _query(),
controller: _controller,
@ -102,11 +102,11 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
}
}
_onTabSwitch(int index) {
_onTabSwitch(int? index) {
setState(() {
_activeTab = index;
});
if (_payloads[_activeTab].isEmpty) {
if (_payloads[_activeTab!].isEmpty) {
_query();
}
}
@ -176,7 +176,7 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
if (_loading)
Loading()
else
..._payloads[_activeTab].map(_buildItem).toList(),
..._payloads[_activeTab!].map(_buildItem).toList(),
],
),
),

View File

@ -18,7 +18,7 @@ class GeTreeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<List<GiteeTreeItem>>(
title: AppBarTitle(AppLocalizations.of(context).files),
title: AppBarTitle(AppLocalizations.of(context)!.files),
fetch: () async {
final res = await context
.read<AuthModel>()
@ -41,9 +41,9 @@ class GeTreeScreen extends StatelessWidget {
url: (() {
switch (item.type) {
case 'tree':
return '/gitee/$owner/$name/tree/${item.sha}?path=${item.path.urlencode}';
return '/gitee/$owner/$name/tree/${item.sha}?path=${item.path!.urlencode}';
case 'blob':
return '/gitee/$owner/$name/blob/${item.sha}?path=${item.path.urlencode}';
return '/gitee/$owner/$name/blob/${item.sha}?path=${item.path!.urlencode}';
default:
return null;
}

View File

@ -100,15 +100,15 @@ class GeUserScreen extends StatelessWidget {
children: <Widget>[
for (var v in repos)
RepositoryItem(
owner: v.namespace.path,
avatarUrl: v.owner.avatarUrl,
owner: v.namespace!.path,
avatarUrl: v.owner!.avatarUrl,
name: v.path,
description: v.description,
starCount: v.stargazersCount,
forkCount: v.forksCount,
note: 'Updated ${timeago.format(v.updatedAt)}',
url: '/gitee/${v.namespace.path}/${v.path}',
avatarLink: '/gitee/${v.namespace.path}',
note: 'Updated ${timeago.format(v.updatedAt!)}',
url: '/gitee/${v.namespace!.path}/${v.path}',
avatarLink: '/gitee/${v.namespace!.path}',
// iconData: , TODO:
)
],

View File

@ -44,7 +44,7 @@ class GeUsersScreen extends StatelessWidget {
login: p.login,
name: p.name,
avatarUrl: p.avatarUrl,
bio: Text(p.htmlUrl),
bio: Text(p.htmlUrl!),
);
},
);

View File

@ -1,6 +1,8 @@
import 'package:ferry/ferry.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/graphql/github.data.gql.dart';
import 'package:git_touch/graphql/github.req.gql.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/graphql/schema.schema.gql.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
@ -13,10 +15,10 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class GhCommits extends StatelessWidget {
final String owner;
final String name;
final String branch;
final String? branch;
GhCommits(this.owner, this.name, {this.branch});
Widget _buildStatus(GStatusState state) {
Widget _buildStatus(GStatusState? state) {
const size = 18.0;
switch (state) {
case GStatusState.SUCCESS:
@ -30,8 +32,8 @@ class GhCommits extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GCommitsRefCommit_history_nodes, String>(
title: AppBarTitle(AppLocalizations.of(context).commits),
return ListStatefulScaffold<GCommitsRefCommit_history_nodes, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.commits),
fetch: (cursor) async {
final req = GCommitsReq((b) {
b.vars.owner = owner;
@ -40,10 +42,10 @@ class GhCommits extends StatelessWidget {
b.vars.ref = branch ?? '';
b.vars.after = cursor;
});
final res =
await context.read<AuthModel>().gqlClient.request(req).first;
final ref =
res.data.repository.defaultBranchRef ?? res.data.repository.ref;
final OperationResponse<GCommitsData, GCommitsVars?> res =
await context.read<AuthModel>().gqlClient!.request(req).first;
final ref = res.data!.repository!.defaultBranchRef ??
res.data!.repository!.ref!;
final history = (ref.target as GCommitsRefCommit).history;
return ListPayload(
cursor: history.pageInfo.endCursor,
@ -58,13 +60,13 @@ class GhCommits extends StatelessWidget {
avatarUrl: p.author?.avatarUrl,
avatarLink: login == null ? null : '/github/$login',
message: p.messageHeadline,
author: login ?? p.author.name,
author: login ?? p.author!.name,
createdAt: p.committedDate,
widgets: p.status == null
? null
: [
SizedBox(width: 4),
_buildStatus(p.status.state),
_buildStatus(p.status!.state),
],
);
},

View File

@ -18,23 +18,23 @@ class GhComparisonScreen extends StatelessWidget {
Widget build(BuildContext context) {
return RefreshStatefulScaffold(
title: AppBarTitle(AppLocalizations.of(context).files),
title: AppBarTitle(AppLocalizations.of(context)!.files),
fetch: () async {
final res = await context.read<AuthModel>().ghClient.getJSON(
final res = await context.read<AuthModel>().ghClient!.getJSON(
'/repos/$owner/$name/compare/$before...$head',
convert: (vs) => GithubComparisonItem.fromJson(vs));
convert: (dynamic vs) => GithubComparisonItem.fromJson(vs));
return res.files;
},
actionBuilder: (v, _) {
actionBuilder: (dynamic v, _) {
return ActionButton(
title: AppLocalizations.of(context).actions,
title: AppLocalizations.of(context)!.actions,
items: [
...ActionItem.getUrlActions(
'https://github.com/$owner/$name/compare/$before...$head'),
],
);
},
bodyBuilder: (v, _) {
bodyBuilder: (dynamic v, _) {
return Wrap(
children: v
.map<Widget>((vs) => FilesItem(

View File

@ -15,12 +15,12 @@ class GhContributorsScreen extends StatelessWidget {
Widget build(BuildContext context) {
return ListStatefulScaffold<GithubContributorItem, int>(
title: AppBarTitle(AppLocalizations.of(context).contributors),
title: AppBarTitle(AppLocalizations.of(context)!.contributors),
fetch: (page) async {
page = page ?? 1;
final res = await context
.read<AuthModel>()
.ghClient
.ghClient!
.getJSON<List, List<GithubContributorItem>>(
'/repos/$owner/$name/contributors?page=$page',
convert: (vs) =>
@ -33,7 +33,7 @@ class GhContributorsScreen extends StatelessWidget {
);
},
itemBuilder: (v) {
final String login = v.login;
final String? login = v.login;
return ContributorItem(
avatarUrl: v.avatarUrl,
commits: v.contributions,

View File

@ -16,13 +16,13 @@ class GhEventsScreen extends StatelessWidget {
@override
Widget build(context) {
return ListStatefulScaffold<GithubEvent, int>(
title: AppBarTitle(AppLocalizations.of(context).events),
title: AppBarTitle(AppLocalizations.of(context)!.events),
itemBuilder: (payload) => EventItem(payload),
fetch: (page) async {
page = page ?? 1;
final events = await context.read<AuthModel>().ghClient.getJSON(
final events = await context.read<AuthModel>().ghClient!.getJSON(
'/users/$login/events?page=$page&per_page=$pageSize',
convert: (vs) => [for (var v in vs) GithubEvent.fromJson(v)]);
convert: (dynamic vs) => [for (var v in vs) GithubEvent.fromJson(v)]);
return ListPayload(
cursor: page + 1,
hasMore: events.length == pageSize,

View File

@ -17,7 +17,7 @@ class GhFilesScreen extends StatelessWidget {
Widget build(BuildContext context) {
return ListStatefulScaffold<GithubFilesItem, int>(
title: AppBarTitle(AppLocalizations.of(context).files),
title: AppBarTitle(AppLocalizations.of(context)!.files),
actionBuilder: () {
return ActionButton(
title: 'Actions',
@ -31,7 +31,7 @@ class GhFilesScreen extends StatelessWidget {
page = page ?? 1;
final res = await context
.read<AuthModel>()
.ghClient
.ghClient!
.getJSON<List, List<GithubFilesItem>>(
'/repos/$owner/$name/pulls/$pullNumber/files?page=$page',
convert: (vs) => [for (var v in vs) GithubFilesItem.fromJson(v)],

View File

@ -9,8 +9,8 @@ class GistObjectScreen extends StatelessWidget {
final String login;
final String id;
final String file;
final String raw;
final String content;
final String? raw;
final String? content;
GistObjectScreen(this.login, this.id, this.file, {this.raw, this.content});

View File

@ -1,5 +1,7 @@
import 'package:ferry/ferry.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/gists_item.dart';
@ -15,15 +17,15 @@ class GhGistsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GGistsData_user_gists_nodes, String>(
title: AppBarTitle(AppLocalizations.of(context).gists),
return ListStatefulScaffold<GGistsData_user_gists_nodes, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.gists),
fetch: (page) async {
final req = GGistsReq((b) => b
..vars.login = login
..vars.after = page);
final res =
await context.read<AuthModel>().gqlClient.request(req).first;
final gists = res.data.user.gists;
final OperationResponse<GGistsData, GGistsVars?> res =
await context.read<AuthModel>().gqlClient!.request(req).first;
final gists = res.data!.user!.gists;
return ListPayload(
cursor: gists.pageInfo.endCursor,
items: gists.nodes,
@ -31,14 +33,14 @@ class GhGistsScreen extends StatelessWidget {
);
},
itemBuilder: (v) {
final filenames = [for (var file in v.files) file.name];
final filenames = [for (var file in v.files!) file.name];
// TODO: add gist comments
return GistsItem(
description: v.description,
login: login,
filenames: filenames,
language: v.files[0].language.name,
avatarUrl: v.owner.avatarUrl,
language: v.files![0].language!.name,
avatarUrl: v.owner!.avatarUrl,
updatedAt: v.updatedAt,
id: v.name,
);

View File

@ -1,7 +1,9 @@
import 'package:ferry/ferry.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:git_touch/graphql/github.data.gql.dart';
import 'package:git_touch/graphql/github.req.gql.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/scaffolds/refresh_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/object_tree.dart';
@ -16,20 +18,20 @@ class GhGistsFilesScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<GGistData_user_gist>(
title: AppBarTitle(AppLocalizations.of(context).files),
return RefreshStatefulScaffold<GGistData_user_gist?>(
title: AppBarTitle(AppLocalizations.of(context)!.files),
fetch: () async {
final req = GGistReq((b) => b
..vars.login = login
..vars.name = id);
final res =
await context.read<AuthModel>().gqlClient.request(req).first;
final gist = res.data.user.gist;
final OperationResponse<GGistData, GGistVars?> res =
await context.read<AuthModel>().gqlClient!.request(req).first;
final gist = res.data!.user!.gist;
return gist;
},
bodyBuilder: (payload, _) {
return ObjectTree(
items: payload.files.map((v) {
items: payload!.files!.map((v) {
final uri = Uri(
path: '/github/$login/gists/$id/${v.name}',
queryParameters: {

View File

@ -1,7 +1,9 @@
import 'package:ferry/ferry.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:git_touch/graphql/github.data.gql.dart';
import 'package:git_touch/graphql/github.req.gql.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/utils/utils.dart';
@ -23,10 +25,10 @@ class GhIssueScreen extends StatelessWidget {
Widget _buildHeader(
BuildContext context, {
@required String avatarUrl,
@required String title,
@required StateLabelStatus status,
@required Widget body,
required String? avatarUrl,
required String title,
required StateLabelStatus status,
required Widget body,
Iterable<Widget> extraWidgets = const [],
}) {
final theme = Provider.of<ThemeModel>(context);
@ -38,7 +40,7 @@ class GhIssueScreen extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Link(
LinkWidget(
url: '/github/$owner/$name',
child: Row(
children: <Widget>[
@ -85,16 +87,17 @@ class GhIssueScreen extends StatelessWidget {
);
}
Future<GIssueData_repository> _queryIssue(BuildContext context,
{String cursor}) async {
Future<GIssueData_repository?> _queryIssue(BuildContext context,
{String? cursor}) async {
final req = GIssueReq((b) {
b.vars.owner = owner;
b.vars.name = name;
b.vars.number = number;
b.vars.cursor = cursor;
});
var res = await context.read<AuthModel>().gqlClient.request(req).first;
return res.data.repository;
OperationResponse<GIssueData, GIssueVars?> res =
await context.read<AuthModel>().gqlClient!.request(req).first;
return res.data!.repository;
}
@override
@ -102,7 +105,7 @@ class GhIssueScreen extends StatelessWidget {
return LongListStatefulScaffold<GIssueData_repository, dynamic>(
title: Text('$owner/$name #$number'),
trailingBuilder: (p) {
if (p.issueOrPullRequest.G__typename == 'Issue') {
if (p.issueOrPullRequest!.G__typename == 'Issue') {
final d = p.issueOrPullRequest
as GIssueData_repository_issueOrPullRequest__asIssue;
return ActionButton(
@ -112,7 +115,7 @@ class GhIssueScreen extends StatelessWidget {
ActionItem(
text: d.closed ? 'Reopen issue' : 'Close issue',
onTap: (_) async {
await context.read<AuthModel>().ghClient.issues.edit(
await context.read<AuthModel>().ghClient!.issues.edit(
github.RepositorySlug(owner, name),
number,
github.IssueRequest(
@ -135,13 +138,13 @@ class GhIssueScreen extends StatelessWidget {
},
headerBuilder: (p) {
final theme = Provider.of<ThemeModel>(context);
if (p.issueOrPullRequest.G__typename == 'Issue') {
if (p.issueOrPullRequest!.G__typename == 'Issue') {
final issue = p.issueOrPullRequest
as GIssueData_repository_issueOrPullRequest__asIssue;
return _buildHeader(
context,
avatarUrl: issue.author.avatarUrl,
avatarUrl: issue.author!.avatarUrl,
title: issue.title,
status: issue.closed
? StateLabelStatus.issueClosed
@ -205,7 +208,7 @@ class GhIssueScreen extends StatelessWidget {
as GIssueData_repository_issueOrPullRequest__asPullRequest;
return _buildHeader(
context,
avatarUrl: pr.author.avatarUrl,
avatarUrl: pr.author!.avatarUrl,
title: pr.title,
status: pr.merged
? StateLabelStatus.pullMerged
@ -214,7 +217,7 @@ class GhIssueScreen extends StatelessWidget {
: StateLabelStatus.pullOpened,
body: CommentItem.gql(pr, pr, (key) {}),
extraWidgets: [
Link(
LinkWidget(
child: Container(
padding: EdgeInsets.symmetric(vertical: 8),
child: Row(
@ -254,15 +257,16 @@ class GhIssueScreen extends StatelessWidget {
},
itemBuilder: (p) => TimelineItem(p),
onRefresh: () async {
final res = await _queryIssue(context);
if (res.issueOrPullRequest.G__typename == 'Issue') {
final res =
await (_queryIssue(context) as Future<GIssueData_repository>);
if (res.issueOrPullRequest!.G__typename == 'Issue') {
final issue = res.issueOrPullRequest
as GIssueData_repository_issueOrPullRequest__asIssue;
return LongListPayload(
header: res,
totalCount: issue.timelineItems.totalCount,
cursor: issue.timelineItems.pageInfo.endCursor,
leadingItems: issue.timelineItems.nodes.toList(),
leadingItems: issue.timelineItems.nodes!.toList(),
trailingItems: [],
);
} else {
@ -272,21 +276,22 @@ class GhIssueScreen extends StatelessWidget {
header: res,
totalCount: pr.timelineItems.totalCount,
cursor: pr.timelineItems.pageInfo.endCursor,
leadingItems: pr.timelineItems.nodes.toList(),
leadingItems: pr.timelineItems.nodes!.toList(),
trailingItems: [],
);
}
},
onLoadMore: (_cursor) async {
final res = await _queryIssue(context, cursor: _cursor);
if (res.issueOrPullRequest.G__typename == 'Issue') {
final res = await (_queryIssue(context, cursor: _cursor)
as Future<GIssueData_repository>);
if (res.issueOrPullRequest!.G__typename == 'Issue') {
final issue = res.issueOrPullRequest
as GIssueData_repository_issueOrPullRequest__asIssue;
return LongListPayload(
header: res,
totalCount: issue.timelineItems.totalCount,
cursor: issue.timelineItems.pageInfo.endCursor,
leadingItems: issue.timelineItems.nodes.toList(),
leadingItems: issue.timelineItems.nodes!.toList(),
);
} else {
final pr = res.issueOrPullRequest
@ -295,7 +300,7 @@ class GhIssueScreen extends StatelessWidget {
header: res,
totalCount: pr.timelineItems.totalCount,
cursor: pr.timelineItems.pageInfo.endCursor,
leadingItems: pr.timelineItems.nodes.toList(),
leadingItems: pr.timelineItems.nodes!.toList(),
);
}
},

View File

@ -59,7 +59,7 @@ class _GhIssueFormScreenState extends State<GhIssueFormScreen> {
final slug = RepositorySlug(widget.owner, widget.name);
final res = await context
.read<AuthModel>()
.ghClient
.ghClient!
.issues
.create(slug, IssueRequest(title: _title, body: _body));
await theme.push(

View File

@ -1,6 +1,8 @@
import 'package:ferry/ferry.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/graphql/github.data.gql.dart';
import 'package:git_touch/graphql/github.req.gql.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
@ -18,8 +20,8 @@ class GhIssuesScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GIssuesData_repository_issues_nodes, String>(
title: AppBarTitle(AppLocalizations.of(context).issues),
return ListStatefulScaffold<GIssuesData_repository_issues_nodes, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.issues),
actionBuilder: () => ActionEntry(
iconData: Octicons.plus,
url: '/github/$owner/$name/issues/new',
@ -30,13 +32,13 @@ class GhIssuesScreen extends StatelessWidget {
b.vars.name = name;
b.vars.cursor = cursor;
});
final res =
await context.read<AuthModel>().gqlClient.request(req).first;
final issues = res.data.repository.issues;
final OperationResponse<GIssuesData, GIssuesVars?> res =
await context.read<AuthModel>().gqlClient!.request(req).first;
final issues = res.data!.repository!.issues;
return ListPayload(
cursor: issues.pageInfo.endCursor,
hasMore: issues.pageInfo.hasNextPage,
items: issues.nodes.toList(),
items: issues.nodes!.toList(),
);
},
itemBuilder: (p) {
@ -47,10 +49,10 @@ class GhIssuesScreen extends StatelessWidget {
subtitle: '#' + p.number.toString(),
title: p.title,
updatedAt: p.updatedAt,
labels: p.labels.nodes.isEmpty
labels: p.labels!.nodes!.isEmpty
? null
: Wrap(spacing: 4, runSpacing: 4, children: [
for (var label in p.labels.nodes)
for (var label in p.labels!.nodes!)
MyLabel(name: label.name, cssColor: label.color)
]),
url: '/github/$owner/$name/issues/${p.number}',

View File

@ -24,7 +24,7 @@ class GhNewsScreenState extends State<GhNewsScreen> {
// 1 item is enough since count is not displayed for now.
var items = await context
.read<AuthModel>()
.ghClient
.ghClient!
.getJSON('/notifications?per_page=1');
if (items is List && items.isNotEmpty) {
@ -36,16 +36,16 @@ class GhNewsScreenState extends State<GhNewsScreen> {
@override
Widget build(context) {
return ListStatefulScaffold<GithubEvent, int>(
title: AppBarTitle(AppLocalizations.of(context).news),
title: AppBarTitle(AppLocalizations.of(context)!.news),
itemBuilder: (payload) => EventItem(payload),
fetch: (page) async {
page = page ?? 1;
final auth = context.read<AuthModel>();
final login = auth.activeAccount.login;
final login = auth.activeAccount!.login;
final events = await auth.ghClient.getJSON(
final events = await auth.ghClient!.getJSON(
'/users/$login/received_events?page=$page&per_page=$pageSize',
convert: (vs) => [for (var v in vs) GithubEvent.fromJson(v)],
convert: (dynamic vs) => [for (var v in vs) GithubEvent.fromJson(v)],
);
return ListPayload(
cursor: page + 1,

View File

@ -20,25 +20,25 @@ class GhNotificationScreen extends StatefulWidget {
}
class GhNotificationScreenState extends State<GhNotificationScreen> {
Future<Map<String, NotificationGroup>> fetchNotifications(int index) async {
final ns = await context.read<AuthModel>().ghClient.getJSON(
Future<Map<String?, NotificationGroup>> fetchNotifications(int index) async {
final ns = await context.read<AuthModel>().ghClient!.getJSON(
'/notifications?all=${index == 2}&participating=${index == 1}',
convert: (vs) =>
convert: (dynamic vs) =>
[for (var v in vs) GithubNotificationItem.fromJson(v)],
);
if (index == 0) {
context.read<NotificationModel>().setCount(ns.length);
}
Map<String, NotificationGroup> _groupMap = {};
Map<String?, NotificationGroup> _groupMap = {};
ns.forEach((item) {
final repo = item.repository.fullName;
final repo = item.repository!.fullName;
if (_groupMap[repo] == null) {
_groupMap[repo] = NotificationGroup(repo);
}
_groupMap[repo].items.add(item);
_groupMap[repo]!.items.add(item);
});
if (_groupMap.isNotEmpty) {
@ -47,8 +47,8 @@ class GhNotificationScreenState extends State<GhNotificationScreen> {
_groupMap.forEach((repo, group) {
// Check if issue and pull request exist
if (group.items.where((item) {
return item.subject.type == 'Issue' ||
item.subject.type == 'PullRequest';
return item.subject!.type == 'Issue' ||
item.subject!.type == 'PullRequest';
}).isEmpty) {
return;
}
@ -57,17 +57,17 @@ class GhNotificationScreenState extends State<GhNotificationScreen> {
'${group.key}: repository(owner: "${group.owner}", name: "${group.name}") {';
group.items.forEach((item) {
switch (item.subject.type) {
switch (item.subject!.type) {
case 'Issue':
schema += '''
${item.key}: issue(number: ${item.subject.number}) {
${item.key}: issue(number: ${item.subject!.number}) {
state
}
''';
break;
case 'PullRequest':
schema += '''
${item.key}: pullRequest(number: ${item.subject.number}) {
${item.key}: pullRequest(number: ${item.subject!.number}) {
state
}
''';
@ -112,7 +112,7 @@ ${item.key}: pullRequest(number: ${item.subject.number}) {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
group.fullName,
group.fullName!,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
@ -123,10 +123,10 @@ ${item.key}: pullRequest(number: ${item.subject.number}) {
onTap: () async {
await context
.read<AuthModel>()
.ghClient
.ghClient!
.activity
.markRepositoryNotificationsRead(
RepositorySlug.full(group.fullName));
RepositorySlug.full(group.fullName!));
// await _onSwitchTab(); // TODO:
},
child: Icon(
@ -138,13 +138,13 @@ ${item.key}: pullRequest(number: ${item.subject.number}) {
],
),
items: group.items,
itemBuilder: (item, index) {
itemBuilder: (dynamic item, index) {
return NotificationItem(
payload: item,
markAsRead: () {
if (mounted) {
setState(() {
groupMap[entry.key].items[index].unread = false;
groupMap[entry.key]!.items[index].unread = false;
});
}
},
@ -156,14 +156,14 @@ ${item.key}: pullRequest(number: ${item.subject.number}) {
@override
Widget build(context) {
return TabStatefulScaffold(
title: AppBarTitle(AppLocalizations.of(context).notification),
title: AppBarTitle(AppLocalizations.of(context)!.notification),
tabs: [
AppLocalizations.of(context).unread,
AppLocalizations.of(context).participating,
AppLocalizations.of(context).all
AppLocalizations.of(context)!.unread,
AppLocalizations.of(context)!.participating,
AppLocalizations.of(context)!.all
],
fetchData: fetchNotifications,
bodyBuilder: (groupMap, activeTab) {
bodyBuilder: (dynamic groupMap, activeTab) {
if (groupMap.isEmpty) return EmptyWidget();
return Column(

View File

@ -14,8 +14,8 @@ class GhObjectScreen extends StatelessWidget {
final String owner;
final String name;
final String ref;
final String path;
final String raw;
final String? path;
final String? raw;
GhObjectScreen(this.owner, this.name, this.ref, {this.path, this.raw});
@override
@ -27,7 +27,7 @@ class GhObjectScreen extends StatelessWidget {
// Do not request again for images
if (path != null &&
raw != null &&
['png', 'jpg', 'jpeg', 'gif', 'webp'].contains(path.ext)) {
['png', 'jpg', 'jpeg', 'gif', 'webp'].contains(path!.ext)) {
return RepositoryContents(
file: GitHubFile(downloadUrl: raw, content: ''),
);
@ -36,11 +36,11 @@ class GhObjectScreen extends StatelessWidget {
final suffix = path == null ? '' : '/$path';
final res = await context
.read<AuthModel>()
.ghClient
.ghClient!
.repositories
.getContents(RepositorySlug(owner, name), suffix, ref: ref);
if (res.isDirectory) {
res.tree.sort((a, b) {
res.tree!.sort((a, b) {
return sortByKey('dir', a.type, b.type);
});
}
@ -59,7 +59,7 @@ class GhObjectScreen extends StatelessWidget {
bodyBuilder: (data, _) {
if (data.isDirectory) {
return ObjectTree(
items: data.tree.map((v) {
items: data.tree!.map((v) {
// if (item.type == 'commit') return null;
final uri = Uri(
path: '/github/$owner/$name/blob/$ref',
@ -82,8 +82,8 @@ class GhObjectScreen extends StatelessWidget {
// basePaths: [owner, name, branch, ...paths]
return BlobView(
path,
text: data.file.text,
networkUrl: data.file.downloadUrl,
text: data.file!.text,
networkUrl: data.file!.downloadUrl,
);
}
},

View File

@ -20,12 +20,12 @@ class GhOrgReposScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<Repository, int>(
title: AppBarTitle(AppLocalizations.of(context).repositories),
title: AppBarTitle(AppLocalizations.of(context)!.repositories),
fetch: (page) async {
page = page ?? 1;
final rs = await context
.read<AuthModel>()
.ghClient
.ghClient!
.getJSON<List, List<Repository>>(
'/orgs/$owner/repos?sort=updated&page=$page',
convert: (vs) => [for (var v in vs) Repository.fromJson(v)],
@ -38,15 +38,15 @@ class GhOrgReposScreen extends StatelessWidget {
},
itemBuilder: (v) {
return RepositoryItem.gh(
owner: v.owner.login,
avatarUrl: v.owner.avatarUrl,
owner: v.owner!.login,
avatarUrl: v.owner!.avatarUrl,
name: v.name,
description: v.description,
starCount: v.stargazersCount,
forkCount: v.forksCount,
primaryLanguageName: v.language,
primaryLanguageColor: null,
note: 'Updated ${timeago.format(v.updatedAt)}',
note: 'Updated ${timeago.format(v.updatedAt!)}',
isPrivate: v.isPrivate,
isFork: v.isFork,
);

View File

@ -14,12 +14,12 @@ class GhUserOrganizationScreen extends StatelessWidget {
Widget build(BuildContext context) {
return ListStatefulScaffold<GithubUserOrganizationItem, int>(
title: AppBarTitle(AppLocalizations.of(context).organizations),
title: AppBarTitle(AppLocalizations.of(context)!.organizations),
fetch: (page) async {
page = page ?? 1;
final res = await context
.read<AuthModel>()
.ghClient
.ghClient!
.getJSON<List, List<GithubUserOrganizationItem>>(
'/users/$login/orgs?page=$page',
convert: (vs) =>
@ -36,7 +36,7 @@ class GhUserOrganizationScreen extends StatelessWidget {
avatarUrl: v.avatarUrl,
login: v.login,
name: null, // TODO: organization name
bio: v.description == null ? null : Text(v.description),
bio: v.description == null ? null : Text(v.description!),
);
},
);

View File

@ -1,6 +1,8 @@
import 'package:ferry/ferry.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/graphql/github.data.gql.dart';
import 'package:git_touch/graphql/github.req.gql.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
@ -17,21 +19,21 @@ class GhPullsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GPullsData_repository_pullRequests_nodes,
String>(
title: AppBarTitle(AppLocalizations.of(context).pullRequests),
String?>(
title: AppBarTitle(AppLocalizations.of(context)!.pullRequests),
fetch: (cursor) async {
final req = GPullsReq((b) {
b.vars.owner = owner;
b.vars.name = name;
b.vars.cursor = cursor;
});
final res =
await context.read<AuthModel>().gqlClient.request(req).first;
final pulls = res.data.repository.pullRequests;
final OperationResponse<GPullsData, GPullsVars?> res =
await context.read<AuthModel>().gqlClient!.request(req).first;
final pulls = res.data!.repository!.pullRequests;
return ListPayload(
cursor: pulls.pageInfo.endCursor,
hasMore: pulls.pageInfo.hasNextPage,
items: pulls.nodes.toList(),
items: pulls.nodes!.toList(),
);
},
itemBuilder: (p) => IssueItem(
@ -42,10 +44,10 @@ class GhPullsScreen extends StatelessWidget {
subtitle: '#' + p.number.toString(),
title: p.title,
updatedAt: p.updatedAt,
labels: p.labels.nodes.isEmpty
labels: p.labels!.nodes!.isEmpty
? null
: Wrap(spacing: 4, runSpacing: 4, children: [
for (var label in p.labels.nodes)
for (var label in p.labels!.nodes!)
MyLabel(name: label.name, cssColor: label.color)
]),
url: '/github/$owner/$name/pull/${p.number}',

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:ferry/ferry.dart';
import 'package:flutter/cupertino.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/release_item.dart';
@ -16,16 +18,16 @@ class GhReleasesScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GReleasesData_repository_releases_nodes,
String>(
String?>(
title: AppBarTitle("Releases"),
fetch: (page) async {
final req = GReleasesReq((b) => b
..vars.owner = owner
..vars.name = name
..vars.cursor = page);
final res =
await context.read<AuthModel>().gqlClient.request(req).first;
final releases = res.data.repository.releases;
final OperationResponse<GReleasesData, GReleasesVars?> res =
await context.read<AuthModel>().gqlClient!.request(req).first;
final releases = res.data!.repository!.releases;
return ListPayload(
cursor: releases.pageInfo.endCursor,
items: releases.nodes,
@ -36,8 +38,8 @@ class GhReleasesScreen extends StatelessWidget {
return ReleaseItem(
tagName: v.tagName,
publishedAt: v.publishedAt,
avatarUrl: v.author.avatarUrl,
login: v.author.name,
avatarUrl: v.author!.avatarUrl,
login: v.author!.name,
name: v.name,
description: v.description,
releaseAssets: v.releaseAssets,

View File

@ -1,8 +1,10 @@
import 'package:ferry/ferry.dart';
import 'package:filesize/filesize.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:git_touch/graphql/github.data.gql.dart';
import 'package:git_touch/graphql/github.req.gql.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/graphql/schema.schema.gql.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/scaffolds/refresh_stateful.dart';
@ -26,10 +28,10 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class GhRepoScreen extends StatelessWidget {
final String owner;
final String name;
final String branch;
final String? branch;
GhRepoScreen(this.owner, this.name, {this.branch});
String _buildWatchState(GSubscriptionState state) {
String _buildWatchState(GSubscriptionState? state) {
switch (state) {
case GSubscriptionState.IGNORED:
return 'Ignoring';
@ -46,19 +48,19 @@ class GhRepoScreen extends StatelessWidget {
Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
return RefreshStatefulScaffold<
Tuple3<GRepoData_repository, Future<int>, MarkdownViewData>>(
title: AppBarTitle(AppLocalizations.of(context).repository),
Tuple3<GRepoData_repository?, Future<int>, MarkdownViewData>>(
title: AppBarTitle(AppLocalizations.of(context)!.repository),
fetch: () async {
final req = GRepoReq((b) => b
..vars.owner = owner
..vars.name = name
..vars.branchSpecified = branch != null
..vars.branch = branch ?? '');
final res =
await context.read<AuthModel>().gqlClient.request(req).first;
final repo = res.data.repository;
final OperationResponse<GRepoData, GRepoVars?> res =
await context.read<AuthModel>().gqlClient!.request(req).first;
final repo = res.data!.repository;
final ghClient = context.read<AuthModel>().ghClient;
final ghClient = context.read<AuthModel>().ghClient!;
final countFuture = ghClient
.getJSON('/repos/$owner/$name/stats/contributors')
.then((v) => (v as List).length);
@ -86,12 +88,12 @@ class GhRepoScreen extends StatelessWidget {
return Tuple3(repo, countFuture, readmeData);
},
actionBuilder: (data, _) {
final repo = data.item1;
final repo = data.item1!;
return ActionButton(
title: AppLocalizations.of(context).repositoryActions,
title: AppLocalizations.of(context)!.repositoryActions,
items: [
ActionItem(
text: AppLocalizations.of(context).projects +
text: AppLocalizations.of(context)!.projects +
'(${repo.projects.totalCount})',
url: repo.projectsUrl,
),
@ -100,7 +102,7 @@ class GhRepoScreen extends StatelessWidget {
);
},
bodyBuilder: (data, setData) {
final repo = data.item1;
final repo = data.item1!;
final contributionFuture = data.item2;
final readmeData = data.item3;
@ -130,8 +132,10 @@ class GhRepoScreen extends StatelessWidget {
ActionItem(
text: _buildWatchState(v),
onTap: (_) async {
final activityApi =
context.read<AuthModel>().ghClient.activity;
final activityApi = context
.read<AuthModel>()
.ghClient!
.activity;
switch (v) {
case GSubscriptionState.SUBSCRIBED:
case GSubscriptionState.IGNORED:
@ -166,10 +170,10 @@ class GhRepoScreen extends StatelessWidget {
SizedBox(width: 8),
MutationButton(
active: repo.viewerHasStarred,
text: repo.viewerHasStarred ? 'Unstar' : 'Star',
text: repo.viewerHasStarred? 'Unstar' : 'Star',
onTap: () async {
final activityApi =
context.read<AuthModel>().ghClient.activity;
context.read<AuthModel>().ghClient!.activity;
if (repo.viewerHasStarred) {
await activityApi.unstar(
RepositorySlug(repo.owner.login, repo.name));
@ -186,12 +190,12 @@ class GhRepoScreen extends StatelessWidget {
),
],
trailings: <Widget>[
if (repo.repositoryTopics.nodes.isNotEmpty)
if (repo.repositoryTopics.nodes!.isNotEmpty)
// TODO: link
Wrap(
spacing: 4,
runSpacing: 4,
children: repo.repositoryTopics.nodes.map((node) {
children: repo.repositoryTopics.nodes!.map((node) {
return MyLabel(
name: node.topic.name,
// color: Colors.blue.shade50,
@ -207,28 +211,28 @@ class GhRepoScreen extends StatelessWidget {
children: <Widget>[
EntryItem(
count: repo.watchers.totalCount,
text: AppLocalizations.of(context).watchers,
text: AppLocalizations.of(context)!.watchers,
url: '/github/$owner/$name/watchers',
),
EntryItem(
count: repo.stargazers.totalCount,
text: AppLocalizations.of(context).stars,
text: AppLocalizations.of(context)!.stars,
url: '/github/$owner/$name/stargazers',
),
EntryItem(
count: repo.forks.totalCount,
text: AppLocalizations.of(context).forks,
text: AppLocalizations.of(context)!.forks,
url: 'https://github.com/$owner/$name/network/members',
),
],
),
if (repo.languages.edges.isNotEmpty) ...[
if (repo.languages!.edges!.isNotEmpty) ...[
CommonStyle.border,
LanguageBar([
for (var edge in repo.languages.edges)
for (var edge in repo.languages!.edges!)
LanguageBarItem(
name: edge.node.name,
ratio: edge.size / repo.languages.totalSize,
ratio: edge.size/ repo.languages!.totalSize,
hexColor: edge.node.color,
)
]),
@ -242,21 +246,21 @@ class GhRepoScreen extends StatelessWidget {
text: Text(repo.primaryLanguage?.name ?? 'Code'),
rightWidget: Text(
(license == null ? '' : '$license') +
filesize(repo.diskUsage * 1000),
filesize(repo.diskUsage! * 1000),
),
url: '/github/$owner/$name/blob/${ref.name}',
),
if (repo.hasIssuesEnabled)
TableViewItem(
leftIconData: Octicons.issue_opened,
text: Text(AppLocalizations.of(context).issues),
text: Text(AppLocalizations.of(context)!.issues),
rightWidget:
Text(numberFormat.format(repo.issues.totalCount)),
url: '/github/$owner/$name/issues',
),
TableViewItem(
leftIconData: Octicons.git_pull_request,
text: Text(AppLocalizations.of(context).pullRequests),
text: Text(AppLocalizations.of(context)!.pullRequests),
rightWidget:
Text(numberFormat.format(repo.pullRequests.totalCount)),
url: '/github/$owner/$name/pulls',
@ -264,7 +268,7 @@ class GhRepoScreen extends StatelessWidget {
if (ref != null) ...[
TableViewItem(
leftIconData: Octicons.history,
text: Text(AppLocalizations.of(context).commits),
text: Text(AppLocalizations.of(context)!.commits),
rightWidget: Text(
((ref.target as GRepoCommit).history?.totalCount ?? 0)
.toString()),
@ -273,12 +277,12 @@ class GhRepoScreen extends StatelessWidget {
if (repo.refs != null)
TableViewItem(
leftIconData: Octicons.git_branch,
text: Text(AppLocalizations.of(context).branches),
rightWidget: Text(ref.name +
text: Text(AppLocalizations.of(context)!.branches),
rightWidget: Text(ref.name+
'' +
numberFormat.format(repo.refs.totalCount)),
numberFormat.format(repo.refs!.totalCount)),
onTap: () async {
final refs = repo.refs.nodes;
final refs = repo.refs!.nodes!;
if (refs.length < 2) return;
await theme.showPicker(
@ -301,7 +305,7 @@ class GhRepoScreen extends StatelessWidget {
),
TableViewItem(
leftIconData: Octicons.organization,
text: Text(AppLocalizations.of(context).contributors),
text: Text(AppLocalizations.of(context)!.contributors),
rightWidget: FutureBuilder<int>(
future: contributionFuture,
builder: (context, snapshot) {

View File

@ -1,6 +1,8 @@
import 'package:ferry/ferry.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/graphql/github.data.gql.dart';
import 'package:git_touch/graphql/github.req.gql.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/models/auth.dart';
@ -14,7 +16,7 @@ class GhRepos extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GReposRepoItem, String>(
return ListStatefulScaffold<GReposRepoItem, String?>(
title: AppBarTitle('Repositories'),
fetch: (cursor) async {
final auth = context.read<AuthModel>();
@ -22,8 +24,9 @@ class GhRepos extends StatelessWidget {
b.vars.login = login;
b.vars.after = cursor;
});
final res = await auth.gqlClient.request(req).first;
final p = res.data.user.repositories;
final OperationResponse<GReposData, GReposVars?> res =
await auth.gqlClient!.request(req).first;
final p = res.data!.user!.repositories;
return ListPayload(
cursor: p.pageInfo.endCursor,
hasMore: p.pageInfo.hasNextPage,
@ -44,7 +47,7 @@ class GhStars extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GReposRepoItem, String>(
return ListStatefulScaffold<GReposRepoItem, String?>(
title: AppBarTitle('Stars'),
fetch: (cursor) async {
final auth = context.read<AuthModel>();
@ -52,8 +55,9 @@ class GhStars extends StatelessWidget {
b.vars.login = login;
b.vars.after = cursor;
});
final res = await auth.gqlClient.request(req).first;
final p = res.data.user.starredRepositories;
final OperationResponse<GStarsData, GStarsVars?> res =
await auth.gqlClient!.request(req).first;
final p = res.data!.user!.starredRepositories;
return ListPayload(
cursor: p.pageInfo.endCursor,
hasMore: p.pageInfo.hasNextPage,

View File

@ -19,13 +19,13 @@ class GhSearchScreen extends StatefulWidget {
}
class _GhSearchScreenState extends State<GhSearchScreen> {
int _activeTab = 0;
int? _activeTab = 0;
bool _loading = false;
List<List> _payloads = [[], [], []];
List<List?> _payloads = [[], [], []];
TextEditingController _controller;
TextEditingController? _controller;
String get _keyword => _controller.text?.trim() ?? '';
String get _keyword => _controller!.text?.trim() ?? '';
@override
void initState() {
@ -35,14 +35,14 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
@override
void dispose() {
_controller.dispose();
_controller!.dispose();
super.dispose();
}
Future<void> _query() async {
if (_loading || _keyword.isEmpty) return;
var keyword = _controller.text;
var keyword = _controller!.text;
setState(() {
_loading = true;
});
@ -126,7 +126,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
Icon(Octicons.search, size: 20, color: PrimerColors.gray400),
],
),
placeholder: AppLocalizations.of(context).search,
placeholder: AppLocalizations.of(context)!.search,
clearButtonMode: OverlayVisibilityMode.editing,
textInputAction: TextInputAction.go,
onSubmitted: (_) => _query(),
@ -136,7 +136,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
default:
return TextField(
decoration: InputDecoration.collapsed(
hintText: AppLocalizations.of(context).search),
hintText: AppLocalizations.of(context)!.search),
textInputAction: TextInputAction.go,
onSubmitted: (_) => _query(),
controller: _controller,
@ -144,11 +144,11 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
}
}
_onTabSwitch(int index) {
_onTabSwitch(int? index) {
setState(() {
_activeTab = index;
});
if (_payloads[_activeTab].isEmpty) {
if (_payloads[_activeTab!]!.isEmpty) {
_query();
}
}
@ -236,7 +236,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
if (_loading)
Loading()
else
..._payloads[_activeTab].map(_buildItem).toList(),
..._payloads[_activeTab!]!.map(_buildItem).toList(),
],
),
),

View File

@ -15,10 +15,10 @@ class GhTrendingScreen extends StatelessWidget {
Widget build(BuildContext context) {
return TabStatefulScaffold<List>(
title: AppBarTitle(AppLocalizations.of(context).trending),
title: AppBarTitle(AppLocalizations.of(context)!.trending),
tabs: [
AppLocalizations.of(context).repositories,
AppLocalizations.of(context).developers
AppLocalizations.of(context)!.repositories,
AppLocalizations.of(context)!.developers
],
fetchData: (tabIndex) async {
if (tabIndex == 0) {
@ -58,8 +58,8 @@ class GhTrendingScreen extends StatelessWidget {
avatarUrl: v.avatar,
bio: v.repo == null
? null
: Link(
url: '/github/${v.username}/${v.repo.name}',
: LinkWidget(
url: '/github/${v.username}/${v.repo!.name}',
child: Row(
children: <Widget>[
Icon(
@ -70,7 +70,7 @@ class GhTrendingScreen extends StatelessWidget {
SizedBox(width: 4),
Expanded(
child: Text(
'${v.username} / ${v.repo.name}',
'${v.username} / ${v.repo!.name}',
style: TextStyle(
fontSize: 17,
color: theme.palette.secondaryText,

View File

@ -1,7 +1,9 @@
import 'package:ferry/ferry.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:git_touch/graphql/github.data.gql.dart';
import 'package:git_touch/graphql/github.req.gql.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/scaffolds/refresh_stateful.dart';
import 'package:git_touch/utils/utils.dart';
@ -21,9 +23,9 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class _Repos extends StatelessWidget {
final String title;
final Iterable<GRepoItem> repos;
final Iterable<GRepoItem>? repos;
_Repos(final Iterable<GRepoItem> pinned, final Iterable<GRepoItem> repos)
_Repos(final Iterable<GRepoItem> pinned, final Iterable<GRepoItem>? repos)
: title =
pinned.isNotEmpty ? 'pinned repositories' : 'popular repositories',
repos = pinned.isNotEmpty ? pinned : repos;
@ -36,7 +38,7 @@ class _Repos extends StatelessWidget {
TableViewHeader(title),
...join(
CommonStyle.border,
repos.map((v) {
repos!.map((v) {
return RepositoryItem.gh(
owner: v.owner.login,
avatarUrl: v.owner.avatarUrl,
@ -57,7 +59,7 @@ class _Repos extends StatelessWidget {
}
class _User extends StatelessWidget {
final GUserParts p;
final GUserParts? p;
final bool isViewer;
final List<Widget> rightWidgets;
const _User(this.p, {this.isViewer = false, this.rightWidgets = const []});
@ -65,40 +67,40 @@ class _User extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
final login = p.login;
final login = p!.login;
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
UserHeader(
avatarUrl: p.avatarUrl,
name: p.name,
login: p.login,
createdAt: p.createdAt,
bio: p.bio,
avatarUrl: p!.avatarUrl,
name: p!.name,
login: p!.login,
createdAt: p!.createdAt,
bio: p!.bio,
isViewer: isViewer,
rightWidgets: rightWidgets,
),
CommonStyle.border,
Row(children: [
EntryItem(
count: p.repositories.totalCount,
text: AppLocalizations.of(context).repositories,
count: p!.repositories.totalCount,
text: AppLocalizations.of(context)!.repositories,
url: '/github/$login?tab=repositories',
),
EntryItem(
count: p.starredRepositories.totalCount,
text: AppLocalizations.of(context).stars,
count: p!.starredRepositories.totalCount,
text: AppLocalizations.of(context)!.stars,
url: '/github/$login?tab=stars',
),
EntryItem(
count: p.followers.totalCount,
text: AppLocalizations.of(context).followers,
count: p!.followers.totalCount,
text: AppLocalizations.of(context)!.followers,
url: '/github/$login?tab=followers',
),
EntryItem(
count: p.following.totalCount,
text: AppLocalizations.of(context).following,
count: p!.following.totalCount,
text: AppLocalizations.of(context)!.following,
url: '/github/$login?tab=following',
),
]),
@ -106,7 +108,7 @@ class _User extends StatelessWidget {
ContributionWidget(
weeks: [
for (final week
in p.contributionsCollection.contributionCalendar.weeks)
in p!.contributionsCollection.contributionCalendar.weeks)
[
// https://github.com/git-touch/git-touch/issues/122
for (final day in week.contributionDays)
@ -120,52 +122,52 @@ class _User extends StatelessWidget {
items: [
TableViewItem(
leftIconData: Octicons.rss,
text: Text(AppLocalizations.of(context).events),
text: Text(AppLocalizations.of(context)!.events),
url: '/github/$login?tab=events',
),
TableViewItem(
leftIconData: Octicons.book,
text: Text(AppLocalizations.of(context).gists),
text: Text(AppLocalizations.of(context)!.gists),
url: '/github/$login?tab=gists',
),
TableViewItem(
leftIconData: Octicons.home,
text: Text(AppLocalizations.of(context).organizations),
text: Text(AppLocalizations.of(context)!.organizations),
url: '/github/$login?tab=organizations',
),
if (isNotNullOrEmpty(p.company))
if (isNotNullOrEmpty(p!.company))
TableViewItem(
leftIconData: Octicons.organization,
text: TextWithAt(
text: p.company,
text: p!.company!,
linkFactory: (text) => '/github/' + text.substring(1),
style: TextStyle(fontSize: 17, color: theme.palette.text),
oneLine: true,
),
),
if (isNotNullOrEmpty(p.location))
if (isNotNullOrEmpty(p!.location))
TableViewItem(
leftIconData: Octicons.location,
text: Text(p.location),
text: Text(p!.location!),
onTap: () {
launchUrl('https://www.google.com/maps/place/' +
p.location.replaceAll(RegExp(r'\s+'), ''));
p!.location!.replaceAll(RegExp(r'\s+'), ''));
},
),
if (isNotNullOrEmpty(p.email))
if (isNotNullOrEmpty(p!.email))
TableViewItem(
leftIconData: Octicons.mail,
text: Text(p.email),
text: Text(p!.email),
onTap: () {
launchUrl('mailto:' + p.email);
launchUrl('mailto:' + p!.email);
},
),
if (isNotNullOrEmpty(p.websiteUrl))
if (isNotNullOrEmpty(p!.websiteUrl))
TableViewItem(
leftIconData: Octicons.link,
text: Text(p.websiteUrl),
text: Text(p!.websiteUrl!),
onTap: () {
var url = p.websiteUrl;
var url = p!.websiteUrl!;
if (!url.startsWith('http')) {
url = 'http://$url';
}
@ -176,8 +178,8 @@ class _User extends StatelessWidget {
),
CommonStyle.verticalGap,
_Repos(
p.pinnedItems.nodes.whereType<GRepoItem>(),
p.repositories.nodes,
p!.pinnedItems.nodes!.whereType<GRepoItem>(),
p!.repositories.nodes,
),
CommonStyle.verticalGap,
],
@ -186,7 +188,7 @@ class _User extends StatelessWidget {
}
class _Org extends StatelessWidget {
final GUserData_repositoryOwner__asOrganization p;
final GUserData_repositoryOwner__asOrganization? p;
_Org(this.p);
@override
@ -195,23 +197,23 @@ class _Org extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
UserHeader(
avatarUrl: p.avatarUrl,
name: p.name,
login: p.login,
createdAt: p.createdAt,
bio: p.description,
avatarUrl: p!.avatarUrl,
name: p!.name,
login: p!.login,
createdAt: p!.createdAt,
bio: p!.description,
),
CommonStyle.border,
Row(children: [
EntryItem(
count: p.pinnableItems.totalCount,
text: AppLocalizations.of(context).repositories,
url: '/github/${p.login}?tab=orgrepo',
count: p!.pinnableItems.totalCount,
text: AppLocalizations.of(context)!.repositories,
url: '/github/${p!.login}?tab=orgrepo',
),
EntryItem(
count: p.membersWithRole.totalCount,
text: AppLocalizations.of(context).members,
url: '/github/${p.login}?tab=people',
count: p!.membersWithRole.totalCount,
text: AppLocalizations.of(context)!.members,
url: '/github/${p!.login}?tab=people',
),
]),
TableView(
@ -219,32 +221,32 @@ class _Org extends StatelessWidget {
items: [
TableViewItem(
leftIconData: Octicons.rss,
text: Text(AppLocalizations.of(context).events),
url: '/github/${p.login}?tab=events',
text: Text(AppLocalizations.of(context)!.events),
url: '/github/${p!.login}?tab=events',
),
if (isNotNullOrEmpty(p.location))
if (isNotNullOrEmpty(p!.location))
TableViewItem(
leftIconData: Octicons.location,
text: Text(p.location),
text: Text(p!.location!),
onTap: () {
launchUrl('https://www.google.com/maps/place/' +
p.location.replaceAll(RegExp(r'\s+'), ''));
p!.location!.replaceAll(RegExp(r'\s+'), ''));
},
),
if (isNotNullOrEmpty(p.email))
if (isNotNullOrEmpty(p!.email))
TableViewItem(
leftIconData: Octicons.mail,
text: Text(p.email),
text: Text(p!.email!),
onTap: () {
launchUrl('mailto:' + p.email);
launchUrl('mailto:' + p!.email!);
},
),
if (isNotNullOrEmpty(p.websiteUrl))
if (isNotNullOrEmpty(p!.websiteUrl))
TableViewItem(
leftIconData: Octicons.link,
text: Text(p.websiteUrl),
text: Text(p!.websiteUrl!),
onTap: () {
var url = p.websiteUrl;
var url = p!.websiteUrl!;
if (!url.startsWith('http')) {
url = 'http://$url';
}
@ -255,8 +257,8 @@ class _Org extends StatelessWidget {
),
CommonStyle.verticalGap,
_Repos(
p.pinnedItems.nodes.whereType<GRepoItem>(),
p.pinnableItems.nodes.whereType<GRepoItem>(),
p!.pinnedItems.nodes!.whereType<GRepoItem>(),
p!.pinnableItems.nodes!.whereType<GRepoItem>(),
),
CommonStyle.verticalGap,
],
@ -268,13 +270,14 @@ class GhViewer extends StatelessWidget {
@override
Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context);
return RefreshStatefulScaffold<GUserParts>(
return RefreshStatefulScaffold<GUserParts?>(
fetch: () async {
final req = GViewerReq();
final res = await auth.gqlClient.request(req).first;
return res.data.viewer;
final OperationResponse<GViewerData, GViewerVars?> res =
await auth.gqlClient!.request(req).first;
return res.data!.viewer;
},
title: AppBarTitle(AppLocalizations.of(context).me),
title: AppBarTitle(AppLocalizations.of(context)!.me),
action: ActionEntry(
iconData: Ionicons.cog,
url: '/settings',
@ -293,21 +296,22 @@ class GhUser extends StatelessWidget {
@override
Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context);
return RefreshStatefulScaffold<GUserData>(
return RefreshStatefulScaffold<GUserData?>(
fetch: () async {
final req = GUserReq((b) => b..vars.login = login);
final res = await auth.gqlClient.request(req).first;
final OperationResponse<GUserData, GUserVars?> res =
await auth.gqlClient!.request(req).first;
return res.data;
},
title: AppBarTitle(login),
actionBuilder: (payload, _) {
return ActionButton(
title: 'User Actions',
items: ActionItem.getUrlActions(payload.repositoryOwner.url),
items: ActionItem.getUrlActions(payload!.repositoryOwner!.url),
);
},
bodyBuilder: (data, setData) {
if (data.repositoryOwner.G__typename == 'User') {
if (data!.repositoryOwner!.G__typename == 'User') {
final p = data.repositoryOwner as GUserData_repositoryOwner__asUser;
return _User(
p,
@ -315,20 +319,19 @@ class GhUser extends StatelessWidget {
if (p.viewerCanFollow)
MutationButton(
active: p.viewerIsFollowing,
text: p.viewerIsFollowing
? AppLocalizations.of(context).unfollow
: AppLocalizations.of(context).follow,
text: p.viewerIsFollowing? AppLocalizations.of(context)!.unfollow
: AppLocalizations.of(context)!.follow,
onTap: () async {
if (p.viewerIsFollowing) {
await auth.ghClient.users.unfollowUser(p.login);
await auth.ghClient!.users.unfollowUser(p.login);
} else {
await auth.ghClient.users.followUser(p.login);
await auth.ghClient!.users.followUser(p.login);
}
setData(data.rebuild((b) {
final u = b.repositoryOwner
as GUserData_repositoryOwner__asUser;
b.repositoryOwner = u.rebuild((b1) {
b1.viewerIsFollowing = !b1.viewerIsFollowing;
b1.viewerIsFollowing = !b1.viewerIsFollowing!;
});
}));
},
@ -337,7 +340,7 @@ class GhUser extends StatelessWidget {
);
} else {
return _Org(data.repositoryOwner
as GUserData_repositoryOwner__asOrganization);
as GUserData_repositoryOwner__asOrganization?);
}
},
);

View File

@ -1,6 +1,8 @@
import 'package:ferry/ferry.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/graphql/github.data.gql.dart';
import 'package:git_touch/graphql/github.req.gql.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/user_item.dart';
@ -13,7 +15,7 @@ class GhFollowers extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GUserItem, String>(
return ListStatefulScaffold<GUserItem, String?>(
title: AppBarTitle('Followers'),
fetch: (cursor) async {
final auth = context.read<AuthModel>();
@ -21,8 +23,9 @@ class GhFollowers extends StatelessWidget {
b.vars.login = login;
b.vars.after = cursor;
});
final res = await auth.gqlClient.request(req).first;
final p = res.data.user.followers;
final OperationResponse<GFollowersData, GFollowersVars?> res =
await auth.gqlClient!.request(req).first;
final p = res.data!.user!.followers;
return ListPayload(
cursor: p.pageInfo.endCursor,
hasMore: p.pageInfo.hasNextPage,
@ -42,7 +45,7 @@ class GhFollowing extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GUserItem, String>(
return ListStatefulScaffold<GUserItem, String?>(
title: AppBarTitle('Following'),
fetch: (cursor) async {
final auth = context.read<AuthModel>();
@ -50,8 +53,9 @@ class GhFollowing extends StatelessWidget {
b.vars.login = login;
b.vars.after = cursor;
});
final res = await auth.gqlClient.request(req).first;
final p = res.data.user.following;
final OperationResponse<GFollowingData, GFollowingVars?> res =
await auth.gqlClient!.request(req).first;
final p = res.data!.user!.following;
return ListPayload(
cursor: p.pageInfo.endCursor,
hasMore: p.pageInfo.hasNextPage,
@ -71,7 +75,7 @@ class GhMembers extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GUserItem, String>(
return ListStatefulScaffold<GUserItem, String?>(
title: AppBarTitle('Members'),
fetch: (cursor) async {
final auth = context.read<AuthModel>();
@ -79,8 +83,9 @@ class GhMembers extends StatelessWidget {
b.vars.login = login;
b.vars.after = cursor;
});
final res = await auth.gqlClient.request(req).first;
final p = res.data.organization.membersWithRole;
final OperationResponse<GMembersData, GMembersVars?> res =
await auth.gqlClient!.request(req).first;
final p = res.data!.organization!.membersWithRole;
return ListPayload(
cursor: p.pageInfo.endCursor,
hasMore: p.pageInfo.hasNextPage,
@ -101,7 +106,7 @@ class GhWachers extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GUserItem, String>(
return ListStatefulScaffold<GUserItem, String?>(
title: AppBarTitle('Wachers'),
fetch: (cursor) async {
final auth = context.read<AuthModel>();
@ -110,8 +115,9 @@ class GhWachers extends StatelessWidget {
b.vars.name = name;
b.vars.after = cursor;
});
final res = await auth.gqlClient.request(req).first;
final p = res.data.repository.watchers;
final OperationResponse<GWatchersData, GWatchersVars?> res =
await auth.gqlClient!.request(req).first;
final p = res.data!.repository!.watchers;
return ListPayload(
cursor: p.pageInfo.endCursor,
hasMore: p.pageInfo.hasNextPage,
@ -132,7 +138,7 @@ class GhStargazers extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GUserItem, String>(
return ListStatefulScaffold<GUserItem, String?>(
title: AppBarTitle('Stargazers'),
fetch: (cursor) async {
final auth = context.read<AuthModel>();
@ -141,8 +147,9 @@ class GhStargazers extends StatelessWidget {
b.vars.name = name;
b.vars.after = cursor;
});
final res = await auth.gqlClient.request(req).first;
final p = res.data.repository.stargazers;
final OperationResponse<GStargazersData, GStargazersVars?> res =
await auth.gqlClient!.request(req).first;
final p = res.data!.repository!.stargazers;
return ListPayload(
cursor: p.pageInfo.endCursor,
hasMore: p.pageInfo.hasNextPage,

View File

@ -11,7 +11,7 @@ import 'package:provider/provider.dart';
class GlBlobScreen extends StatelessWidget {
final int id;
final String ref;
final String path;
final String? path;
GlBlobScreen(this.id, this.ref, {this.path});
@override
@ -21,7 +21,7 @@ class GlBlobScreen extends StatelessWidget {
fetch: () async {
final auth = context.read<AuthModel>();
final res = await auth.fetchGitlab(
'/projects/$id/repository/files/${path.urlencode}?ref=$ref');
'/projects/$id/repository/files/${path!.urlencode}?ref=$ref');
return GitlabBlob.fromJson(res);
},
action: ActionEntry(iconData: Ionicons.cog, url: '/choose-code-theme'),

View File

@ -14,7 +14,7 @@ import 'package:flutter_gen/gen_l10n/S.dart';
// TODO:
class GlCommitScreen extends StatelessWidget {
final String id;
final String sha;
final String? sha;
GlCommitScreen(this.id, {this.sha});
Future<List<GitlabDiff>> _query(BuildContext context) async {
@ -30,7 +30,7 @@ class GlCommitScreen extends StatelessWidget {
final theme = Provider.of<ThemeModel>(context);
return RefreshStatefulScaffold<List<GitlabDiff>>(
title: AppBarTitle(AppLocalizations.of(context).commits),
title: AppBarTitle(AppLocalizations.of(context)!.commits),
fetch: () => _query(context),
bodyBuilder: (items, _) {
return Column(
@ -40,11 +40,11 @@ class GlCommitScreen extends StatelessWidget {
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: HighlightView(
item.diff,
item.diff!,
language: 'diff',
theme: themeMap[theme.brightness == Brightness.dark
? codeProvider.themeDark
: codeProvider.theme],
: codeProvider.theme]!,
padding: CommonStyle.padding,
textStyle: TextStyle(
fontSize: codeProvider.fontSize.toDouble(),

View File

@ -9,14 +9,14 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class GlCommitsScreen extends StatelessWidget {
final String id;
final String prefix;
final String branch;
final String? prefix;
final String? branch;
GlCommitsScreen(this.id, {this.prefix, this.branch});
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GitlabCommit, int>(
title: AppBarTitle(AppLocalizations.of(context).commits),
title: AppBarTitle(AppLocalizations.of(context)!.commits),
fetch: (page) async {
page = page ?? 1;
final auth = context.read<AuthModel>();

View File

@ -12,7 +12,7 @@ class GlExploreScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GitlabProject, int>(
title: AppBarTitle(AppLocalizations.of(context).explore),
title: AppBarTitle(AppLocalizations.of(context)!.explore),
fetch: (page) async {
page = page ?? 1;
final auth = context.read<AuthModel>();
@ -29,7 +29,7 @@ class GlExploreScreen extends StatelessWidget {
itemBuilder: (v) {
return RepositoryItem.gl(
payload: v,
note: 'Updated ${timeago.format(v.lastActivityAt)}',
note: 'Updated ${timeago.format(v.lastActivityAt!)}',
);
},
);

View File

@ -19,7 +19,7 @@ class GlGroupScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<Tuple2<GitlabGroup, int>>(
title: Text(AppLocalizations.of(context).group),
title: Text(AppLocalizations.of(context)!.group),
fetch: () async {
final auth = context.read<AuthModel>();
final res = await Future.wait([
@ -53,10 +53,10 @@ class GlGroupScreen extends StatelessWidget {
CommonStyle.border,
Column(
children: <Widget>[
for (var v in p.projects)
for (var v in p.projects!)
RepositoryItem.gl(
payload: v,
note: 'Updated ${timeago.format(v.lastActivityAt)}',
note: 'Updated ${timeago.format(v.lastActivityAt!)}',
)
],
)

View File

@ -11,7 +11,7 @@ class GlGroupsScreenn extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GitlabGroup, int>(
title: AppBarTitle(AppLocalizations.of(context).groups),
title: AppBarTitle(AppLocalizations.of(context)!.groups),
fetch: (page) async {
page = page ?? 1;
final auth = context.read<AuthModel>();

View File

@ -19,8 +19,8 @@ class GlIssueScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<
Tuple3<GitlabTodoTarget, Iterable<GitlabIssueNote>, List>>(
title: Text(AppLocalizations.of(context).issue + '#$iid'),
Tuple3<GitlabTodoTarget, Iterable<GitlabIssueNote>, List?>>(
title: Text(AppLocalizations.of(context)!.issue + '#$iid'),
fetch: () async {
final type = isMr ? 'merge_requests' : 'issues';
final auth = context.read<AuthModel>();
@ -32,7 +32,7 @@ class GlIssueScreen extends StatelessWidget {
return Tuple3(
GitlabTodoTarget.fromJson(items[0]),
(items[1] as List).map((v) => GitlabIssueNote.fromJson(v)),
items[2] as List,
items[2] as List?,
);
},
bodyBuilder: (data, _) {
@ -46,12 +46,12 @@ class GlIssueScreen extends StatelessWidget {
padding: CommonStyle.padding,
child: CommentItem(
avatar: Avatar(
url: issue.author.avatarUrl,
linkUrl: '/gitlab/user/${issue.author.id}',
url: issue.author!.avatarUrl,
linkUrl: '/gitlab/user/${issue.author!.id}',
),
createdAt: issue.createdAt,
body: issue.description,
login: issue.author.username,
login: issue.author!.username,
prefix: 'gitlab',
),
),
@ -59,13 +59,13 @@ class GlIssueScreen extends StatelessWidget {
Column(
children: <Widget>[
for (var note in notes)
if (note.system)
if (note.system!)
Container(
padding: CommonStyle.padding,
child: Text.rich(
TextSpan(children: [
WidgetSpan(child: Avatar(url: note.author.avatarUrl)),
TextSpan(text: note.author.name),
WidgetSpan(child: Avatar(url: note.author!.avatarUrl)),
TextSpan(text: note.author!.name),
TextSpan(text: note.body),
]),
),
@ -75,12 +75,12 @@ class GlIssueScreen extends StatelessWidget {
padding: CommonStyle.padding,
child: CommentItem(
avatar: Avatar(
url: note.author.avatarUrl,
linkUrl: '/gitlab/user/${note.author.id}',
url: note.author!.avatarUrl,
linkUrl: '/gitlab/user/${note.author!.id}',
),
createdAt: note.createdAt,
body: note.body,
login: note.author.username,
login: note.author!.username,
prefix: 'gitlab',
),
)

View File

@ -12,13 +12,13 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class GlIssuesScreen extends StatelessWidget {
final String id;
final String prefix;
final String? prefix;
GlIssuesScreen(this.id, {this.prefix});
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GitlabIssue, int>(
title: AppBarTitle(AppLocalizations.of(context).issues),
title: AppBarTitle(AppLocalizations.of(context)!.issues),
fetch: (page) async {
page = page ?? 1;
final auth = context.read<AuthModel>();
@ -36,16 +36,16 @@ class GlIssuesScreen extends StatelessWidget {
url: '/gitlab/projects/$id/issues/new',
),
itemBuilder: (p) => IssueItem(
author: p.author.username,
avatarUrl: p.author.avatarUrl,
author: p.author!.username,
avatarUrl: p.author!.avatarUrl,
commentCount: p.userNotesCount,
subtitle: '#' + p.iid.toString(),
title: p.title,
updatedAt: p.updatedAt,
labels: p.labels.isEmpty
labels: p.labels!.isEmpty
? null
: Wrap(spacing: 4, runSpacing: 4, children: [
for (var label in p.labels)
for (var label in p.labels!)
MyLabel(name: label, cssColor: '#428BCA')
]),
url: '/gitlab/projects/${p.projectId}/issues/${p.iid}',

View File

@ -24,7 +24,7 @@ class GlMembersScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GitlabUser, int>(
title: AppBarTitle(AppLocalizations.of(context).members),
title: AppBarTitle(AppLocalizations.of(context)!.members),
fetch: (page) async {
page = page ?? 1;
final auth = context.read<AuthModel>();
@ -43,7 +43,7 @@ class GlMembersScreen extends StatelessWidget {
avatarUrl: v.avatarUrl,
login: v.username,
name: v.name,
bio: Text(accessLevelMap[v.accessLevel] ?? ''),
bio: Text(accessLevelMap[v.accessLevel!] ?? ''),
id: v.id,
);
},

View File

@ -10,13 +10,13 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class GlMergeRequestsScreen extends StatelessWidget {
final String id;
final String prefix;
final String? prefix;
GlMergeRequestsScreen(this.id, {this.prefix});
@override
Widget build(BuildContext context) {
return ListStatefulScaffold<GitlabIssue, int>(
title: AppBarTitle(AppLocalizations.of(context).mergeRequests),
title: AppBarTitle(AppLocalizations.of(context)!.mergeRequests),
fetch: (page) async {
page = page ?? 1;
final res = await context.read<AuthModel>().fetchGitlabWithPage(
@ -30,16 +30,16 @@ class GlMergeRequestsScreen extends StatelessWidget {
},
itemBuilder: (p) => IssueItem(
isPr: true,
author: p.author.username,
avatarUrl: p.author.avatarUrl,
author: p.author!.username,
avatarUrl: p.author!.avatarUrl,
commentCount: p.userNotesCount,
subtitle: '#' + p.iid.toString(),
title: p.title,
updatedAt: p.updatedAt,
labels: p.labels.isEmpty
labels: p.labels!.isEmpty
? null
: Wrap(spacing: 4, runSpacing: 4, children: [
for (var label in p.labels)
for (var label in p.labels!)
MyLabel(name: label, cssColor: '#428BCA')
]),
// url: '/gitlab/projects/${p.projectId}/merge_requests/${p.iid}',

View File

@ -19,15 +19,15 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class GlProjectScreen extends StatelessWidget {
final int id;
final String branch;
final String? branch;
GlProjectScreen(this.id, {this.branch});
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<
Tuple5<GitlabProject, Future<Map<String, double>>, Future<int>,
MarkdownViewData, List<GitlabBranch>>>(
title: AppBarTitle(AppLocalizations.of(context).project),
MarkdownViewData?, List<GitlabBranch>>>(
title: AppBarTitle(AppLocalizations.of(context)!.project),
fetch: () async {
final auth = context.read<AuthModel>();
final p =
@ -44,10 +44,10 @@ class GlProjectScreen extends StatelessWidget {
.fetchGitlabWithPage('/projects/$id/members?per_page=1')
.then((v) => v.total);
MarkdownViewData readmeData;
MarkdownViewData? readmeData;
if (p.readmeUrl != null) {
final md = () => auth.fetchWithGitlabToken(
p.readmeUrl.replaceFirst(r'/blob/', '/raw/'));
p.readmeUrl!.replaceFirst(r'/blob/', '/raw/'));
readmeData = MarkdownViewData(
context,
md: md,
@ -59,7 +59,7 @@ class GlProjectScreen extends StatelessWidget {
body: {
'text': md,
'gfm': true,
'project': '${p.namespace.name}/${p.name}'
'project': '${p.namespace!.name}/${p.name}'
});
return (res['html'] as String).normalizedHtml;
}),
@ -76,7 +76,7 @@ class GlProjectScreen extends StatelessWidget {
},
actionBuilder: (t, _) {
return ActionButton(
title: AppLocalizations.of(context).projectActions,
title: AppLocalizations.of(context)!.projectActions,
items: [
...ActionItem.getUrlActions(t.item1.webUrl),
],
@ -92,17 +92,17 @@ class GlProjectScreen extends StatelessWidget {
final theme = Provider.of<ThemeModel>(context);
final auth = Provider.of<AuthModel>(context);
final prefix =
'${auth.activeAccount.domain}/${p.namespace.path}/${p.name}'
'${auth.activeAccount!.domain}/${p.namespace!.path}/${p.name}'
.urlencode;
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
RepoHeader(
avatarUrl: p.avatarUrl,
avatarLink: p.namespace.kind == 'group'
? '/gitlab/group/${p.namespace.id}'
: '/gitlab/user/${p.namespace.id}',
owner: p.namespace.name,
avatarLink: p.namespace!.kind == 'group'
? '/gitlab/group/${p.namespace!.id}'
: '/gitlab/user/${p.namespace!.id}',
owner: p.namespace!.name,
name: p.name,
description: p.description,
// trailings: <Widget>[
@ -121,19 +121,19 @@ class GlProjectScreen extends StatelessWidget {
builder: (context, snapshot) {
return EntryItem(
count: snapshot.data,
text: AppLocalizations.of(context).members,
text: AppLocalizations.of(context)!.members,
url: '/gitlab/projects/$id/members',
);
},
),
EntryItem(
count: p.starCount,
text: AppLocalizations.of(context).stars,
text: AppLocalizations.of(context)!.stars,
url: '/gitlab/projects/$id/starrers',
),
EntryItem(
count: p.forksCount,
text: AppLocalizations.of(context).forks, // TODO:
text: AppLocalizations.of(context)!.forks, // TODO:
),
],
),
@ -141,13 +141,14 @@ class GlProjectScreen extends StatelessWidget {
FutureBuilder<Map<String, double>>(
future: langFuture,
builder: (context, snapshot) {
if (snapshot.data == null) {
final data = snapshot.data;
if (data == null) {
return LanguageBar([
LanguageBarItem(name: '', ratio: 1),
]);
} else {
return LanguageBar([
for (var e in snapshot.data?.entries ?? [])
for (var e in data.entries)
LanguageBarItem(name: e.key, ratio: e.value / 100)
]);
}
@ -165,47 +166,47 @@ class GlProjectScreen extends StatelessWidget {
if (snapshot.data == null) {
return Text('');
} else {
final langs = snapshot.data.keys;
final langs = snapshot.data!.keys;
return Text(langs.isEmpty
? AppLocalizations.of(context).code
? AppLocalizations.of(context)!.code
: langs.first);
}
},
),
rightWidget: p.statistics == null
? null
: Text(filesize(p.statistics.repositorySize)),
: Text(filesize(p.statistics!.repositorySize)),
url:
'/gitlab/projects/$id/tree/${branch == null ? p.defaultBranch : branch}',
),
if (p.issuesEnabled)
if (p.issuesEnabled!)
TableViewItem(
leftIconData: Octicons.issue_opened,
text: Text(AppLocalizations.of(context).issues),
text: Text(AppLocalizations.of(context)!.issues),
rightWidget: Text(numberFormat.format(p.openIssuesCount)),
url: '/gitlab/projects/$id/issues?prefix=$prefix',
),
if (p.mergeRequestsEnabled)
if (p.mergeRequestsEnabled!)
TableViewItem(
leftIconData: Octicons.git_pull_request,
text: Text(AppLocalizations.of(context).mergeRequests),
text: Text(AppLocalizations.of(context)!.mergeRequests),
url: '/gitlab/projects/$id/merge_requests?prefix=$prefix',
),
TableViewItem(
leftIconData: Octicons.history,
text: Text(AppLocalizations.of(context).commits),
text: Text(AppLocalizations.of(context)!.commits),
rightWidget: p.statistics == null
? null
: Text(p.statistics.commitCount.toString()),
: Text(p.statistics!.commitCount.toString()),
url:
'/gitlab/projects/$id/commits?prefix=$prefix&branch=${branch == null ? p.defaultBranch : branch}', // EDIT
),
if (branches != null)
TableViewItem(
leftIconData: Octicons.git_branch,
text: Text(AppLocalizations.of(context).branches),
text: Text(AppLocalizations.of(context)!.branches),
rightWidget: Text(
(branch == null ? p.defaultBranch : branch) +
(branch == null ? p.defaultBranch : branch)! +
'' +
branches.length.toString()),
onTap: () async {

View File

@ -18,7 +18,7 @@ class GlProjectActivityScreen extends StatelessWidget {
Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
return ListStatefulScaffold<GitlabEvent, int>(
title: AppBarTitle(AppLocalizations.of(context).activity),
title: AppBarTitle(AppLocalizations.of(context)!.activity),
fetch: (page) async {
page = page ?? 1;
final auth = context.read<AuthModel>();
@ -28,13 +28,13 @@ class GlProjectActivityScreen extends StatelessWidget {
return ListPayload(cursor: page, items: events, hasMore: false);
},
itemBuilder: (data) {
return Link(
return LinkWidget(
url: '',
child: Container(
padding: CommonStyle.padding,
child: Row(
children: <Widget>[
Avatar(url: data.author.avatarUrl),
Avatar(url: data.author!.avatarUrl),
SizedBox(width: 12),
Expanded(
child: Column(
@ -43,18 +43,19 @@ class GlProjectActivityScreen extends StatelessWidget {
TextSpan(
children: [
TextSpan(
text: data.author.name,
text: data.author!.name,
style: TextStyle(
color: theme.palette.primary,
fontWeight: FontWeight.w500,
),
),
TextSpan(
text: ' ' + data.actionName + data.targetType),
text:
' ' + data.actionName! + data.targetType!),
],
),
),
Text(data.note.body)
Text(data.note!.body!)
],
),
),

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