mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
feat: add more information for users screen
This commit is contained in:
parent
ae1536b348
commit
f3b547668c
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import '../scaffolds/list.dart';
|
||||
import '../providers/settings.dart';
|
||||
import '../utils/utils.dart';
|
||||
@ -46,8 +47,12 @@ class _UsersScreenState extends State<UsersScreen> {
|
||||
endCursor
|
||||
}
|
||||
nodes {
|
||||
name
|
||||
login
|
||||
avatarUrl
|
||||
bio
|
||||
company
|
||||
location
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,10 +73,59 @@ class _UsersScreenState extends State<UsersScreen> {
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar(url: payload['avatarUrl']),
|
||||
Padding(padding: EdgeInsets.only(left: 10)),
|
||||
Text(payload['login'], style: TextStyle(fontSize: 18))
|
||||
SizedBox(width: 10),
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(color: PrimerColors.gray600, fontSize: 13),
|
||||
child: Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: join(SizedBox(height: 8), [
|
||||
Row(
|
||||
children: join(SizedBox(width: 10), [
|
||||
ifNotNull(
|
||||
payload['name'] as String,
|
||||
(String name) => Text(
|
||||
name,
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: PrimerColors.gray900),
|
||||
),
|
||||
),
|
||||
Text(payload['login'], style: TextStyle(fontSize: 14)),
|
||||
]),
|
||||
),
|
||||
(payload['bio'] == null ||
|
||||
(payload['bio'] as String).trim().isEmpty)
|
||||
? null
|
||||
: Text(payload['bio']),
|
||||
Row(
|
||||
children: join(SizedBox(width: 10), [
|
||||
ifNotNull(
|
||||
payload['company'] as String,
|
||||
(String company) => Row(children: [
|
||||
Icon(Octicons.organization,
|
||||
size: 14, color: PrimerColors.gray600),
|
||||
SizedBox(width: 2),
|
||||
Text(company)
|
||||
]),
|
||||
),
|
||||
ifNotNull(
|
||||
payload['location'] as String,
|
||||
(String location) => Row(children: [
|
||||
Icon(Octicons.location,
|
||||
size: 14, color: PrimerColors.gray600),
|
||||
SizedBox(width: 2),
|
||||
Text(location)
|
||||
]),
|
||||
),
|
||||
]),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -86,3 +86,35 @@ primaryLanguage {
|
||||
name
|
||||
}
|
||||
''';
|
||||
|
||||
List<T> join<T>(T seperator, List<T> xs) {
|
||||
List<T> result = [];
|
||||
xs.asMap().forEach((index, x) {
|
||||
if (x == null) return;
|
||||
|
||||
result.add(x);
|
||||
if (index < xs.length - 1) {
|
||||
result.add(seperator);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
List<T> joinAll<T>(T seperator, List<List<T>> xss) {
|
||||
List<T> result = [];
|
||||
xss.asMap().forEach((index, x) {
|
||||
if (x == null || x.isEmpty) return;
|
||||
|
||||
result.addAll(x);
|
||||
if (index < xss.length - 1) {
|
||||
result.add(seperator);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
K ifNotNull<T, K>(T value, K Function(T v) builder) {
|
||||
return value == null ? null : builder(value);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user