1
0
mirror of https://github.com/git-touch/git-touch synced 2025-01-31 08:04:51 +01:00

improvement: add note

This commit is contained in:
Rongjian Zhang 2020-01-11 19:25:33 +08:00
parent c6822c4830
commit 22fe55d9e0
11 changed files with 62 additions and 5 deletions

View File

@ -2511,6 +2511,9 @@ class GhReposRepository extends GhReposPinnableItem
@override @override
bool isFork; bool isFork;
@override
DateTime updatedAt;
@override @override
GhReposStargazerConnection stargazers; GhReposStargazerConnection stargazers;
@ -2529,6 +2532,7 @@ class GhReposRepository extends GhReposPinnableItem
description, description,
isPrivate, isPrivate,
isFork, isFork,
updatedAt,
stargazers, stargazers,
forks, forks,
primaryLanguage, primaryLanguage,
@ -2708,12 +2712,14 @@ class GhReposRepositoryInfo with EquatableMixin {
bool isFork; bool isFork;
DateTime updatedAt;
@JsonKey(name: '__typename') @JsonKey(name: '__typename')
String resolveType; String resolveType;
@override @override
List<Object> get props => List<Object> get props =>
[owner, name, description, isPrivate, isFork, resolveType]; [owner, name, description, isPrivate, isFork, updatedAt, resolveType];
Map<String, dynamic> toJson() => _$GhReposRepositoryInfoToJson(this); Map<String, dynamic> toJson() => _$GhReposRepositoryInfoToJson(this);
} }
@ -3051,6 +3057,12 @@ class GhReposQuery extends GraphQLQuery<GhRepos, GhReposArguments> {
arguments: [], arguments: [],
directives: [], directives: [],
selectionSet: null), selectionSet: null),
FieldNode(
name: NameNode(value: 'updatedAt'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode( FieldNode(
name: NameNode(value: 'stargazers'), name: NameNode(value: 'stargazers'),
alias: null, alias: null,
@ -3205,6 +3217,12 @@ class GhReposQuery extends GraphQLQuery<GhRepos, GhReposArguments> {
arguments: [], arguments: [],
directives: [], directives: [],
selectionSet: null), selectionSet: null),
FieldNode(
name: NameNode(value: 'updatedAt'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode( FieldNode(
name: NameNode(value: 'stargazers'), name: NameNode(value: 'stargazers'),
alias: null, alias: null,
@ -3379,6 +3397,12 @@ class GhReposQuery extends GraphQLQuery<GhRepos, GhReposArguments> {
arguments: [], arguments: [],
directives: [], directives: [],
selectionSet: null), selectionSet: null),
FieldNode(
name: NameNode(value: 'updatedAt'),
alias: null,
arguments: [],
directives: [],
selectionSet: null),
FieldNode( FieldNode(
name: NameNode(value: 'stargazers'), name: NameNode(value: 'stargazers'),
alias: null, alias: null,

View File

@ -1035,6 +1035,9 @@ GhReposRepository _$GhReposRepositoryFromJson(Map<String, dynamic> json) {
..description = json['description'] as String ..description = json['description'] as String
..isPrivate = json['isPrivate'] as bool ..isPrivate = json['isPrivate'] as bool
..isFork = json['isFork'] as bool ..isFork = json['isFork'] as bool
..updatedAt = json['updatedAt'] == null
? null
: DateTime.parse(json['updatedAt'] as String)
..stargazers = json['stargazers'] == null ..stargazers = json['stargazers'] == null
? null ? null
: GhReposStargazerConnection.fromJson( : GhReposStargazerConnection.fromJson(
@ -1057,6 +1060,7 @@ Map<String, dynamic> _$GhReposRepositoryToJson(GhReposRepository instance) =>
'description': instance.description, 'description': instance.description,
'isPrivate': instance.isPrivate, 'isPrivate': instance.isPrivate,
'isFork': instance.isFork, 'isFork': instance.isFork,
'updatedAt': instance.updatedAt?.toIso8601String(),
'stargazers': instance.stargazers?.toJson(), 'stargazers': instance.stargazers?.toJson(),
'forks': instance.forks?.toJson(), 'forks': instance.forks?.toJson(),
'primaryLanguage': instance.primaryLanguage?.toJson(), 'primaryLanguage': instance.primaryLanguage?.toJson(),
@ -1186,6 +1190,9 @@ GhReposRepositoryInfo _$GhReposRepositoryInfoFromJson(
..description = json['description'] as String ..description = json['description'] as String
..isPrivate = json['isPrivate'] as bool ..isPrivate = json['isPrivate'] as bool
..isFork = json['isFork'] as bool ..isFork = json['isFork'] as bool
..updatedAt = json['updatedAt'] == null
? null
: DateTime.parse(json['updatedAt'] as String)
..resolveType = json['__typename'] as String; ..resolveType = json['__typename'] as String;
} }
@ -1197,6 +1204,7 @@ Map<String, dynamic> _$GhReposRepositoryInfoToJson(
'description': instance.description, 'description': instance.description,
'isPrivate': instance.isPrivate, 'isPrivate': instance.isPrivate,
'isFork': instance.isFork, 'isFork': instance.isFork,
'updatedAt': instance.updatedAt?.toIso8601String(),
'__typename': instance.resolveType, '__typename': instance.resolveType,
}; };

View File

@ -23,6 +23,7 @@ query GhRepos($owner: String!, $after: String, $isStar: Boolean!) {
description description
isPrivate isPrivate
isFork isFork
updatedAt
stargazers { stargazers {
totalCount totalCount
} }
@ -53,6 +54,7 @@ query GhRepos($owner: String!, $after: String, $isStar: Boolean!) {
description description
isPrivate isPrivate
isFork isFork
updatedAt
stargazers { stargazers {
totalCount totalCount
} }
@ -84,6 +86,7 @@ query GhRepos($owner: String!, $after: String, $isStar: Boolean!) {
description description
isPrivate isPrivate
isFork isFork
updatedAt
stargazers { stargazers {
totalCount totalCount
} }

View File

@ -52,6 +52,7 @@ class GiteaUserScreen extends StatelessWidget {
v.forksCount, v.forksCount,
null, null,
null, null,
null,
); );
}).toList(), }).toList(),
) )

View File

@ -67,7 +67,7 @@ class GitlabProjectScreen extends StatelessWidget {
data.starCount, data.starCount,
data.forksCount, data.forksCount,
data.languages.keys.first, data.languages.keys.first,
null, null, null,
), ),
CommonStyle.border, CommonStyle.border,
Row( Row(

View File

@ -72,6 +72,7 @@ class GitlabUserScreen extends StatelessWidget {
v.forksCount, v.forksCount,
null, null,
null, null,
null,
); );
}).toList(), }).toList(),
) )

