mirror of
https://github.com/git-touch/git-touch
synced 2025-03-05 19:57:42 +01:00
improvement: user screen style
This commit is contained in:
parent
3586ee5230
commit
36e772c85f
@ -86,6 +86,8 @@ class GithubUserUser extends GithubUserAuditEntryActor
|
|||||||
|
|
||||||
String email;
|
String email;
|
||||||
|
|
||||||
|
DateTime createdAt;
|
||||||
|
|
||||||
String websiteUrl;
|
String websiteUrl;
|
||||||
|
|
||||||
GithubUserStarredRepositoryConnection starredRepositories;
|
GithubUserStarredRepositoryConnection starredRepositories;
|
||||||
@ -124,6 +126,7 @@ class GithubUserUser extends GithubUserAuditEntryActor
|
|||||||
company,
|
company,
|
||||||
location,
|
location,
|
||||||
email,
|
email,
|
||||||
|
createdAt,
|
||||||
websiteUrl,
|
websiteUrl,
|
||||||
starredRepositories,
|
starredRepositories,
|
||||||
followers,
|
followers,
|
||||||
@ -618,6 +621,8 @@ class GithubUserOrganization extends GithubUserAuditEntryActor
|
|||||||
|
|
||||||
String websiteUrl;
|
String websiteUrl;
|
||||||
|
|
||||||
|
DateTime createdAt;
|
||||||
|
|
||||||
GithubUserPinnableItemConnection pinnedItems;
|
GithubUserPinnableItemConnection pinnedItems;
|
||||||
|
|
||||||
GithubUserPinnableItemConnection pinnableItems;
|
GithubUserPinnableItemConnection pinnableItems;
|
||||||
@ -644,6 +649,7 @@ class GithubUserOrganization extends GithubUserAuditEntryActor
|
|||||||
location,
|
location,
|
||||||
email,
|
email,
|
||||||
websiteUrl,
|
websiteUrl,
|
||||||
|
createdAt,
|
||||||
pinnedItems,
|
pinnedItems,
|
||||||
pinnableItems,
|
pinnableItems,
|
||||||
membersWithRole,
|
membersWithRole,
|
||||||
@ -788,6 +794,12 @@ class GithubUserQuery extends GraphQLQuery<GithubUser, GithubUserArguments> {
|
|||||||
arguments: [],
|
arguments: [],
|
||||||
directives: [],
|
directives: [],
|
||||||
selectionSet: null),
|
selectionSet: null),
|
||||||
|
FieldNode(
|
||||||
|
name: NameNode(value: 'createdAt'),
|
||||||
|
alias: null,
|
||||||
|
arguments: [],
|
||||||
|
directives: [],
|
||||||
|
selectionSet: null),
|
||||||
FieldNode(
|
FieldNode(
|
||||||
name: NameNode(value: 'websiteUrl'),
|
name: NameNode(value: 'websiteUrl'),
|
||||||
alias: null,
|
alias: null,
|
||||||
@ -1192,6 +1204,12 @@ class GithubUserQuery extends GraphQLQuery<GithubUser, GithubUserArguments> {
|
|||||||
arguments: [],
|
arguments: [],
|
||||||
directives: [],
|
directives: [],
|
||||||
selectionSet: null),
|
selectionSet: null),
|
||||||
|
FieldNode(
|
||||||
|
name: NameNode(value: 'createdAt'),
|
||||||
|
alias: null,
|
||||||
|
arguments: [],
|
||||||
|
directives: [],
|
||||||
|
selectionSet: null),
|
||||||
FieldNode(
|
FieldNode(
|
||||||
name: NameNode(value: 'pinnedItems'),
|
name: NameNode(value: 'pinnedItems'),
|
||||||
alias: null,
|
alias: null,
|
||||||
|
@ -44,6 +44,9 @@ GithubUserUser _$GithubUserUserFromJson(Map<String, dynamic> json) {
|
|||||||
..company = json['company'] as String
|
..company = json['company'] as String
|
||||||
..location = json['location'] as String
|
..location = json['location'] as String
|
||||||
..email = json['email'] as String
|
..email = json['email'] as String
|
||||||
|
..createdAt = json['createdAt'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['createdAt'] as String)
|
||||||
..websiteUrl = json['websiteUrl'] as String
|
..websiteUrl = json['websiteUrl'] as String
|
||||||
..starredRepositories = json['starredRepositories'] == null
|
..starredRepositories = json['starredRepositories'] == null
|
||||||
? null
|
? null
|
||||||
@ -84,6 +87,7 @@ Map<String, dynamic> _$GithubUserUserToJson(GithubUserUser instance) =>
|
|||||||
'company': instance.company,
|
'company': instance.company,
|
||||||
'location': instance.location,
|
'location': instance.location,
|
||||||
'email': instance.email,
|
'email': instance.email,
|
||||||
|
'createdAt': instance.createdAt?.toIso8601String(),
|
||||||
'websiteUrl': instance.websiteUrl,
|
'websiteUrl': instance.websiteUrl,
|
||||||
'starredRepositories': instance.starredRepositories?.toJson(),
|
'starredRepositories': instance.starredRepositories?.toJson(),
|
||||||
'followers': instance.followers?.toJson(),
|
'followers': instance.followers?.toJson(),
|
||||||
@ -475,6 +479,9 @@ GithubUserOrganization _$GithubUserOrganizationFromJson(
|
|||||||
..location = json['location'] as String
|
..location = json['location'] as String
|
||||||
..email = json['email'] as String
|
..email = json['email'] as String
|
||||||
..websiteUrl = json['websiteUrl'] as String
|
..websiteUrl = json['websiteUrl'] as String
|
||||||
|
..createdAt = json['createdAt'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['createdAt'] as String)
|
||||||
..pinnedItems = json['pinnedItems'] == null
|
..pinnedItems = json['pinnedItems'] == null
|
||||||
? null
|
? null
|
||||||
: GithubUserPinnableItemConnection.fromJson(
|
: GithubUserPinnableItemConnection.fromJson(
|
||||||
@ -501,6 +508,7 @@ Map<String, dynamic> _$GithubUserOrganizationToJson(
|
|||||||
'location': instance.location,
|
'location': instance.location,
|
||||||
'email': instance.email,
|
'email': instance.email,
|
||||||
'websiteUrl': instance.websiteUrl,
|
'websiteUrl': instance.websiteUrl,
|
||||||
|
'createdAt': instance.createdAt?.toIso8601String(),
|
||||||
'pinnedItems': instance.pinnedItems?.toJson(),
|
'pinnedItems': instance.pinnedItems?.toJson(),
|
||||||
'pinnableItems': instance.pinnableItems?.toJson(),
|
'pinnableItems': instance.pinnableItems?.toJson(),
|
||||||
'membersWithRole': instance.membersWithRole?.toJson(),
|
'membersWithRole': instance.membersWithRole?.toJson(),
|
||||||
|
@ -10,6 +10,7 @@ query($login: String!) {
|
|||||||
company
|
company
|
||||||
location
|
location
|
||||||
email
|
email
|
||||||
|
createdAt
|
||||||
websiteUrl
|
websiteUrl
|
||||||
starredRepositories {
|
starredRepositories {
|
||||||
totalCount
|
totalCount
|
||||||
@ -91,6 +92,7 @@ query($login: String!) {
|
|||||||
location
|
location
|
||||||
email
|
email
|
||||||
websiteUrl
|
websiteUrl
|
||||||
|
createdAt
|
||||||
pinnedItems(first: 6) {
|
pinnedItems(first: 6) {
|
||||||
nodes {
|
nodes {
|
||||||
__typename
|
__typename
|
||||||
|
@ -136,7 +136,12 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||||||
case 0:
|
case 0:
|
||||||
return RepositoryItem(data);
|
return RepositoryItem(data);
|
||||||
case 1:
|
case 1:
|
||||||
return UserItem.fromData(data);
|
return UserItem(
|
||||||
|
login: data['login'],
|
||||||
|
name: data['name'],
|
||||||
|
avatarUrl: data['avatarUrl'],
|
||||||
|
bio: Text(data['bio'] ?? ''),
|
||||||
|
);
|
||||||
case 2:
|
case 2:
|
||||||
default:
|
default:
|
||||||
return IssueItem(
|
return IssueItem(
|
||||||
|
@ -7,11 +7,11 @@ import 'package:git_touch/screens/users.dart';
|
|||||||
import 'package:git_touch/utils/utils.dart';
|
import 'package:git_touch/utils/utils.dart';
|
||||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||||
import 'package:git_touch/screens/repositories.dart';
|
import 'package:git_touch/screens/repositories.dart';
|
||||||
|
import 'package:git_touch/widgets/avatar.dart';
|
||||||
import 'package:git_touch/widgets/entry_item.dart';
|
import 'package:git_touch/widgets/entry_item.dart';
|
||||||
import 'package:git_touch/widgets/repository_item.dart';
|
import 'package:git_touch/widgets/repository_item.dart';
|
||||||
import 'package:git_touch/widgets/table_view.dart';
|
import 'package:git_touch/widgets/table_view.dart';
|
||||||
import 'package:git_touch/widgets/text_contains_organization.dart';
|
import 'package:git_touch/widgets/text_contains_organization.dart';
|
||||||
import 'package:git_touch/widgets/user_item.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';
|
||||||
@ -69,19 +69,92 @@ class UserScreen extends StatelessWidget {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildHeader(BuildContext context, String avatarUrl, String name,
|
||||||
|
DateTime createdAt, String bio) {
|
||||||
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
padding: CommonStyle.padding,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: <Widget>[
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Avatar(url: avatarUrl, size: AvatarSize.large),
|
||||||
|
SizedBox(width: 10),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
if (name != null) ...[
|
||||||
|
Text(
|
||||||
|
name,
|
||||||
|
style: TextStyle(
|
||||||
|
color: theme.palette.primary,
|
||||||
|
fontSize: 19,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 4),
|
||||||
|
],
|
||||||
|
Text(
|
||||||
|
'($login)',
|
||||||
|
style: TextStyle(
|
||||||
|
color: theme.palette.secondaryText,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 6),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
Octicons.clock,
|
||||||
|
size: 15,
|
||||||
|
color: theme.palette.secondaryText,
|
||||||
|
),
|
||||||
|
SizedBox(width: 4),
|
||||||
|
Text(
|
||||||
|
'Joined on ${dateFormat.format(createdAt)}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: theme.palette.secondaryText,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (bio != null && bio.isNotEmpty) ...[
|
||||||
|
SizedBox(height: 12),
|
||||||
|
Text(
|
||||||
|
bio,
|
||||||
|
style: TextStyle(
|
||||||
|
color: theme.palette.secondaryText,
|
||||||
|
fontSize: 17,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildUser(BuildContext context, GithubUserUser user) {
|
Widget _buildUser(BuildContext context, GithubUserUser user) {
|
||||||
final theme = Provider.of<ThemeModel>(context);
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
final login = user.login;
|
final login = user.login;
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
UserItem(
|
_buildHeader(
|
||||||
login: user.login,
|
context, user.avatarUrl, user.name, user.createdAt, user.bio),
|
||||||
name: user.name,
|
|
||||||
avatarUrl: user.avatarUrl,
|
|
||||||
bio: Text(user.bio ?? ''),
|
|
||||||
inUserScreen: true,
|
|
||||||
),
|
|
||||||
CommonStyle.border,
|
CommonStyle.border,
|
||||||
Row(children: [
|
Row(children: [
|
||||||
EntryItem(
|
EntryItem(
|
||||||
@ -197,13 +270,8 @@ class UserScreen extends StatelessWidget {
|
|||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
UserItem(
|
_buildHeader(context, payload.avatarUrl, payload.name,
|
||||||
login: payload.login,
|
payload.createdAt, payload.description),
|
||||||
name: payload.name,
|
|
||||||
avatarUrl: payload.avatarUrl,
|
|
||||||
bio: Text(payload.description ?? ''),
|
|
||||||
inUserScreen: true,
|
|
||||||
),
|
|
||||||
CommonStyle.border,
|
CommonStyle.border,
|
||||||
Row(children: [
|
Row(children: [
|
||||||
EntryItem(
|
EntryItem(
|
||||||
|
@ -96,8 +96,6 @@ class UsersScreen extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final _dateFormat = DateFormat.yMMMMd();
|
|
||||||
|
|
||||||
Widget _buildBio(BuildContext context, String company, String location,
|
Widget _buildBio(BuildContext context, String company, String location,
|
||||||
DateTime createdAt) {
|
DateTime createdAt) {
|
||||||
final theme = Provider.of<ThemeModel>(context);
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
@ -135,7 +133,7 @@ class UsersScreen extends StatelessWidget {
|
|||||||
color: theme.palette.secondaryText,
|
color: theme.palette.secondaryText,
|
||||||
),
|
),
|
||||||
SizedBox(width: 4),
|
SizedBox(width: 4),
|
||||||
Text('Joined on ${_dateFormat.format(createdAt)}'),
|
Text('Joined on ${dateFormat.format(createdAt)}'),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -186,3 +186,5 @@ class RouterScreen {
|
|||||||
HandlerFunc handler;
|
HandlerFunc handler;
|
||||||
RouterScreen(this.path, this.handler);
|
RouterScreen(this.path, this.handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final dateFormat = DateFormat.yMMMMd();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user