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 # Obfuscation related
app.*.map.json app.*.map.json
lib/generated/

View File

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

View File

@ -19,21 +19,21 @@ class MyApp extends StatelessWidget {
// 2. system locale // 2. system locale
try { try {
if (theme.locale != null) { if (theme.locale != null) {
final intlLocale = l.Locale.parse(theme.locale); final intlLocale = l.Locale.parse(theme.locale!);
locales = [ locales = [
Locale.fromSubtags( Locale.fromSubtags(
languageCode: intlLocale.languageCode, languageCode: intlLocale.languageCode,
countryCode: intlLocale.countryCode, countryCode: intlLocale.countryCode,
scriptCode: intlLocale.scriptCode, scriptCode: intlLocale.scriptCode,
), ),
...locales ...locales!
]; ];
} }
} catch (err) { } catch (err) {
print(err); print(err);
} }
for (final locale in locales) { for (final locale in locales!) {
// this is necessary because Flutter only handles zh_Hans -> zh // this is necessary because Flutter only handles zh_Hans -> zh
// and would not handle non-exist language code // and would not handle non-exist language code
if (AppLocalizations.delegate.isSupported(locale)) { 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; factory GGistsVars([Function(GGistsVarsBuilder b) updates]) = _$GGistsVars;
String get login; String get login;
@nullable String? get after;
String get after;
static Serializer<GGistsVars> get serializer => _$gGistsVarsSerializer; static Serializer<GGistsVars> get serializer => _$gGistsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GGistsVars.serializer, this); (_i1.serializers.serializeWith(GGistsVars.serializer, this)
static GGistsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GGistsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GGistsVars.serializer, json); _i1.serializers.deserializeWith(GGistsVars.serializer, json);
} }
@ -30,8 +30,9 @@ abstract class GGistVars implements Built<GGistVars, GGistVarsBuilder> {
String get name; String get name;
static Serializer<GGistVars> get serializer => _$gGistVarsSerializer; static Serializer<GGistVars> get serializer => _$gGistVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GGistVars.serializer, this); (_i1.serializers.serializeWith(GGistVars.serializer, this)
static GGistVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GGistVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GGistVars.serializer, json); _i1.serializers.deserializeWith(GGistVars.serializer, json);
} }
@ -43,13 +44,13 @@ abstract class GFollowersVars
_$GFollowersVars; _$GFollowersVars;
String get login; String get login;
@nullable String? get after;
String get after;
static Serializer<GFollowersVars> get serializer => static Serializer<GFollowersVars> get serializer =>
_$gFollowersVarsSerializer; _$gFollowersVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GFollowersVars.serializer, this); (_i1.serializers.serializeWith(GFollowersVars.serializer, this)
static GFollowersVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GFollowersVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GFollowersVars.serializer, json); _i1.serializers.deserializeWith(GFollowersVars.serializer, json);
} }
@ -61,13 +62,13 @@ abstract class GFollowingVars
_$GFollowingVars; _$GFollowingVars;
String get login; String get login;
@nullable String? get after;
String get after;
static Serializer<GFollowingVars> get serializer => static Serializer<GFollowingVars> get serializer =>
_$gFollowingVarsSerializer; _$gFollowingVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GFollowingVars.serializer, this); (_i1.serializers.serializeWith(GFollowingVars.serializer, this)
static GFollowingVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GFollowingVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GFollowingVars.serializer, json); _i1.serializers.deserializeWith(GFollowingVars.serializer, json);
} }
@ -79,12 +80,12 @@ abstract class GMembersVars
_$GMembersVars; _$GMembersVars;
String get login; String get login;
@nullable String? get after;
String get after;
static Serializer<GMembersVars> get serializer => _$gMembersVarsSerializer; static Serializer<GMembersVars> get serializer => _$gMembersVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GMembersVars.serializer, this); (_i1.serializers.serializeWith(GMembersVars.serializer, this)
static GMembersVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GMembersVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GMembersVars.serializer, json); _i1.serializers.deserializeWith(GMembersVars.serializer, json);
} }
@ -97,12 +98,12 @@ abstract class GWatchersVars
String get owner; String get owner;
String get name; String get name;
@nullable String? get after;
String get after;
static Serializer<GWatchersVars> get serializer => _$gWatchersVarsSerializer; static Serializer<GWatchersVars> get serializer => _$gWatchersVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GWatchersVars.serializer, this); (_i1.serializers.serializeWith(GWatchersVars.serializer, this)
static GWatchersVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GWatchersVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GWatchersVars.serializer, json); _i1.serializers.deserializeWith(GWatchersVars.serializer, json);
} }
@ -115,13 +116,13 @@ abstract class GStargazersVars
String get owner; String get owner;
String get name; String get name;
@nullable String? get after;
String get after;
static Serializer<GStargazersVars> get serializer => static Serializer<GStargazersVars> get serializer =>
_$gStargazersVarsSerializer; _$gStargazersVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GStargazersVars.serializer, this); (_i1.serializers.serializeWith(GStargazersVars.serializer, this)
static GStargazersVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GStargazersVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GStargazersVars.serializer, 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; factory GReposVars([Function(GReposVarsBuilder b) updates]) = _$GReposVars;
String get login; String get login;
@nullable String? get after;
String get after;
static Serializer<GReposVars> get serializer => _$gReposVarsSerializer; static Serializer<GReposVars> get serializer => _$gReposVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReposVars.serializer, this); (_i1.serializers.serializeWith(GReposVars.serializer, this)
static GReposVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GReposVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GReposVars.serializer, 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; factory GStarsVars([Function(GStarsVarsBuilder b) updates]) = _$GStarsVars;
String get login; String get login;
@nullable String? get after;
String get after;
static Serializer<GStarsVars> get serializer => _$gStarsVarsSerializer; static Serializer<GStarsVars> get serializer => _$gStarsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GStarsVars.serializer, this); (_i1.serializers.serializeWith(GStarsVars.serializer, this)
static GStarsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GStarsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GStarsVars.serializer, json); _i1.serializers.deserializeWith(GStarsVars.serializer, json);
} }
@ -162,8 +163,9 @@ abstract class GViewerVars implements Built<GViewerVars, GViewerVarsBuilder> {
static Serializer<GViewerVars> get serializer => _$gViewerVarsSerializer; static Serializer<GViewerVars> get serializer => _$gViewerVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GViewerVars.serializer, this); (_i1.serializers.serializeWith(GViewerVars.serializer, this)
static GViewerVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GViewerVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GViewerVars.serializer, json); _i1.serializers.deserializeWith(GViewerVars.serializer, json);
} }
@ -175,8 +177,9 @@ abstract class GUserVars implements Built<GUserVars, GUserVarsBuilder> {
String get login; String get login;
static Serializer<GUserVars> get serializer => _$gUserVarsSerializer; static Serializer<GUserVars> get serializer => _$gUserVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUserVars.serializer, this); (_i1.serializers.serializeWith(GUserVars.serializer, this)
static GUserVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GUserVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GUserVars.serializer, json); _i1.serializers.deserializeWith(GUserVars.serializer, json);
} }
@ -191,8 +194,9 @@ abstract class GRepoVars implements Built<GRepoVars, GRepoVarsBuilder> {
String get branch; String get branch;
static Serializer<GRepoVars> get serializer => _$gRepoVarsSerializer; static Serializer<GRepoVars> get serializer => _$gRepoVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GRepoVars.serializer, this); (_i1.serializers.serializeWith(GRepoVars.serializer, this)
static GRepoVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GRepoVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GRepoVars.serializer, json); _i1.serializers.deserializeWith(GRepoVars.serializer, json);
} }
@ -207,12 +211,12 @@ abstract class GCommitsVars
String get name; String get name;
String get ref; String get ref;
bool get hasRef; bool get hasRef;
@nullable String? get after;
String get after;
static Serializer<GCommitsVars> get serializer => _$gCommitsVarsSerializer; static Serializer<GCommitsVars> get serializer => _$gCommitsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GCommitsVars.serializer, this); (_i1.serializers.serializeWith(GCommitsVars.serializer, this)
static GCommitsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GCommitsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GCommitsVars.serializer, json); _i1.serializers.deserializeWith(GCommitsVars.serializer, json);
} }
@ -223,12 +227,12 @@ abstract class GIssuesVars implements Built<GIssuesVars, GIssuesVarsBuilder> {
String get owner; String get owner;
String get name; String get name;
@nullable String? get cursor;
String get cursor;
static Serializer<GIssuesVars> get serializer => _$gIssuesVarsSerializer; static Serializer<GIssuesVars> get serializer => _$gIssuesVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GIssuesVars.serializer, this); (_i1.serializers.serializeWith(GIssuesVars.serializer, this)
static GIssuesVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GIssuesVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GIssuesVars.serializer, json); _i1.serializers.deserializeWith(GIssuesVars.serializer, json);
} }
@ -239,12 +243,12 @@ abstract class GPullsVars implements Built<GPullsVars, GPullsVarsBuilder> {
String get owner; String get owner;
String get name; String get name;
@nullable String? get cursor;
String get cursor;
static Serializer<GPullsVars> get serializer => _$gPullsVarsSerializer; static Serializer<GPullsVars> get serializer => _$gPullsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GPullsVars.serializer, this); (_i1.serializers.serializeWith(GPullsVars.serializer, this)
static GPullsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GPullsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GPullsVars.serializer, json); _i1.serializers.deserializeWith(GPullsVars.serializer, json);
} }
@ -256,12 +260,12 @@ abstract class GIssueVars implements Built<GIssueVars, GIssueVarsBuilder> {
String get owner; String get owner;
String get name; String get name;
int get number; int get number;
@nullable String? get cursor;
String get cursor;
static Serializer<GIssueVars> get serializer => _$gIssueVarsSerializer; static Serializer<GIssueVars> get serializer => _$gIssueVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GIssueVars.serializer, this); (_i1.serializers.serializeWith(GIssueVars.serializer, this)
static GIssueVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GIssueVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GIssueVars.serializer, json); _i1.serializers.deserializeWith(GIssueVars.serializer, json);
} }
@ -274,12 +278,12 @@ abstract class GReleasesVars
String get name; String get name;
String get owner; String get owner;
@nullable String? get cursor;
String get cursor;
static Serializer<GReleasesVars> get serializer => _$gReleasesVarsSerializer; static Serializer<GReleasesVars> get serializer => _$gReleasesVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReleasesVars.serializer, this); (_i1.serializers.serializeWith(GReleasesVars.serializer, this)
static GReleasesVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GReleasesVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GReleasesVars.serializer, json); _i1.serializers.deserializeWith(GReleasesVars.serializer, json);
} }
@ -293,8 +297,9 @@ abstract class GPageInfoPartsVars
static Serializer<GPageInfoPartsVars> get serializer => static Serializer<GPageInfoPartsVars> get serializer =>
_$gPageInfoPartsVarsSerializer; _$gPageInfoPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GPageInfoPartsVars.serializer, this); (_i1.serializers.serializeWith(GPageInfoPartsVars.serializer, this)
static GPageInfoPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GPageInfoPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GPageInfoPartsVars.serializer, json); _i1.serializers.deserializeWith(GPageInfoPartsVars.serializer, json);
} }
@ -307,8 +312,9 @@ abstract class GRepoItemVars
static Serializer<GRepoItemVars> get serializer => _$gRepoItemVarsSerializer; static Serializer<GRepoItemVars> get serializer => _$gRepoItemVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GRepoItemVars.serializer, this); (_i1.serializers.serializeWith(GRepoItemVars.serializer, this)
static GRepoItemVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GRepoItemVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GRepoItemVars.serializer, json); _i1.serializers.deserializeWith(GRepoItemVars.serializer, json);
} }
@ -321,8 +327,9 @@ abstract class GUserItemVars
static Serializer<GUserItemVars> get serializer => _$gUserItemVarsSerializer; static Serializer<GUserItemVars> get serializer => _$gUserItemVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUserItemVars.serializer, this); (_i1.serializers.serializeWith(GUserItemVars.serializer, this)
static GUserItemVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GUserItemVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GUserItemVars.serializer, json); _i1.serializers.deserializeWith(GUserItemVars.serializer, json);
} }
@ -336,8 +343,9 @@ abstract class GReposRepoItemVars
static Serializer<GReposRepoItemVars> get serializer => static Serializer<GReposRepoItemVars> get serializer =>
_$gReposRepoItemVarsSerializer; _$gReposRepoItemVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReposRepoItemVars.serializer, this); (_i1.serializers.serializeWith(GReposRepoItemVars.serializer, this)
static GReposRepoItemVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GReposRepoItemVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GReposRepoItemVars.serializer, json); _i1.serializers.deserializeWith(GReposRepoItemVars.serializer, json);
} }
@ -351,8 +359,9 @@ abstract class GUserPartsVars
static Serializer<GUserPartsVars> get serializer => static Serializer<GUserPartsVars> get serializer =>
_$gUserPartsVarsSerializer; _$gUserPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUserPartsVars.serializer, this); (_i1.serializers.serializeWith(GUserPartsVars.serializer, this)
static GUserPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GUserPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GUserPartsVars.serializer, json); _i1.serializers.deserializeWith(GUserPartsVars.serializer, json);
} }
@ -366,8 +375,9 @@ abstract class GRepoCommitVars
static Serializer<GRepoCommitVars> get serializer => static Serializer<GRepoCommitVars> get serializer =>
_$gRepoCommitVarsSerializer; _$gRepoCommitVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GRepoCommitVars.serializer, this); (_i1.serializers.serializeWith(GRepoCommitVars.serializer, this)
static GRepoCommitVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GRepoCommitVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GRepoCommitVars.serializer, json); _i1.serializers.deserializeWith(GRepoCommitVars.serializer, json);
} }
@ -380,8 +390,9 @@ abstract class GRepoRefVars
static Serializer<GRepoRefVars> get serializer => _$gRepoRefVarsSerializer; static Serializer<GRepoRefVars> get serializer => _$gRepoRefVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GRepoRefVars.serializer, this); (_i1.serializers.serializeWith(GRepoRefVars.serializer, this)
static GRepoRefVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GRepoRefVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GRepoRefVars.serializer, json); _i1.serializers.deserializeWith(GRepoRefVars.serializer, json);
} }
@ -393,13 +404,13 @@ abstract class GCommitsRefCommitVars
[Function(GCommitsRefCommitVarsBuilder b) updates]) = [Function(GCommitsRefCommitVarsBuilder b) updates]) =
_$GCommitsRefCommitVars; _$GCommitsRefCommitVars;
@nullable String? get after;
String get after;
static Serializer<GCommitsRefCommitVars> get serializer => static Serializer<GCommitsRefCommitVars> get serializer =>
_$gCommitsRefCommitVarsSerializer; _$gCommitsRefCommitVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GCommitsRefCommitVars.serializer, this); (_i1.serializers.serializeWith(GCommitsRefCommitVars.serializer, this)
static GCommitsRefCommitVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GCommitsRefCommitVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GCommitsRefCommitVars.serializer, json); _i1.serializers.deserializeWith(GCommitsRefCommitVars.serializer, json);
} }
@ -410,13 +421,13 @@ abstract class GCommitsRefVars
factory GCommitsRefVars([Function(GCommitsRefVarsBuilder b) updates]) = factory GCommitsRefVars([Function(GCommitsRefVarsBuilder b) updates]) =
_$GCommitsRefVars; _$GCommitsRefVars;
@nullable String? get after;
String get after;
static Serializer<GCommitsRefVars> get serializer => static Serializer<GCommitsRefVars> get serializer =>
_$gCommitsRefVarsSerializer; _$gCommitsRefVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GCommitsRefVars.serializer, this); (_i1.serializers.serializeWith(GCommitsRefVars.serializer, this)
static GCommitsRefVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GCommitsRefVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GCommitsRefVars.serializer, json); _i1.serializers.deserializeWith(GCommitsRefVars.serializer, json);
} }
@ -430,8 +441,9 @@ abstract class GCommentPartsVars
static Serializer<GCommentPartsVars> get serializer => static Serializer<GCommentPartsVars> get serializer =>
_$gCommentPartsVarsSerializer; _$gCommentPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GCommentPartsVars.serializer, this); (_i1.serializers.serializeWith(GCommentPartsVars.serializer, this)
static GCommentPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GCommentPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GCommentPartsVars.serializer, json); _i1.serializers.deserializeWith(GCommentPartsVars.serializer, json);
} }
@ -447,9 +459,9 @@ abstract class GReactionConnectionPartsVars
static Serializer<GReactionConnectionPartsVars> get serializer => static Serializer<GReactionConnectionPartsVars> get serializer =>
_$gReactionConnectionPartsVarsSerializer; _$gReactionConnectionPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GReactionConnectionPartsVars.serializer, this); GReactionConnectionPartsVars.serializer, this) as Map<String, dynamic>);
static GReactionConnectionPartsVars fromJson(Map<String, dynamic> json) => static GReactionConnectionPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GReactionConnectionPartsVars.serializer, json); .deserializeWith(GReactionConnectionPartsVars.serializer, json);
} }
@ -464,8 +476,9 @@ abstract class GReactablePartsVars
static Serializer<GReactablePartsVars> get serializer => static Serializer<GReactablePartsVars> get serializer =>
_$gReactablePartsVarsSerializer; _$gReactablePartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReactablePartsVars.serializer, this); (_i1.serializers.serializeWith(GReactablePartsVars.serializer, this)
static GReactablePartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GReactablePartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GReactablePartsVars.serializer, json); _i1.serializers.deserializeWith(GReactablePartsVars.serializer, json);
} }
@ -481,8 +494,9 @@ abstract class GReferencedEventPartsVars
static Serializer<GReferencedEventPartsVars> get serializer => static Serializer<GReferencedEventPartsVars> get serializer =>
_$gReferencedEventPartsVarsSerializer; _$gReferencedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReferencedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GReferencedEventPartsVars.serializer, this)
static GReferencedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GReferencedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GReferencedEventPartsVars.serializer, json); .deserializeWith(GReferencedEventPartsVars.serializer, json);
} }
@ -498,9 +512,9 @@ abstract class GRenamedTitleEventPartsVars
static Serializer<GRenamedTitleEventPartsVars> get serializer => static Serializer<GRenamedTitleEventPartsVars> get serializer =>
_$gRenamedTitleEventPartsVarsSerializer; _$gRenamedTitleEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GRenamedTitleEventPartsVars.serializer, this); GRenamedTitleEventPartsVars.serializer, this) as Map<String, dynamic>);
static GRenamedTitleEventPartsVars fromJson(Map<String, dynamic> json) => static GRenamedTitleEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GRenamedTitleEventPartsVars.serializer, json); .deserializeWith(GRenamedTitleEventPartsVars.serializer, json);
} }
@ -516,8 +530,9 @@ abstract class GClosedEventPartsVars
static Serializer<GClosedEventPartsVars> get serializer => static Serializer<GClosedEventPartsVars> get serializer =>
_$gClosedEventPartsVarsSerializer; _$gClosedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GClosedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GClosedEventPartsVars.serializer, this)
static GClosedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GClosedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GClosedEventPartsVars.serializer, json); _i1.serializers.deserializeWith(GClosedEventPartsVars.serializer, json);
} }
@ -532,8 +547,9 @@ abstract class GReopenedEventPartsVars
static Serializer<GReopenedEventPartsVars> get serializer => static Serializer<GReopenedEventPartsVars> get serializer =>
_$gReopenedEventPartsVarsSerializer; _$gReopenedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GReopenedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GReopenedEventPartsVars.serializer, this)
static GReopenedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GReopenedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GReopenedEventPartsVars.serializer, json); _i1.serializers.deserializeWith(GReopenedEventPartsVars.serializer, json);
} }
@ -549,9 +565,9 @@ abstract class GCrossReferencedEventPartsVars
static Serializer<GCrossReferencedEventPartsVars> get serializer => static Serializer<GCrossReferencedEventPartsVars> get serializer =>
_$gCrossReferencedEventPartsVarsSerializer; _$gCrossReferencedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GCrossReferencedEventPartsVars.serializer, this); GCrossReferencedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GCrossReferencedEventPartsVars fromJson(Map<String, dynamic> json) => static GCrossReferencedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GCrossReferencedEventPartsVars.serializer, json); .deserializeWith(GCrossReferencedEventPartsVars.serializer, json);
} }
@ -567,8 +583,9 @@ abstract class GLabeledEventPartsVars
static Serializer<GLabeledEventPartsVars> get serializer => static Serializer<GLabeledEventPartsVars> get serializer =>
_$gLabeledEventPartsVarsSerializer; _$gLabeledEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GLabeledEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GLabeledEventPartsVars.serializer, this)
static GLabeledEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GLabeledEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GLabeledEventPartsVars.serializer, json); _i1.serializers.deserializeWith(GLabeledEventPartsVars.serializer, json);
} }
@ -584,8 +601,9 @@ abstract class GUnlabeledEventPartsVars
static Serializer<GUnlabeledEventPartsVars> get serializer => static Serializer<GUnlabeledEventPartsVars> get serializer =>
_$gUnlabeledEventPartsVarsSerializer; _$gUnlabeledEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUnlabeledEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GUnlabeledEventPartsVars.serializer, this)
static GUnlabeledEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GUnlabeledEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GUnlabeledEventPartsVars.serializer, json); .deserializeWith(GUnlabeledEventPartsVars.serializer, json);
} }
@ -602,8 +620,9 @@ abstract class GMilestonedEventPartsVars
static Serializer<GMilestonedEventPartsVars> get serializer => static Serializer<GMilestonedEventPartsVars> get serializer =>
_$gMilestonedEventPartsVarsSerializer; _$gMilestonedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GMilestonedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GMilestonedEventPartsVars.serializer, this)
static GMilestonedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GMilestonedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GMilestonedEventPartsVars.serializer, json); .deserializeWith(GMilestonedEventPartsVars.serializer, json);
} }
@ -619,9 +638,9 @@ abstract class GDemilestonedEventPartsVars
static Serializer<GDemilestonedEventPartsVars> get serializer => static Serializer<GDemilestonedEventPartsVars> get serializer =>
_$gDemilestonedEventPartsVarsSerializer; _$gDemilestonedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GDemilestonedEventPartsVars.serializer, this); GDemilestonedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GDemilestonedEventPartsVars fromJson(Map<String, dynamic> json) => static GDemilestonedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GDemilestonedEventPartsVars.serializer, json); .deserializeWith(GDemilestonedEventPartsVars.serializer, json);
} }
@ -637,8 +656,9 @@ abstract class GLockedEventPartsVars
static Serializer<GLockedEventPartsVars> get serializer => static Serializer<GLockedEventPartsVars> get serializer =>
_$gLockedEventPartsVarsSerializer; _$gLockedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GLockedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GLockedEventPartsVars.serializer, this)
static GLockedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GLockedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GLockedEventPartsVars.serializer, json); _i1.serializers.deserializeWith(GLockedEventPartsVars.serializer, json);
} }
@ -653,8 +673,9 @@ abstract class GUnlockedEventPartsVars
static Serializer<GUnlockedEventPartsVars> get serializer => static Serializer<GUnlockedEventPartsVars> get serializer =>
_$gUnlockedEventPartsVarsSerializer; _$gUnlockedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUnlockedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GUnlockedEventPartsVars.serializer, this)
static GUnlockedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GUnlockedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GUnlockedEventPartsVars.serializer, json); _i1.serializers.deserializeWith(GUnlockedEventPartsVars.serializer, json);
} }
@ -669,8 +690,9 @@ abstract class GAssignedEventPartsVars
static Serializer<GAssignedEventPartsVars> get serializer => static Serializer<GAssignedEventPartsVars> get serializer =>
_$gAssignedEventPartsVarsSerializer; _$gAssignedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GAssignedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GAssignedEventPartsVars.serializer, this)
static GAssignedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GAssignedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GAssignedEventPartsVars.serializer, json); _i1.serializers.deserializeWith(GAssignedEventPartsVars.serializer, json);
} }
@ -686,8 +708,9 @@ abstract class GUnassignedEventPartsVars
static Serializer<GUnassignedEventPartsVars> get serializer => static Serializer<GUnassignedEventPartsVars> get serializer =>
_$gUnassignedEventPartsVarsSerializer; _$gUnassignedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GUnassignedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GUnassignedEventPartsVars.serializer, this)
static GUnassignedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GUnassignedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GUnassignedEventPartsVars.serializer, json); .deserializeWith(GUnassignedEventPartsVars.serializer, json);
} }
@ -704,8 +727,9 @@ abstract class GSubscribedEventPartsVars
static Serializer<GSubscribedEventPartsVars> get serializer => static Serializer<GSubscribedEventPartsVars> get serializer =>
_$gSubscribedEventPartsVarsSerializer; _$gSubscribedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GSubscribedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GSubscribedEventPartsVars.serializer, this)
static GSubscribedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GSubscribedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GSubscribedEventPartsVars.serializer, json); .deserializeWith(GSubscribedEventPartsVars.serializer, json);
} }
@ -721,9 +745,9 @@ abstract class GUnsubscribedEventPartsVars
static Serializer<GUnsubscribedEventPartsVars> get serializer => static Serializer<GUnsubscribedEventPartsVars> get serializer =>
_$gUnsubscribedEventPartsVarsSerializer; _$gUnsubscribedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GUnsubscribedEventPartsVars.serializer, this); GUnsubscribedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GUnsubscribedEventPartsVars fromJson(Map<String, dynamic> json) => static GUnsubscribedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GUnsubscribedEventPartsVars.serializer, json); .deserializeWith(GUnsubscribedEventPartsVars.serializer, json);
} }
@ -740,8 +764,9 @@ abstract class GMentionedEventPartsVars
static Serializer<GMentionedEventPartsVars> get serializer => static Serializer<GMentionedEventPartsVars> get serializer =>
_$gMentionedEventPartsVarsSerializer; _$gMentionedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GMentionedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GMentionedEventPartsVars.serializer, this)
static GMentionedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GMentionedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GMentionedEventPartsVars.serializer, json); .deserializeWith(GMentionedEventPartsVars.serializer, json);
} }
@ -757,8 +782,9 @@ abstract class GPinnedEventPartsVars
static Serializer<GPinnedEventPartsVars> get serializer => static Serializer<GPinnedEventPartsVars> get serializer =>
_$gPinnedEventPartsVarsSerializer; _$gPinnedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GPinnedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GPinnedEventPartsVars.serializer, this)
static GPinnedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GPinnedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GPinnedEventPartsVars.serializer, json); _i1.serializers.deserializeWith(GPinnedEventPartsVars.serializer, json);
} }
@ -773,9 +799,9 @@ abstract class GTransferredEventPartsVars
static Serializer<GTransferredEventPartsVars> get serializer => static Serializer<GTransferredEventPartsVars> get serializer =>
_$gTransferredEventPartsVarsSerializer; _$gTransferredEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GTransferredEventPartsVars.serializer, this); GTransferredEventPartsVars.serializer, this) as Map<String, dynamic>);
static GTransferredEventPartsVars fromJson(Map<String, dynamic> json) => static GTransferredEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GTransferredEventPartsVars.serializer, json); .deserializeWith(GTransferredEventPartsVars.serializer, json);
} }
@ -791,9 +817,9 @@ abstract class GPullRequestCommitPartsVars
static Serializer<GPullRequestCommitPartsVars> get serializer => static Serializer<GPullRequestCommitPartsVars> get serializer =>
_$gPullRequestCommitPartsVarsSerializer; _$gPullRequestCommitPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GPullRequestCommitPartsVars.serializer, this); GPullRequestCommitPartsVars.serializer, this) as Map<String, dynamic>);
static GPullRequestCommitPartsVars fromJson(Map<String, dynamic> json) => static GPullRequestCommitPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GPullRequestCommitPartsVars.serializer, json); .deserializeWith(GPullRequestCommitPartsVars.serializer, json);
} }
@ -809,8 +835,9 @@ abstract class GDeployedEventPartsVars
static Serializer<GDeployedEventPartsVars> get serializer => static Serializer<GDeployedEventPartsVars> get serializer =>
_$gDeployedEventPartsVarsSerializer; _$gDeployedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GDeployedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GDeployedEventPartsVars.serializer, this)
static GDeployedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GDeployedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GDeployedEventPartsVars.serializer, json); _i1.serializers.deserializeWith(GDeployedEventPartsVars.serializer, json);
} }
@ -826,9 +853,10 @@ abstract class GDeploymentEnvironmentChangedEventPartsVars
static Serializer<GDeploymentEnvironmentChangedEventPartsVars> static Serializer<GDeploymentEnvironmentChangedEventPartsVars>
get serializer => _$gDeploymentEnvironmentChangedEventPartsVarsSerializer; get serializer => _$gDeploymentEnvironmentChangedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers.serializeWith( Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
GDeploymentEnvironmentChangedEventPartsVars.serializer, this); GDeploymentEnvironmentChangedEventPartsVars.serializer, this)
static GDeploymentEnvironmentChangedEventPartsVars fromJson( as Map<String, dynamic>);
static GDeploymentEnvironmentChangedEventPartsVars? fromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_i1.serializers.deserializeWith( _i1.serializers.deserializeWith(
GDeploymentEnvironmentChangedEventPartsVars.serializer, json); GDeploymentEnvironmentChangedEventPartsVars.serializer, json);
@ -846,9 +874,9 @@ abstract class GHeadRefRestoredEventPartsVars
static Serializer<GHeadRefRestoredEventPartsVars> get serializer => static Serializer<GHeadRefRestoredEventPartsVars> get serializer =>
_$gHeadRefRestoredEventPartsVarsSerializer; _$gHeadRefRestoredEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GHeadRefRestoredEventPartsVars.serializer, this); GHeadRefRestoredEventPartsVars.serializer, this) as Map<String, dynamic>);
static GHeadRefRestoredEventPartsVars fromJson(Map<String, dynamic> json) => static GHeadRefRestoredEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GHeadRefRestoredEventPartsVars.serializer, json); .deserializeWith(GHeadRefRestoredEventPartsVars.serializer, json);
} }
@ -865,9 +893,10 @@ abstract class GBaseRefForcePushedEventPartsVars
static Serializer<GBaseRefForcePushedEventPartsVars> get serializer => static Serializer<GBaseRefForcePushedEventPartsVars> get serializer =>
_$gBaseRefForcePushedEventPartsVarsSerializer; _$gBaseRefForcePushedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers
.serializeWith(GBaseRefForcePushedEventPartsVars.serializer, this); .serializeWith(GBaseRefForcePushedEventPartsVars.serializer, this)
static GBaseRefForcePushedEventPartsVars fromJson( as Map<String, dynamic>);
static GBaseRefForcePushedEventPartsVars? fromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GBaseRefForcePushedEventPartsVars.serializer, json); .deserializeWith(GBaseRefForcePushedEventPartsVars.serializer, json);
@ -885,9 +914,10 @@ abstract class GHeadRefForcePushedEventPartsVars
static Serializer<GHeadRefForcePushedEventPartsVars> get serializer => static Serializer<GHeadRefForcePushedEventPartsVars> get serializer =>
_$gHeadRefForcePushedEventPartsVarsSerializer; _$gHeadRefForcePushedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers
.serializeWith(GHeadRefForcePushedEventPartsVars.serializer, this); .serializeWith(GHeadRefForcePushedEventPartsVars.serializer, this)
static GHeadRefForcePushedEventPartsVars fromJson( as Map<String, dynamic>);
static GHeadRefForcePushedEventPartsVars? fromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GHeadRefForcePushedEventPartsVars.serializer, json); .deserializeWith(GHeadRefForcePushedEventPartsVars.serializer, json);
@ -905,9 +935,9 @@ abstract class GReviewRequestedEventPartsVars
static Serializer<GReviewRequestedEventPartsVars> get serializer => static Serializer<GReviewRequestedEventPartsVars> get serializer =>
_$gReviewRequestedEventPartsVarsSerializer; _$gReviewRequestedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GReviewRequestedEventPartsVars.serializer, this); GReviewRequestedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GReviewRequestedEventPartsVars fromJson(Map<String, dynamic> json) => static GReviewRequestedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GReviewRequestedEventPartsVars.serializer, json); .deserializeWith(GReviewRequestedEventPartsVars.serializer, json);
} }
@ -924,9 +954,10 @@ abstract class GReviewRequestRemovedEventPartsVars
static Serializer<GReviewRequestRemovedEventPartsVars> get serializer => static Serializer<GReviewRequestRemovedEventPartsVars> get serializer =>
_$gReviewRequestRemovedEventPartsVarsSerializer; _$gReviewRequestRemovedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers
.serializeWith(GReviewRequestRemovedEventPartsVars.serializer, this); .serializeWith(GReviewRequestRemovedEventPartsVars.serializer, this)
static GReviewRequestRemovedEventPartsVars fromJson( as Map<String, dynamic>);
static GReviewRequestRemovedEventPartsVars? fromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_i1.serializers.deserializeWith( _i1.serializers.deserializeWith(
GReviewRequestRemovedEventPartsVars.serializer, json); GReviewRequestRemovedEventPartsVars.serializer, json);
@ -944,9 +975,9 @@ abstract class GReviewDismissedEventPartsVars
static Serializer<GReviewDismissedEventPartsVars> get serializer => static Serializer<GReviewDismissedEventPartsVars> get serializer =>
_$gReviewDismissedEventPartsVarsSerializer; _$gReviewDismissedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GReviewDismissedEventPartsVars.serializer, this); GReviewDismissedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GReviewDismissedEventPartsVars fromJson(Map<String, dynamic> json) => static GReviewDismissedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GReviewDismissedEventPartsVars.serializer, json); .deserializeWith(GReviewDismissedEventPartsVars.serializer, json);
} }
@ -962,9 +993,9 @@ abstract class GPullRequestReviewPartsVars
static Serializer<GPullRequestReviewPartsVars> get serializer => static Serializer<GPullRequestReviewPartsVars> get serializer =>
_$gPullRequestReviewPartsVarsSerializer; _$gPullRequestReviewPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GPullRequestReviewPartsVars.serializer, this); GPullRequestReviewPartsVars.serializer, this) as Map<String, dynamic>);
static GPullRequestReviewPartsVars fromJson(Map<String, dynamic> json) => static GPullRequestReviewPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GPullRequestReviewPartsVars.serializer, json); .deserializeWith(GPullRequestReviewPartsVars.serializer, json);
} }
@ -980,8 +1011,9 @@ abstract class GMergedEventPartsVars
static Serializer<GMergedEventPartsVars> get serializer => static Serializer<GMergedEventPartsVars> get serializer =>
_$gMergedEventPartsVarsSerializer; _$gMergedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() =>
_i1.serializers.serializeWith(GMergedEventPartsVars.serializer, this); (_i1.serializers.serializeWith(GMergedEventPartsVars.serializer, this)
static GMergedEventPartsVars fromJson(Map<String, dynamic> json) => as Map<String, dynamic>);
static GMergedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers.deserializeWith(GMergedEventPartsVars.serializer, json); _i1.serializers.deserializeWith(GMergedEventPartsVars.serializer, json);
} }
@ -997,9 +1029,9 @@ abstract class GHeadRefDeletedEventPartsVars
static Serializer<GHeadRefDeletedEventPartsVars> get serializer => static Serializer<GHeadRefDeletedEventPartsVars> get serializer =>
_$gHeadRefDeletedEventPartsVarsSerializer; _$gHeadRefDeletedEventPartsVarsSerializer;
Map<String, dynamic> toJson() => _i1.serializers Map<String, dynamic> toJson() => (_i1.serializers.serializeWith(
.serializeWith(GHeadRefDeletedEventPartsVars.serializer, this); GHeadRefDeletedEventPartsVars.serializer, this) as Map<String, dynamic>);
static GHeadRefDeletedEventPartsVars fromJson(Map<String, dynamic> json) => static GHeadRefDeletedEventPartsVars? fromJson(Map<String, dynamic> json) =>
_i1.serializers _i1.serializers
.deserializeWith(GHeadRefDeletedEventPartsVars.serializer, json); .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 Image.asset('images/spinner.webp', width: 32, height: 32);
// return GhRepoScreen('shreyas1599', 'test'); // return GhRepoScreen('shreyas1599', 'test');
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
switch (auth.activeAccount.platform) { switch (auth.activeAccount!.platform) {
case PlatformType.github: case PlatformType.github:
switch (index) { switch (index) {
case 0: case 0:
@ -90,7 +90,7 @@ class _HomeState extends State<Home> {
case 0: case 0:
return GtOrgsScreen(); return GtOrgsScreen();
case 1: case 1:
return GtUserScreen(auth.activeAccount.login, isViewer: true); return GtUserScreen(auth.activeAccount!.login, isViewer: true);
} }
break; break;
case PlatformType.gitee: case PlatformType.gitee:
@ -98,7 +98,7 @@ class _HomeState extends State<Home> {
case 0: case 0:
return GeSearchScreen(); return GeSearchScreen();
case 1: case 1:
return GeUserScreen(auth.activeAccount.login, isViewer: true); return GeUserScreen(auth.activeAccount!.login, isViewer: true);
} }
break; break;
case PlatformType.gogs: case PlatformType.gogs:
@ -106,7 +106,7 @@ class _HomeState extends State<Home> {
case 0: case 0:
return GoSearchScreen(); return GoSearchScreen();
case 1: 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( final search = BottomNavigationBarItem(
icon: Icon(Ionicons.search_outline), icon: Icon(Ionicons.search_outline),
activeIcon: Icon(Ionicons.search), activeIcon: Icon(Ionicons.search),
label: AppLocalizations.of(context).search, label: AppLocalizations.of(context)!.search,
); );
final group = BottomNavigationBarItem( final group = BottomNavigationBarItem(
icon: Icon(Ionicons.people_outline), icon: Icon(Ionicons.people_outline),
activeIcon: Icon(Ionicons.people), activeIcon: Icon(Ionicons.people),
label: AppLocalizations.of(context).organizations, label: AppLocalizations.of(context)!.organizations,
); );
final me = BottomNavigationBarItem( final me = BottomNavigationBarItem(
icon: Icon(Ionicons.person_outline), icon: Icon(Ionicons.person_outline),
activeIcon: Icon(Ionicons.person), activeIcon: Icon(Ionicons.person),
label: AppLocalizations.of(context).me, label: AppLocalizations.of(context)!.me,
); );
final explore = BottomNavigationBarItem( final explore = BottomNavigationBarItem(
icon: Icon(Ionicons.compass_outline), icon: Icon(Ionicons.compass_outline),
activeIcon: Icon(Ionicons.compass), activeIcon: Icon(Ionicons.compass),
label: AppLocalizations.of(context).explore, label: AppLocalizations.of(context)!.explore,
); );
switch (platform) { switch (platform) {
@ -175,18 +175,18 @@ class _HomeState extends State<Home> {
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Ionicons.newspaper_outline), icon: Icon(Ionicons.newspaper_outline),
activeIcon: Icon(Ionicons.newspaper), activeIcon: Icon(Ionicons.newspaper),
label: AppLocalizations.of(context).news, label: AppLocalizations.of(context)!.news,
), ),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: icon:
_buildNotificationIcon(context, Ionicons.notifications_outline), _buildNotificationIcon(context, Ionicons.notifications_outline),
activeIcon: _buildNotificationIcon(context, Ionicons.notifications), activeIcon: _buildNotificationIcon(context, Ionicons.notifications),
label: AppLocalizations.of(context).notification, label: AppLocalizations.of(context)!.notification,
), ),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Ionicons.flame_outline), icon: Icon(Ionicons.flame_outline),
activeIcon: Icon(Ionicons.flame), activeIcon: Icon(Ionicons.flame),
label: AppLocalizations.of(context).trending, label: AppLocalizations.of(context)!.trending,
), ),
search, search,
me, me,
@ -219,15 +219,15 @@ class _HomeState extends State<Home> {
return LoginScreen(); return LoginScreen();
} }
final navigationItems = _buildNavigationItems(auth.activeAccount.platform); final navigationItems = _buildNavigationItems(auth.activeAccount!.platform);
switch (theme.theme) { switch (theme.theme) {
case AppThemeType.cupertino: case AppThemeType.cupertino:
return WillPopScope( return WillPopScope(
onWillPop: () async { onWillPop: () async {
return !await getNavigatorKey(auth.activeTab) return !(await getNavigatorKey(auth.activeTab)
.currentState .currentState
?.maybePop(); ?.maybePop())!;
}, },
child: CupertinoTabScaffold( child: CupertinoTabScaffold(
tabBuilder: (context, index) { tabBuilder: (context, index) {

View File

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

View File

@ -13,14 +13,20 @@ Account _$AccountFromJson(Map<String, dynamic> json) {
token: json['token'] as String, token: json['token'] as String,
login: json['login'] as String, login: json['login'] as String,
avatarUrl: json['avatarUrl'] as String, avatarUrl: json['avatarUrl'] as String,
gitlabId: json['gitlabId'] as int, gitlabId: json['gitlabId'] as int?,
appPassword: json['appPassword'] as String, appPassword: json['appPassword'] as String?,
accountId: json['accountId'] as String, accountId: json['accountId'] as String?,
); );
} }
Map<String, dynamic> _$AccountToJson(Account instance) { 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) { void writeNotNull(String key, dynamic value) {
if (value != null) { 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('gitlabId', instance.gitlabId);
writeNotNull('appPassword', instance.appPassword); writeNotNull('appPassword', instance.appPassword);
writeNotNull('accountId', instance.accountId); writeNotNull('accountId', instance.accountId);

View File

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

View File

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

View File

@ -8,11 +8,11 @@ part of 'bitbucket.dart';
BbPagination _$BbPaginationFromJson(Map<String, dynamic> json) { BbPagination _$BbPaginationFromJson(Map<String, dynamic> json) {
return BbPagination() return BbPagination()
..pagelen = json['pagelen'] as int ..pagelen = json['pagelen'] as int?
..size = json['size'] as int ..size = json['size'] as int?
..page = json['page'] as int ..page = json['page'] as int?
..next = json['next'] as String ..next = json['next'] as String?
..values = json['values'] as List; ..values = json['values'] as List<dynamic>?;
} }
Map<String, dynamic> _$BbPaginationToJson(BbPagination instance) => Map<String, dynamic> _$BbPaginationToJson(BbPagination instance) =>
@ -26,10 +26,10 @@ Map<String, dynamic> _$BbPaginationToJson(BbPagination instance) =>
BbRepoOwner _$BbRepoOwnerFromJson(Map<String, dynamic> json) { BbRepoOwner _$BbRepoOwnerFromJson(Map<String, dynamic> json) {
return BbRepoOwner() return BbRepoOwner()
..nickname = json['nickname'] as String ..nickname = json['nickname'] as String?
..displayName = json['display_name'] as String ..displayName = json['display_name'] as String?
..type = json['type'] as String ..type = json['type'] as String?
..links = json['links'] as Map<String, dynamic>; ..links = json['links'] as Map<String, dynamic>?;
} }
Map<String, dynamic> _$BbRepoOwnerToJson(BbRepoOwner instance) => Map<String, dynamic> _$BbRepoOwnerToJson(BbRepoOwner instance) =>
@ -42,16 +42,16 @@ Map<String, dynamic> _$BbRepoOwnerToJson(BbRepoOwner instance) =>
BbUser _$BbUserFromJson(Map<String, dynamic> json) { BbUser _$BbUserFromJson(Map<String, dynamic> json) {
return BbUser() return BbUser()
..nickname = json['nickname'] as String ..nickname = json['nickname'] as String?
..displayName = json['display_name'] as String ..displayName = json['display_name'] as String?
..type = json['type'] as String ..type = json['type'] as String?
..links = json['links'] as Map<String, dynamic> ..links = json['links'] as Map<String, dynamic>?
..username = json['username'] as String ..username = json['username'] as String?
..isStaff = json['is_staff'] as bool ..isStaff = json['is_staff'] as bool?
..createdOn = json['created_on'] == null ..createdOn = json['created_on'] == null
? null ? null
: DateTime.parse(json['created_on'] as String) : 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>{ 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) { BbRepo _$BbRepoFromJson(Map<String, dynamic> json) {
return BbRepo() return BbRepo()
..name = json['name'] as String ..name = json['name'] as String?
..owner = json['owner'] == null ..owner = json['owner'] == null
? null ? null
: BbRepoOwner.fromJson(json['owner'] as Map<String, dynamic>) : BbRepoOwner.fromJson(json['owner'] as Map<String, dynamic>)
..website = json['website'] as String ..website = json['website'] as String?
..language = json['language'] as String ..language = json['language'] as String?
..size = json['size'] as int ..size = json['size'] as int?
..type = json['type'] as String ..type = json['type'] as String?
..isPrivate = json['is_private'] as bool ..isPrivate = json['is_private'] as bool?
..createdOn = json['created_on'] == null ..createdOn = json['created_on'] == null
? null ? null
: DateTime.parse(json['created_on'] as String) : DateTime.parse(json['created_on'] as String)
..updatedOn = json['updated_on'] == null ..updatedOn = json['updated_on'] == null
? null ? null
: DateTime.parse(json['updated_on'] as String) : DateTime.parse(json['updated_on'] as String)
..description = json['description'] as String ..description = json['description'] as String?
..fullName = json['full_name'] as String ..fullName = json['full_name'] as String?
..slug = json['slug'] as String ..slug = json['slug'] as String?
..mainbranch = json['mainbranch'] == null ..mainbranch = json['mainbranch'] == null
? null ? null
: BbRepoMainbranch.fromJson(json['mainbranch'] as Map<String, dynamic>) : 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>{ 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) { BbRepoMainbranch _$BbRepoMainbranchFromJson(Map<String, dynamic> json) {
return BbRepoMainbranch() return BbRepoMainbranch()
..type = json['type'] as String ..type = json['type'] as String?
..name = json['name'] as String; ..name = json['name'] as String?;
} }
Map<String, dynamic> _$BbRepoMainbranchToJson(BbRepoMainbranch instance) => Map<String, dynamic> _$BbRepoMainbranchToJson(BbRepoMainbranch instance) =>
@ -122,10 +122,10 @@ Map<String, dynamic> _$BbRepoMainbranchToJson(BbRepoMainbranch instance) =>
BbTree _$BbTreeFromJson(Map<String, dynamic> json) { BbTree _$BbTreeFromJson(Map<String, dynamic> json) {
return BbTree() return BbTree()
..type = json['type'] as String ..type = json['type'] as String?
..path = json['path'] as String ..path = json['path'] as String?
..size = json['size'] as int ..size = json['size'] as int?
..links = json['links'] as Map<String, dynamic>; ..links = json['links'] as Map<String, dynamic>?;
} }
Map<String, dynamic> _$BbTreeToJson(BbTree instance) => <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) { BbCommit _$BbCommitFromJson(Map<String, dynamic> json) {
return BbCommit() return BbCommit()
..message = json['message'] as String ..message = json['message'] as String?
..date = ..date =
json['date'] == null ? null : DateTime.parse(json['date'] as String) json['date'] == null ? null : DateTime.parse(json['date'] as String)
..hash = json['hash'] as String ..hash = json['hash'] as String?
..author = json['author'] == null ..author = json['author'] == null
? null ? null
: BbCommitAuthor.fromJson(json['author'] as Map<String, dynamic>); : 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) { BbCommitAuthor _$BbCommitAuthorFromJson(Map<String, dynamic> json) {
return BbCommitAuthor() return BbCommitAuthor()
..raw = json['raw'] as String ..raw = json['raw'] as String?
..user = json['user'] == null ..user = json['user'] == null
? null ? null
: BbRepoOwner.fromJson(json['user'] as Map<String, dynamic>); : BbRepoOwner.fromJson(json['user'] as Map<String, dynamic>);
@ -169,19 +169,19 @@ Map<String, dynamic> _$BbCommitAuthorToJson(BbCommitAuthor instance) =>
BbIssues _$BbIssuesFromJson(Map<String, dynamic> json) { BbIssues _$BbIssuesFromJson(Map<String, dynamic> json) {
return BbIssues() return BbIssues()
..priority = json['priority'] as String ..priority = json['priority'] as String?
..state = json['state'] as String ..state = json['state'] as String?
..repository = json['repository'] == null ..repository = json['repository'] == null
? null ? null
: BbRepo.fromJson(json['repository'] as Map<String, dynamic>) : BbRepo.fromJson(json['repository'] as Map<String, dynamic>)
..title = json['title'] as String ..title = json['title'] as String?
..reporter = json['reporter'] == null ..reporter = json['reporter'] == null
? null ? null
: BbRepoOwner.fromJson(json['reporter'] as Map<String, dynamic>) : BbRepoOwner.fromJson(json['reporter'] as Map<String, dynamic>)
..createdOn = json['created_on'] == null ..createdOn = json['created_on'] == null
? null ? null
: DateTime.parse(json['created_on'] as String) : 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>{ 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) { BbPulls _$BbPullsFromJson(Map<String, dynamic> json) {
return BbPulls() return BbPulls()
..description = json['description'] as String ..description = json['description'] as String?
..author = json['author'] == null ..author = json['author'] == null
? null ? null
: BbRepoOwner.fromJson(json['author'] as Map<String, dynamic>) : BbRepoOwner.fromJson(json['author'] as Map<String, dynamic>)
..title = json['title'] as String ..title = json['title'] as String?
..links = json['links'] as Map<String, dynamic> ..links = json['links'] as Map<String, dynamic>?
..createdOn = json['created_on'] == null ..createdOn = json['created_on'] == null
? null ? null
: DateTime.parse(json['created_on'] as String); : 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) { BbCommentContent _$BbCommentContentFromJson(Map<String, dynamic> json) {
return BbCommentContent() return BbCommentContent()
..raw = json['raw'] as String ..raw = json['raw'] as String?
..markup = json['markup'] as String ..markup = json['markup'] as String?
..html = json['html'] as String; ..html = json['html'] as String?;
} }
Map<String, dynamic> _$BbCommentContentToJson(BbCommentContent instance) => Map<String, dynamic> _$BbCommentContentToJson(BbCommentContent instance) =>
@ -231,8 +231,8 @@ Map<String, dynamic> _$BbCommentContentToJson(BbCommentContent instance) =>
BbComment _$BbCommentFromJson(Map<String, dynamic> json) { BbComment _$BbCommentFromJson(Map<String, dynamic> json) {
return BbComment() return BbComment()
..createdOn = json['created_on'] as String ..createdOn = json['created_on'] as String?
..updatedOn = json['updated_on'] as String ..updatedOn = json['updated_on'] as String?
..content = json['content'] == null ..content = json['content'] == null
? null ? null
: BbCommentContent.fromJson(json['content'] as Map<String, dynamic>) : 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) { BbBranch _$BbBranchFromJson(Map<String, dynamic> json) {
return BbBranch() return BbBranch()
..name = json['name'] as String ..name = json['name'] as String?
..type = json['type'] as String; ..type = json['type'] as String?;
} }
Map<String, dynamic> _$BbBranchToJson(BbBranch instance) => <String, dynamic>{ 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'); Fimber.d('read code: $vh, $vs, $vf');
if (themeMap.keys.contains(vh)) { if (themeMap.keys.contains(vh)) {
_theme = vh; _theme = vh!;
} }
if (themeMap.keys.contains(vdh)) { if (themeMap.keys.contains(vdh)) {
_themeDark = vdh; _themeDark = vdh!;
} }
if (fontSizes.contains(vs)) { if (fontSizes.contains(vs)) {
_fontSize = vs; _fontSize = vs!;
} }
if (fontFamilies.contains(vf)) { if (fontFamilies.contains(vf)) {
_fontFamily = vf; _fontFamily = vf!;
} }
notifyListeners(); notifyListeners();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,27 +11,27 @@ import '../widgets/empty.dart';
class ListPayload<T, K> { class ListPayload<T, K> {
K cursor; K cursor;
Iterable<T> items; Iterable<T>? items;
bool hasMore; bool? hasMore;
ListPayload({ ListPayload({
@required this.items, required this.items,
@required this.cursor, required this.cursor,
@required this.hasMore, required this.hasMore,
}); });
} }
// This is a scaffold for infinite scroll screens // This is a scaffold for infinite scroll screens
class ListStatefulScaffold<T, K> extends StatefulWidget { class ListStatefulScaffold<T, K> extends StatefulWidget {
final Widget title; final Widget title;
final Widget Function() actionBuilder; final Widget Function()? actionBuilder;
final Widget Function(T payload) itemBuilder; final Widget Function(T payload) itemBuilder;
final Future<ListPayload<T, K>> Function(K cursor) fetch; final Future<ListPayload<T, K>> Function(K cursor) fetch;
ListStatefulScaffold({ ListStatefulScaffold({
@required this.title, required this.title,
@required this.itemBuilder, required this.itemBuilder,
@required this.fetch, required this.fetch,
this.actionBuilder, this.actionBuilder,
}); });
@ -41,14 +41,14 @@ class ListStatefulScaffold<T, K> extends StatefulWidget {
} }
class _ListStatefulScaffoldState<T, K> class _ListStatefulScaffoldState<T, K>
extends State<ListStatefulScaffold<T, K>> { extends State<ListStatefulScaffold<T, K?>> {
bool loading = false; bool loading = false;
bool loadingMore = false; bool loadingMore = false;
String error = ''; String error = '';
List<T> items = []; List<T> items = [];
K cursor; K? cursor;
bool hasMore; bool? hasMore;
ScrollController _controller = ScrollController(); ScrollController _controller = ScrollController();
@ -71,7 +71,7 @@ class _ListStatefulScaffoldState<T, K>
!_controller.position.outOfRange && !_controller.position.outOfRange &&
!loading && !loading &&
!loadingMore && !loadingMore &&
hasMore) { hasMore!) {
_loadMore(); _loadMore();
} }
} }
@ -95,8 +95,8 @@ class _ListStatefulScaffoldState<T, K>
} }
}); });
try { try {
final _payload = await widget.fetch(null); final ListPayload<T, K?> _payload = await widget.fetch(null);
items = _payload.items.toList(); items = _payload.items!.toList();
cursor = _payload.cursor; cursor = _payload.cursor;
hasMore = _payload.hasMore; hasMore = _payload.hasMore;
} catch (err) { } catch (err) {
@ -118,8 +118,8 @@ class _ListStatefulScaffoldState<T, K>
loadingMore = true; loadingMore = true;
}); });
try { try {
var _payload = await widget.fetch(cursor); ListPayload<T, K?> _payload = await widget.fetch(cursor);
items.addAll(_payload.items); items.addAll(_payload.items!);
cursor = _payload.cursor; cursor = _payload.cursor;
hasMore = _payload.hasMore; hasMore = _payload.hasMore;
} catch (err) { } catch (err) {
@ -137,7 +137,7 @@ class _ListStatefulScaffoldState<T, K>
Widget _buildItem(BuildContext context, int index) { Widget _buildItem(BuildContext context, int index) {
if (index == 2 * items.length) { if (index == 2 * items.length) {
if (hasMore) { if (hasMore!) {
return Loading(more: true); return Loading(more: true);
} else { } else {
return Container(); return Container();
@ -213,7 +213,7 @@ class _ListStatefulScaffoldState<T, K>
return CommonScaffold( return CommonScaffold(
title: widget.title, title: widget.title,
body: _buildBody(), 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'; import '../widgets/error_reload.dart';
class LongListPayload<T, K> { class LongListPayload<T, K> {
T header; T? header;
int totalCount; int? totalCount;
String cursor; String? cursor;
List<K> leadingItems; List<K>? leadingItems;
List<K> trailingItems; List<K>? trailingItems;
LongListPayload({ LongListPayload({
this.header, this.header,
@ -30,19 +30,19 @@ class LongListPayload<T, K> {
// e.g. https://github.com/reactjs/rfcs/pull/68 // e.g. https://github.com/reactjs/rfcs/pull/68
class LongListStatefulScaffold<T, K> extends StatefulWidget { class LongListStatefulScaffold<T, K> extends StatefulWidget {
final Widget title; final Widget title;
final Widget Function(T t) trailingBuilder; final Widget Function(T t)? trailingBuilder;
final Widget Function(T t) headerBuilder; final Widget Function(T t) headerBuilder;
final Widget Function(K k) itemBuilder; final Widget Function(K k) itemBuilder;
final Future<LongListPayload<T, K>> Function() onRefresh; 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({ LongListStatefulScaffold({
@required this.title, required this.title,
this.trailingBuilder, this.trailingBuilder,
@required this.headerBuilder, required this.headerBuilder,
@required this.itemBuilder, required this.itemBuilder,
@required this.onRefresh, required this.onRefresh,
@required this.onLoadMore, required this.onLoadMore,
}); });
@override @override
@ -51,12 +51,12 @@ class LongListStatefulScaffold<T, K> extends StatefulWidget {
} }
class _LongListStatefulScaffoldState<T, K> class _LongListStatefulScaffoldState<T, K>
extends State<LongListStatefulScaffold<T, K>> { extends State<LongListStatefulScaffold<T?, K>> {
bool loading; late bool loading;
bool loadingMore = false; bool loadingMore = false;
String error = ''; String error = '';
LongListPayload<T, K> payload; LongListPayload<T?, K>? payload;
@override @override
void initState() { void initState() {
@ -90,10 +90,11 @@ class _LongListStatefulScaffoldState<T, K>
loadingMore = true; loadingMore = true;
}); });
try { try {
var _payload = await widget.onLoadMore(payload.cursor); LongListPayload<T?, K> _payload =
payload.totalCount = _payload.totalCount; await widget.onLoadMore(payload!.cursor);
payload.cursor = _payload.cursor; payload!.totalCount = _payload.totalCount;
payload.leadingItems.addAll(_payload.leadingItems); payload!.cursor = _payload.cursor;
payload!.leadingItems!.addAll(_payload.leadingItems!);
} finally { } finally {
if (mounted) { if (mounted) {
setState(() { setState(() {
@ -112,16 +113,16 @@ class _LongListStatefulScaffoldState<T, K>
int realIndex = index ~/ 2; int realIndex = index ~/ 2;
if (realIndex < payload.leadingItems.length) { if (realIndex < payload!.leadingItems!.length) {
return widget.itemBuilder(payload.leadingItems[realIndex]); return widget.itemBuilder(payload!.leadingItems![realIndex]);
} else if (realIndex == payload.leadingItems.length) { } else if (realIndex == payload!.leadingItems!.length) {
var count = payload.totalCount - var count = payload!.totalCount! -
payload.leadingItems.length + payload!.leadingItems!.length +
payload.trailingItems.length; payload!.trailingItems!.length;
return Container( return Container(
padding: CommonStyle.padding, padding: CommonStyle.padding,
child: Center( child: Center(
child: Link( child: LinkWidget(
onTap: _loadMore, onTap: _loadMore,
child: Container( child: Container(
padding: CommonStyle.padding, padding: CommonStyle.padding,
@ -148,14 +149,14 @@ class _LongListStatefulScaffoldState<T, K>
), ),
); );
} else { } else {
return widget.itemBuilder( return widget.itemBuilder(payload!
payload.trailingItems[realIndex - payload.leadingItems.length - 1]); .trailingItems![realIndex - payload!.leadingItems!.length - 1]);
} }
} }
int get _itemCount { int get _itemCount {
int count = payload.leadingItems.length + payload.trailingItems.length; int count = payload!.leadingItems!.length + payload!.trailingItems!.length;
if (payload.totalCount > count) { if (payload!.totalCount! > count) {
count++; count++;
} }
return 2 * count; // including bottom border return 2 * count; // including bottom border
@ -185,7 +186,7 @@ class _LongListStatefulScaffoldState<T, K>
]; ];
if (payload != null) { if (payload != null) {
slivers.add( slivers.add(
SliverToBoxAdapter(child: widget.headerBuilder(payload.header)), SliverToBoxAdapter(child: widget.headerBuilder(payload!.header)),
); );
} }
slivers.add(_buildSliver()); slivers.add(_buildSliver());
@ -193,8 +194,9 @@ class _LongListStatefulScaffoldState<T, K>
return CupertinoPageScaffold( return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar( navigationBar: CupertinoNavigationBar(
middle: widget.title, middle: widget.title,
trailing: trailing: payload == null
payload == null ? null : widget.trailingBuilder(payload.header), ? null
: widget.trailingBuilder!(payload!.header),
), ),
child: SafeArea( child: SafeArea(
child: CupertinoScrollbar( child: CupertinoScrollbar(
@ -208,7 +210,7 @@ class _LongListStatefulScaffoldState<T, K>
title: widget.title, title: widget.title,
actions: payload == null actions: payload == null
? null ? null
: [widget.trailingBuilder(payload.header)], : [widget.trailingBuilder!(payload!.header)],
), ),
body: RefreshIndicator( body: RefreshIndicator(
onRefresh: _refresh, onRefresh: _refresh,
@ -216,7 +218,7 @@ class _LongListStatefulScaffoldState<T, K>
child: CustomScrollView(slivers: [ child: CustomScrollView(slivers: [
if (payload != null) if (payload != null)
SliverToBoxAdapter( SliverToBoxAdapter(
child: widget.headerBuilder(payload.header)), child: widget.headerBuilder(payload!.header)),
_buildSliver(), _buildSliver(),
]), ]),
), ),

View File

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

View File

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

View File

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

View File

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

View File

@ -10,8 +10,8 @@ class RefreshWrapper extends StatelessWidget {
final void Function() onRefresh; final void Function() onRefresh;
RefreshWrapper({ RefreshWrapper({
@required this.onRefresh, required this.onRefresh,
@required this.body, required this.body,
}); });
@override @override
@ -21,14 +21,15 @@ class RefreshWrapper extends StatelessWidget {
return CupertinoScrollbar( return CupertinoScrollbar(
child: CustomScrollView( child: CustomScrollView(
slivers: <Widget>[ slivers: <Widget>[
CupertinoSliverRefreshControl(onRefresh: onRefresh), CupertinoSliverRefreshControl(
onRefresh: onRefresh as Future<void> Function()?),
SliverToBoxAdapter(child: body), SliverToBoxAdapter(child: body),
], ],
), ),
); );
default: default:
return RefreshIndicator( return RefreshIndicator(
onRefresh: onRefresh, onRefresh: onRefresh as Future<void> Function(),
child: Scrollbar( child: Scrollbar(
child: SingleChildScrollView(child: body), child: SingleChildScrollView(child: body),
), ),
@ -41,13 +42,13 @@ class ErrorLoadingWrapper extends StatelessWidget {
final String error; final String error;
final bool loading; final bool loading;
final void Function() reload; final void Function() reload;
final Widget Function() bodyBuilder; final Widget? Function() bodyBuilder;
ErrorLoadingWrapper({ ErrorLoadingWrapper({
@required this.error, required this.error,
@required this.loading, required this.loading,
@required this.reload, required this.reload,
@required this.bodyBuilder, required this.bodyBuilder,
}); });
@override @override
@ -60,11 +61,6 @@ class ErrorLoadingWrapper extends StatelessWidget {
return Loading(); 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
return ListStatefulScaffold<BbCommit, String>( return ListStatefulScaffold<BbCommit, String?>(
title: AppBarTitle(AppLocalizations.of(context).commits), title: AppBarTitle(AppLocalizations.of(context)!.commits),
fetch: (nextUrl) async { fetch: (nextUrl) async {
final res = await context.read<AuthModel>().fetchBbWithPage( final res = await context.read<AuthModel>().fetchBbWithPage(
nextUrl ?? '/repositories/$owner/$name/commits/$ref'); nextUrl ?? '/repositories/$owner/$name/commits/$ref');
@ -25,16 +25,16 @@ class BbCommitsScreen extends StatelessWidget {
cursor: res.cursor, cursor: res.cursor,
hasMore: res.hasMore, hasMore: res.hasMore,
items: <BbCommit>[ items: <BbCommit>[
for (var v in res.data) BbCommit.fromJson(v), for (var v in res.data!) BbCommit.fromJson(v),
], ],
); );
}, },
itemBuilder: (v) { itemBuilder: (v) {
return CommitItem( return CommitItem(
url: '${auth.activeAccount.domain}/$owner/$name/commits/${v.hash}', url: '${auth.activeAccount!.domain}/$owner/$name/commits/${v.hash}',
avatarUrl: v.author.user?.avatarUrl, avatarUrl: v.author!.user?.avatarUrl,
avatarLink: null, avatarLink: null,
author: v.author.raw.replaceFirst(RegExp(r' <.*>'), ''), author: v.author!.raw!.replaceFirst(RegExp(r' <.*>'), ''),
createdAt: v.date, createdAt: v.date,
message: v.message, message: v.message,
); );

View File

@ -10,8 +10,8 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class BbExploreScreen extends StatelessWidget { class BbExploreScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<BbRepo, String>( return ListStatefulScaffold<BbRepo, String?>(
title: AppBarTitle(AppLocalizations.of(context).explore), title: AppBarTitle(AppLocalizations.of(context)!.explore),
fetch: (nextUrl) async { fetch: (nextUrl) async {
final res = await context.read<AuthModel>().fetchBbWithPage( final res = await context.read<AuthModel>().fetchBbWithPage(
nextUrl ?? '/repositories?role=member&sort=-updated_on'); nextUrl ?? '/repositories?role=member&sort=-updated_on');
@ -19,7 +19,7 @@ class BbExploreScreen extends StatelessWidget {
cursor: res.cursor, cursor: res.cursor,
hasMore: res.hasMore, hasMore: res.hasMore,
items: <BbRepo>[ 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( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Link( LinkWidget(
url: '/bitbucket/$owner/$name', url: '/bitbucket/$owner/$name',
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Avatar( Avatar(
url: issue.reporter.avatarUrl, url: issue.reporter!.avatarUrl,
size: AvatarSize.extraSmall, size: AvatarSize.extraSmall,
), ),
SizedBox(width: 4), SizedBox(width: 4),
@ -77,7 +77,7 @@ class BbIssueScreen extends StatelessWidget {
), ),
SizedBox(height: 8), SizedBox(height: 8),
Text( Text(
issue.title, issue.title!,
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -95,12 +95,12 @@ class BbIssueScreen extends StatelessWidget {
padding: EdgeInsets.only(left: 10), padding: EdgeInsets.only(left: 10),
child: CommentItem( child: CommentItem(
avatar: Avatar( avatar: Avatar(
url: comment.user.avatarUrl, url: comment.user!.avatarUrl,
linkUrl: '/bitbucket/${comment.user.displayName}', linkUrl: '/bitbucket/${comment.user!.displayName}',
), ),
createdAt: DateTime.parse(comment.createdOn), createdAt: DateTime.parse(comment.createdOn!),
body: comment.content.raw, body: comment.content!.raw,
login: comment.user.displayName, login: comment.user!.displayName,
prefix: 'bitbucket')), prefix: 'bitbucket')),
CommonStyle.border, CommonStyle.border,
SizedBox(height: 16), SizedBox(height: 16),

View File

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

View File

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

View File

@ -15,8 +15,8 @@ class BbPullsScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
return ListStatefulScaffold<BbPulls, String>( return ListStatefulScaffold<BbPulls, String?>(
title: AppBarTitle(AppLocalizations.of(context).pullRequests), title: AppBarTitle(AppLocalizations.of(context)!.pullRequests),
fetch: (nextUrl) async { fetch: (nextUrl) async {
final res = await context.read<AuthModel>().fetchBbWithPage( final res = await context.read<AuthModel>().fetchBbWithPage(
nextUrl ?? '/repositories/$owner/$name/pullrequests'); nextUrl ?? '/repositories/$owner/$name/pullrequests');
@ -24,22 +24,22 @@ class BbPullsScreen extends StatelessWidget {
cursor: res.cursor, cursor: res.cursor,
hasMore: res.hasMore, hasMore: res.hasMore,
items: <BbPulls>[ items: <BbPulls>[
for (var v in res.data) BbPulls.fromJson(v), for (var v in res.data!) BbPulls.fromJson(v),
], ],
); );
}, },
itemBuilder: (v) { itemBuilder: (v) {
int pullNumber = int pullNumber =
int.parse(v.pullRequestLink.replaceFirst(RegExp(r'.*\/'), '')); int.parse(v.pullRequestLink!.replaceFirst(RegExp(r'.*\/'), ''));
return IssueItem( return IssueItem(
avatarUrl: v.author.avatarUrl, avatarUrl: v.author!.avatarUrl,
author: v.author.displayName, author: v.author!.displayName,
title: v.title, title: v.title,
subtitle: '#' + pullNumber.toString(), subtitle: '#' + pullNumber.toString(),
commentCount: 0, commentCount: 0,
updatedAt: v.createdOn, updatedAt: v.createdOn,
url: 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 { class BbRepoScreen extends StatelessWidget {
final String owner; final String owner;
final String name; final String name;
final String branch; final String? branch;
BbRepoScreen(this.owner, this.name, {this.branch}); BbRepoScreen(this.owner, this.name, {this.branch});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RefreshStatefulScaffold<Tuple3<BbRepo, String, List<BbBranch>>>( return RefreshStatefulScaffold<Tuple3<BbRepo, String?, List<BbBranch>>>(
title: AppBarTitle(AppLocalizations.of(context).repository), title: AppBarTitle(AppLocalizations.of(context)!.repository),
fetch: () async { fetch: () async {
final auth = context.read<AuthModel>(); final auth = context.read<AuthModel>();
final r = await auth.fetchBbJson('/repositories/$owner/$name'); final r = await auth.fetchBbJson('/repositories/$owner/$name');
final repo = BbRepo.fromJson(r); final repo = BbRepo.fromJson(r);
final res = await auth.fetchBb( 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 = final readme =
res.statusCode >= 400 ? null : utf8.decode(res.bodyBytes); res.statusCode >= 400 ? null : utf8.decode(res.bodyBytes);
final branches = await auth final branches = await auth
.fetchBbWithPage('/repositories/$owner/$name/refs/branches') .fetchBbWithPage('/repositories/$owner/$name/refs/branches')
.then((v) { .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); return Tuple3(repo, readme, branches);
}, },
@ -64,7 +64,7 @@ class BbRepoScreen extends StatelessWidget {
text: Text('Code'), text: Text('Code'),
rightWidget: Text(filesize(p.size)), rightWidget: Text(filesize(p.size)),
url: url:
'/bitbucket/$owner/$name/src/${branch == null ? p.mainbranch.name : branch}', '/bitbucket/$owner/$name/src/${branch == null ? p.mainbranch!.name : branch}',
), ),
TableViewItem( TableViewItem(
leftIconData: Octicons.issue_opened, leftIconData: Octicons.issue_opened,
@ -80,14 +80,14 @@ class BbRepoScreen extends StatelessWidget {
leftIconData: Octicons.history, leftIconData: Octicons.history,
text: Text('Commits'), text: Text('Commits'),
url: url:
'/bitbucket/$owner/$name/commits/${branch == null ? p.mainbranch.name : branch}', '/bitbucket/$owner/$name/commits/${branch == null ? p.mainbranch!.name : branch}',
), ),
if (branches != null) if (branches != null)
TableViewItem( TableViewItem(
leftIconData: Octicons.git_branch, leftIconData: Octicons.git_branch,
text: Text(AppLocalizations.of(context).branches), text: Text(AppLocalizations.of(context)!.branches),
rightWidget: Text( rightWidget: Text(
(branch == null ? p.mainbranch.name : branch) + (branch == null ? p.mainbranch!.name : branch)! +
'' + '' +
branches.length.toString()), branches.length.toString()),
onTap: () async { onTap: () async {

View File

@ -11,8 +11,8 @@ import 'package:flutter_gen/gen_l10n/S.dart';
class BbTeamsScreen extends StatelessWidget { class BbTeamsScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<BbUser, String>( return ListStatefulScaffold<BbUser, String?>(
title: AppBarTitle(AppLocalizations.of(context).teams), title: AppBarTitle(AppLocalizations.of(context)!.teams),
fetch: (nextUrl) async { fetch: (nextUrl) async {
final res = await context final res = await context
.read<AuthModel>() .read<AuthModel>()
@ -21,7 +21,7 @@ class BbTeamsScreen extends StatelessWidget {
cursor: res.cursor, cursor: res.cursor,
hasMore: res.hasMore, hasMore: res.hasMore,
items: <BbUser>[ 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, login: v.username,
name: v.nickname, name: v.nickname,
avatarUrl: v.avatarUrl, 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'; import 'package:git_touch/utils/utils.dart';
class BbUserScreen extends StatelessWidget { class BbUserScreen extends StatelessWidget {
final String login; final String? login;
final bool isTeam; final bool isTeam;
BbUserScreen(this.login, {this.isTeam = false}); BbUserScreen(this.login, {this.isTeam = false});
bool get isViewer => login == null; bool get isViewer => login == null;
@ -19,8 +19,8 @@ class BbUserScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
final _accountId = auth.activeAccount.accountId; final _accountId = auth.activeAccount!.accountId;
final _login = login ?? auth.activeAccount.login; final _login = login ?? auth.activeAccount!.login;
return RefreshStatefulScaffold<Tuple2<BbUser, Iterable<BbRepo>>>( return RefreshStatefulScaffold<Tuple2<BbUser, Iterable<BbRepo>>>(
title: Text(isViewer title: Text(isViewer
? 'Me' ? 'Me'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@ class GeTreeScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RefreshStatefulScaffold<List<GiteeTreeItem>>( return RefreshStatefulScaffold<List<GiteeTreeItem>>(
title: AppBarTitle(AppLocalizations.of(context).files), title: AppBarTitle(AppLocalizations.of(context)!.files),
fetch: () async { fetch: () async {
final res = await context final res = await context
.read<AuthModel>() .read<AuthModel>()
@ -41,9 +41,9 @@ class GeTreeScreen extends StatelessWidget {
url: (() { url: (() {
switch (item.type) { switch (item.type) {
case 'tree': 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': 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: default:
return null; return null;
} }

View File

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

View File

@ -44,7 +44,7 @@ class GeUsersScreen extends StatelessWidget {
login: p.login, login: p.login,
name: p.name, name: p.name,
avatarUrl: p.avatarUrl, 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:flutter/material.dart';
import 'package:git_touch/graphql/github.data.gql.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.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/graphql/schema.schema.gql.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/scaffolds/list_stateful.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 { class GhCommits extends StatelessWidget {
final String owner; final String owner;
final String name; final String name;
final String branch; final String? branch;
GhCommits(this.owner, this.name, {this.branch}); GhCommits(this.owner, this.name, {this.branch});
Widget _buildStatus(GStatusState state) { Widget _buildStatus(GStatusState? state) {
const size = 18.0; const size = 18.0;
switch (state) { switch (state) {
case GStatusState.SUCCESS: case GStatusState.SUCCESS:
@ -30,8 +32,8 @@ class GhCommits extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<GCommitsRefCommit_history_nodes, String>( return ListStatefulScaffold<GCommitsRefCommit_history_nodes, String?>(
title: AppBarTitle(AppLocalizations.of(context).commits), title: AppBarTitle(AppLocalizations.of(context)!.commits),
fetch: (cursor) async { fetch: (cursor) async {
final req = GCommitsReq((b) { final req = GCommitsReq((b) {
b.vars.owner = owner; b.vars.owner = owner;
@ -40,10 +42,10 @@ class GhCommits extends StatelessWidget {
b.vars.ref = branch ?? ''; b.vars.ref = branch ?? '';
b.vars.after = cursor; b.vars.after = cursor;
}); });
final res = final OperationResponse<GCommitsData, GCommitsVars?> res =
await context.read<AuthModel>().gqlClient.request(req).first; await context.read<AuthModel>().gqlClient!.request(req).first;
final ref = final ref = res.data!.repository!.defaultBranchRef ??
res.data.repository.defaultBranchRef ?? res.data.repository.ref; res.data!.repository!.ref!;
final history = (ref.target as GCommitsRefCommit).history; final history = (ref.target as GCommitsRefCommit).history;
return ListPayload( return ListPayload(
cursor: history.pageInfo.endCursor, cursor: history.pageInfo.endCursor,
@ -58,13 +60,13 @@ class GhCommits extends StatelessWidget {
avatarUrl: p.author?.avatarUrl, avatarUrl: p.author?.avatarUrl,
avatarLink: login == null ? null : '/github/$login', avatarLink: login == null ? null : '/github/$login',
message: p.messageHeadline, message: p.messageHeadline,
author: login ?? p.author.name, author: login ?? p.author!.name,
createdAt: p.committedDate, createdAt: p.committedDate,
widgets: p.status == null widgets: p.status == null
? null ? null
: [ : [
SizedBox(width: 4), 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) { Widget build(BuildContext context) {
return RefreshStatefulScaffold( return RefreshStatefulScaffold(
title: AppBarTitle(AppLocalizations.of(context).files), title: AppBarTitle(AppLocalizations.of(context)!.files),
fetch: () async { fetch: () async {
final res = await context.read<AuthModel>().ghClient.getJSON( final res = await context.read<AuthModel>().ghClient!.getJSON(
'/repos/$owner/$name/compare/$before...$head', '/repos/$owner/$name/compare/$before...$head',
convert: (vs) => GithubComparisonItem.fromJson(vs)); convert: (dynamic vs) => GithubComparisonItem.fromJson(vs));
return res.files; return res.files;
}, },
actionBuilder: (v, _) { actionBuilder: (dynamic v, _) {
return ActionButton( return ActionButton(
title: AppLocalizations.of(context).actions, title: AppLocalizations.of(context)!.actions,
items: [ items: [
...ActionItem.getUrlActions( ...ActionItem.getUrlActions(
'https://github.com/$owner/$name/compare/$before...$head'), 'https://github.com/$owner/$name/compare/$before...$head'),
], ],
); );
}, },
bodyBuilder: (v, _) { bodyBuilder: (dynamic v, _) {
return Wrap( return Wrap(
children: v children: v
.map<Widget>((vs) => FilesItem( .map<Widget>((vs) => FilesItem(

View File

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

View File

@ -16,13 +16,13 @@ class GhEventsScreen extends StatelessWidget {
@override @override
Widget build(context) { Widget build(context) {
return ListStatefulScaffold<GithubEvent, int>( return ListStatefulScaffold<GithubEvent, int>(
title: AppBarTitle(AppLocalizations.of(context).events), title: AppBarTitle(AppLocalizations.of(context)!.events),
itemBuilder: (payload) => EventItem(payload), itemBuilder: (payload) => EventItem(payload),
fetch: (page) async { fetch: (page) async {
page = page ?? 1; 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', '/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( return ListPayload(
cursor: page + 1, cursor: page + 1,
hasMore: events.length == pageSize, hasMore: events.length == pageSize,

View File

@ -17,7 +17,7 @@ class GhFilesScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<GithubFilesItem, int>( return ListStatefulScaffold<GithubFilesItem, int>(
title: AppBarTitle(AppLocalizations.of(context).files), title: AppBarTitle(AppLocalizations.of(context)!.files),
actionBuilder: () { actionBuilder: () {
return ActionButton( return ActionButton(
title: 'Actions', title: 'Actions',
@ -31,7 +31,7 @@ class GhFilesScreen extends StatelessWidget {
page = page ?? 1; page = page ?? 1;
final res = await context final res = await context
.read<AuthModel>() .read<AuthModel>()
.ghClient .ghClient!
.getJSON<List, List<GithubFilesItem>>( .getJSON<List, List<GithubFilesItem>>(
'/repos/$owner/$name/pulls/$pullNumber/files?page=$page', '/repos/$owner/$name/pulls/$pullNumber/files?page=$page',
convert: (vs) => [for (var v in vs) GithubFilesItem.fromJson(v)], 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 login;
final String id; final String id;
final String file; final String file;
final String raw; final String? raw;
final String content; final String? content;
GistObjectScreen(this.login, this.id, this.file, {this.raw, this.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/material.dart';
import 'package:flutter/cupertino.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/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart'; import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/gists_item.dart'; import 'package:git_touch/widgets/gists_item.dart';
@ -15,15 +17,15 @@ class GhGistsScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<GGistsData_user_gists_nodes, String>( return ListStatefulScaffold<GGistsData_user_gists_nodes, String?>(
title: AppBarTitle(AppLocalizations.of(context).gists), title: AppBarTitle(AppLocalizations.of(context)!.gists),
fetch: (page) async { fetch: (page) async {
final req = GGistsReq((b) => b final req = GGistsReq((b) => b
..vars.login = login ..vars.login = login
..vars.after = page); ..vars.after = page);
final res = final OperationResponse<GGistsData, GGistsVars?> res =
await context.read<AuthModel>().gqlClient.request(req).first; await context.read<AuthModel>().gqlClient!.request(req).first;
final gists = res.data.user.gists; final gists = res.data!.user!.gists;
return ListPayload( return ListPayload(
cursor: gists.pageInfo.endCursor, cursor: gists.pageInfo.endCursor,
items: gists.nodes, items: gists.nodes,
@ -31,14 +33,14 @@ class GhGistsScreen extends StatelessWidget {
); );
}, },
itemBuilder: (v) { 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 // TODO: add gist comments
return GistsItem( return GistsItem(
description: v.description, description: v.description,
login: login, login: login,
filenames: filenames, filenames: filenames,
language: v.files[0].language.name, language: v.files![0].language!.name,
avatarUrl: v.owner.avatarUrl, avatarUrl: v.owner!.avatarUrl,
updatedAt: v.updatedAt, updatedAt: v.updatedAt,
id: v.name, id: v.name,
); );

View File

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

View File

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

View File

@ -1,6 +1,8 @@
import 'package:ferry/ferry.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:git_touch/graphql/github.data.gql.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.req.gql.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/scaffolds/list_stateful.dart'; import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
@ -18,8 +20,8 @@ class GhIssuesScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<GIssuesData_repository_issues_nodes, String>( return ListStatefulScaffold<GIssuesData_repository_issues_nodes, String?>(
title: AppBarTitle(AppLocalizations.of(context).issues), title: AppBarTitle(AppLocalizations.of(context)!.issues),
actionBuilder: () => ActionEntry( actionBuilder: () => ActionEntry(
iconData: Octicons.plus, iconData: Octicons.plus,
url: '/github/$owner/$name/issues/new', url: '/github/$owner/$name/issues/new',
@ -30,13 +32,13 @@ class GhIssuesScreen extends StatelessWidget {
b.vars.name = name; b.vars.name = name;
b.vars.cursor = cursor; b.vars.cursor = cursor;
}); });
final res = final OperationResponse<GIssuesData, GIssuesVars?> res =
await context.read<AuthModel>().gqlClient.request(req).first; await context.read<AuthModel>().gqlClient!.request(req).first;
final issues = res.data.repository.issues; final issues = res.data!.repository!.issues;
return ListPayload( return ListPayload(
cursor: issues.pageInfo.endCursor, cursor: issues.pageInfo.endCursor,
hasMore: issues.pageInfo.hasNextPage, hasMore: issues.pageInfo.hasNextPage,
items: issues.nodes.toList(), items: issues.nodes!.toList(),
); );
}, },
itemBuilder: (p) { itemBuilder: (p) {
@ -47,10 +49,10 @@ class GhIssuesScreen extends StatelessWidget {
subtitle: '#' + p.number.toString(), subtitle: '#' + p.number.toString(),
title: p.title, title: p.title,
updatedAt: p.updatedAt, updatedAt: p.updatedAt,
labels: p.labels.nodes.isEmpty labels: p.labels!.nodes!.isEmpty
? null ? null
: Wrap(spacing: 4, runSpacing: 4, children: [ : 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) MyLabel(name: label.name, cssColor: label.color)
]), ]),
url: '/github/$owner/$name/issues/${p.number}', 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. // 1 item is enough since count is not displayed for now.
var items = await context var items = await context
.read<AuthModel>() .read<AuthModel>()
.ghClient .ghClient!
.getJSON('/notifications?per_page=1'); .getJSON('/notifications?per_page=1');
if (items is List && items.isNotEmpty) { if (items is List && items.isNotEmpty) {
@ -36,16 +36,16 @@ class GhNewsScreenState extends State<GhNewsScreen> {
@override @override
Widget build(context) { Widget build(context) {
return ListStatefulScaffold<GithubEvent, int>( return ListStatefulScaffold<GithubEvent, int>(
title: AppBarTitle(AppLocalizations.of(context).news), title: AppBarTitle(AppLocalizations.of(context)!.news),
itemBuilder: (payload) => EventItem(payload), itemBuilder: (payload) => EventItem(payload),
fetch: (page) async { fetch: (page) async {
page = page ?? 1; page = page ?? 1;
final auth = context.read<AuthModel>(); 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', '/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( return ListPayload(
cursor: page + 1, cursor: page + 1,

View File

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

View File

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

View File

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

View File

@ -14,12 +14,12 @@ class GhUserOrganizationScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<GithubUserOrganizationItem, int>( return ListStatefulScaffold<GithubUserOrganizationItem, int>(
title: AppBarTitle(AppLocalizations.of(context).organizations), title: AppBarTitle(AppLocalizations.of(context)!.organizations),
fetch: (page) async { fetch: (page) async {
page = page ?? 1; page = page ?? 1;
final res = await context final res = await context
.read<AuthModel>() .read<AuthModel>()
.ghClient .ghClient!
.getJSON<List, List<GithubUserOrganizationItem>>( .getJSON<List, List<GithubUserOrganizationItem>>(
'/users/$login/orgs?page=$page', '/users/$login/orgs?page=$page',
convert: (vs) => convert: (vs) =>
@ -36,7 +36,7 @@ class GhUserOrganizationScreen extends StatelessWidget {
avatarUrl: v.avatarUrl, avatarUrl: v.avatarUrl,
login: v.login, login: v.login,
name: null, // TODO: organization name 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:flutter/material.dart';
import 'package:git_touch/graphql/github.data.gql.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.req.gql.dart';
import 'package:git_touch/graphql/github.var.gql.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/scaffolds/list_stateful.dart'; import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart'; import 'package:git_touch/widgets/app_bar_title.dart';
@ -17,21 +19,21 @@ class GhPullsScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<GPullsData_repository_pullRequests_nodes, return ListStatefulScaffold<GPullsData_repository_pullRequests_nodes,
String>( String?>(
title: AppBarTitle(AppLocalizations.of(context).pullRequests), title: AppBarTitle(AppLocalizations.of(context)!.pullRequests),
fetch: (cursor) async { fetch: (cursor) async {
final req = GPullsReq((b) { final req = GPullsReq((b) {
b.vars.owner = owner; b.vars.owner = owner;
b.vars.name = name; b.vars.name = name;
b.vars.cursor = cursor; b.vars.cursor = cursor;
}); });
final res = final OperationResponse<GPullsData, GPullsVars?> res =
await context.read<AuthModel>().gqlClient.request(req).first; await context.read<AuthModel>().gqlClient!.request(req).first;
final pulls = res.data.repository.pullRequests; final pulls = res.data!.repository!.pullRequests;
return ListPayload( return ListPayload(
cursor: pulls.pageInfo.endCursor, cursor: pulls.pageInfo.endCursor,
hasMore: pulls.pageInfo.hasNextPage, hasMore: pulls.pageInfo.hasNextPage,
items: pulls.nodes.toList(), items: pulls.nodes!.toList(),
); );
}, },
itemBuilder: (p) => IssueItem( itemBuilder: (p) => IssueItem(
@ -42,10 +44,10 @@ class GhPullsScreen extends StatelessWidget {
subtitle: '#' + p.number.toString(), subtitle: '#' + p.number.toString(),
title: p.title, title: p.title,
updatedAt: p.updatedAt, updatedAt: p.updatedAt,
labels: p.labels.nodes.isEmpty labels: p.labels!.nodes!.isEmpty
? null ? null
: Wrap(spacing: 4, runSpacing: 4, children: [ : 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) MyLabel(name: label.name, cssColor: label.color)
]), ]),
url: '/github/$owner/$name/pull/${p.number}', url: '/github/$owner/$name/pull/${p.number}',

View File

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

View File

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

View File

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

View File

@ -19,13 +19,13 @@ class GhSearchScreen extends StatefulWidget {
} }
class _GhSearchScreenState extends State<GhSearchScreen> { class _GhSearchScreenState extends State<GhSearchScreen> {
int _activeTab = 0; int? _activeTab = 0;
bool _loading = false; 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 @override
void initState() { void initState() {
@ -35,14 +35,14 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
@override @override
void dispose() { void dispose() {
_controller.dispose(); _controller!.dispose();
super.dispose(); super.dispose();
} }
Future<void> _query() async { Future<void> _query() async {
if (_loading || _keyword.isEmpty) return; if (_loading || _keyword.isEmpty) return;
var keyword = _controller.text; var keyword = _controller!.text;
setState(() { setState(() {
_loading = true; _loading = true;
}); });
@ -126,7 +126,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
Icon(Octicons.search, size: 20, color: PrimerColors.gray400), Icon(Octicons.search, size: 20, color: PrimerColors.gray400),
], ],
), ),
placeholder: AppLocalizations.of(context).search, placeholder: AppLocalizations.of(context)!.search,
clearButtonMode: OverlayVisibilityMode.editing, clearButtonMode: OverlayVisibilityMode.editing,
textInputAction: TextInputAction.go, textInputAction: TextInputAction.go,
onSubmitted: (_) => _query(), onSubmitted: (_) => _query(),
@ -136,7 +136,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
default: default:
return TextField( return TextField(
decoration: InputDecoration.collapsed( decoration: InputDecoration.collapsed(
hintText: AppLocalizations.of(context).search), hintText: AppLocalizations.of(context)!.search),
textInputAction: TextInputAction.go, textInputAction: TextInputAction.go,
onSubmitted: (_) => _query(), onSubmitted: (_) => _query(),
controller: _controller, controller: _controller,
@ -144,11 +144,11 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
} }
} }
_onTabSwitch(int index) { _onTabSwitch(int? index) {
setState(() { setState(() {
_activeTab = index; _activeTab = index;
}); });
if (_payloads[_activeTab].isEmpty) { if (_payloads[_activeTab!]!.isEmpty) {
_query(); _query();
} }
} }
@ -236,7 +236,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
if (_loading) if (_loading)
Loading() Loading()
else 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) { Widget build(BuildContext context) {
return TabStatefulScaffold<List>( return TabStatefulScaffold<List>(
title: AppBarTitle(AppLocalizations.of(context).trending), title: AppBarTitle(AppLocalizations.of(context)!.trending),
tabs: [ tabs: [
AppLocalizations.of(context).repositories, AppLocalizations.of(context)!.repositories,
AppLocalizations.of(context).developers AppLocalizations.of(context)!.developers
], ],
fetchData: (tabIndex) async { fetchData: (tabIndex) async {
if (tabIndex == 0) { if (tabIndex == 0) {
@ -58,8 +58,8 @@ class GhTrendingScreen extends StatelessWidget {
avatarUrl: v.avatar, avatarUrl: v.avatar,
bio: v.repo == null bio: v.repo == null
? null ? null
: Link( : LinkWidget(
url: '/github/${v.username}/${v.repo.name}', url: '/github/${v.username}/${v.repo!.name}',
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Icon( Icon(
@ -70,7 +70,7 @@ class GhTrendingScreen extends StatelessWidget {
SizedBox(width: 4), SizedBox(width: 4),
Expanded( Expanded(
child: Text( child: Text(
'${v.username} / ${v.repo.name}', '${v.username} / ${v.repo!.name}',
style: TextStyle( style: TextStyle(
fontSize: 17, fontSize: 17,
color: theme.palette.secondaryText, color: theme.palette.secondaryText,

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@ class GlExploreScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<GitlabProject, int>( return ListStatefulScaffold<GitlabProject, int>(
title: AppBarTitle(AppLocalizations.of(context).explore), title: AppBarTitle(AppLocalizations.of(context)!.explore),
fetch: (page) async { fetch: (page) async {
page = page ?? 1; page = page ?? 1;
final auth = context.read<AuthModel>(); final auth = context.read<AuthModel>();
@ -29,7 +29,7 @@ class GlExploreScreen extends StatelessWidget {
itemBuilder: (v) { itemBuilder: (v) {
return RepositoryItem.gl( return RepositoryItem.gl(
payload: v, 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RefreshStatefulScaffold<Tuple2<GitlabGroup, int>>( return RefreshStatefulScaffold<Tuple2<GitlabGroup, int>>(
title: Text(AppLocalizations.of(context).group), title: Text(AppLocalizations.of(context)!.group),
fetch: () async { fetch: () async {
final auth = context.read<AuthModel>(); final auth = context.read<AuthModel>();
final res = await Future.wait([ final res = await Future.wait([
@ -53,10 +53,10 @@ class GlGroupScreen extends StatelessWidget {
CommonStyle.border, CommonStyle.border,
Column( Column(
children: <Widget>[ children: <Widget>[
for (var v in p.projects) for (var v in p.projects!)
RepositoryItem.gl( RepositoryItem.gl(
payload: v, 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<GitlabGroup, int>( return ListStatefulScaffold<GitlabGroup, int>(
title: AppBarTitle(AppLocalizations.of(context).groups), title: AppBarTitle(AppLocalizations.of(context)!.groups),
fetch: (page) async { fetch: (page) async {
page = page ?? 1; page = page ?? 1;
final auth = context.read<AuthModel>(); final auth = context.read<AuthModel>();

View File

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

View File

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

View File

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

View File

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

View File

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