View File

@ -6,6 +6,7 @@ import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:git_touch/widgets/repository_item.dart'; import 'package:git_touch/widgets/repository_item.dart';
import 'package:timeago/timeago.dart' as timeago;
class RepositoriesScreen extends StatelessWidget { class RepositoriesScreen extends StatelessWidget {
final String owner; final String owner;
@ -72,6 +73,7 @@ class RepositoriesScreen extends StatelessWidget {
item.forks.totalCount, item.forks.totalCount,
item.primaryLanguage?.name, item.primaryLanguage?.name,
item.primaryLanguage?.color, item.primaryLanguage?.color,
'Updated ${timeago.format(item.updatedAt)}',
); );
}); });
} }

View File

@ -2,14 +2,15 @@ import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:git_touch/models/theme.dart'; import 'package:git_touch/models/theme.dart';
import 'package:git_touch/scaffolds/common.dart'; import 'package:git_touch/scaffolds/common.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/issue_item.dart'; import 'package:git_touch/widgets/issue_item.dart';
import 'package:git_touch/widgets/loading.dart'; import 'package:git_touch/widgets/loading.dart';
import 'package:git_touch/widgets/user_item.dart'; import 'package:git_touch/widgets/user_item.dart';
import 'package:primer/primer.dart'; import 'package:primer/primer.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import '../utils/utils.dart';
import 'package:git_touch/widgets/repository_item.dart'; import 'package:git_touch/widgets/repository_item.dart';
import 'package:timeago/timeago.dart' as timeago;
class SearchScreen extends StatefulWidget { class SearchScreen extends StatefulWidget {
@override @override
@ -59,6 +60,7 @@ class _SearchScreenState extends State<SearchScreen> {
description description
isPrivate isPrivate
isFork isFork
updatedAt
stargazers { stargazers {
totalCount totalCount
} }
@ -162,6 +164,7 @@ class _SearchScreenState extends State<SearchScreen> {
Widget _buildItem(p) { Widget _buildItem(p) {
switch (_activeTab) { switch (_activeTab) {
case 0: case 0:
final updatedAt = timeago.format(DateTime.parse(p['updatedAt']));
return RepositoryItem( return RepositoryItem(
p['owner']['login'], p['owner']['login'],
p['owner']['avatarUrl'], p['owner']['avatarUrl'],
@ -172,6 +175,7 @@ class _SearchScreenState extends State<SearchScreen> {
p['forks']['totalCount'], p['forks']['totalCount'],
p['primaryLanguage'] == null ? null : p['primaryLanguage']['name'], p['primaryLanguage'] == null ? null : p['primaryLanguage']['name'],
p['primaryLanguage'] == null ? null : p['primaryLanguage']['color'], p['primaryLanguage'] == null ? null : p['primaryLanguage']['color'],
'Updated $updatedAt',
); );
case 1: case 1:
return UserItem( return UserItem(

View File

@ -38,6 +38,7 @@ class TrendingScreen extends StatelessWidget {
item.forks ?? 0, item.forks ?? 0,
item.language, item.language,
item.languageColor, item.languageColor,
'${item.currentPeriodStars} stars today',
); );
case 1: case 1:
final item = GithubTrendingUser.fromJson(v); final item = GithubTrendingUser.fromJson(v);

View File

@ -15,6 +15,7 @@ import 'package:git_touch/widgets/text_contains_organization.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:git_touch/widgets/action_button.dart'; import 'package:git_touch/widgets/action_button.dart';
import 'package:timeago/timeago.dart' as t;
final userRouter = RouterScreen( final userRouter = RouterScreen(
'/:login', '/:login',
@ -74,6 +75,7 @@ class UserScreen extends StatelessWidget {
v.forks.totalCount, v.forks.totalCount,
v.primaryLanguage?.name, v.primaryLanguage?.name,
v.primaryLanguage?.color, v.primaryLanguage?.color,
null,
); );
}).toList(), }).toList(),
), ),

View File

@ -16,6 +16,7 @@ class RepositoryItem extends StatelessWidget {
final int forkCount; final int forkCount;
final String primaryLanguageName; final String primaryLanguageName;
final String primaryLanguageColor; final String primaryLanguageColor;
final String note;
RepositoryItem( RepositoryItem(
this.owner, this.owner,
@ -27,6 +28,7 @@ class RepositoryItem extends StatelessWidget {
this.forkCount, this.forkCount,
this.primaryLanguageName, this.primaryLanguageName,
this.primaryLanguageColor, this.primaryLanguageColor,
this.note,
); );
@override @override
@ -44,7 +46,6 @@ class RepositoryItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Avatar( Avatar(
url: avatarUrl, url: avatarUrl,
@ -80,7 +81,7 @@ class RepositoryItem extends StatelessWidget {
// size: 17, color: theme.palette.tertiaryText), // size: 17, color: theme.palette.tertiaryText),
], ],
), ),
SizedBox(height: 6), SizedBox(height: 8),
if (description != null && description.isNotEmpty) ...[ if (description != null && description.isNotEmpty) ...[
Text( Text(
description, description,
@ -91,6 +92,16 @@ class RepositoryItem extends StatelessWidget {
), ),
SizedBox(height: 10), SizedBox(height: 10),
], ],
if (note != null) ...[
Text(
note,
style: TextStyle(
fontSize: 14,
color: theme.palette.tertiaryText,
),
),
SizedBox(height: 10),
],
DefaultTextStyle( DefaultTextStyle(
style: TextStyle(color: theme.palette.text, fontSize: 14), style: TextStyle(color: theme.palette.text, fontSize: 14),
child: Row( child: Row(