mirror of
https://github.com/git-touch/git-touch
synced 2025-03-05 19:57:42 +01:00
feat: style tweaks
This commit is contained in:
parent
8e088ef701
commit
e3cba91b9c
@ -45,7 +45,7 @@ class ObjectScreen extends StatelessWidget {
|
||||
case 'blob':
|
||||
return [
|
||||
SizedBox(width: 6),
|
||||
SetiIcon(item['name'], size: 28),
|
||||
SetiIcon(item['name'], size: 28, light: true),
|
||||
SizedBox(width: 6),
|
||||
];
|
||||
case 'tree':
|
||||
@ -101,7 +101,7 @@ class ObjectScreen extends StatelessWidget {
|
||||
// TODO: All image types
|
||||
var ext = path.extension(item['name']);
|
||||
if (ext.isNotEmpty) ext = ext.substring(1);
|
||||
if (['png', 'jpg', 'jpeg'].contains(ext)) {
|
||||
if (['png', 'jpg', 'jpeg', 'gif', 'webp'].contains(ext)) {
|
||||
return ImageView(NetworkImage('$rawUrl/' + item['name']));
|
||||
}
|
||||
return ObjectScreen(
|
||||
|
@ -73,10 +73,7 @@ class _OrganizationScreenState extends State<OrganizationScreen> {
|
||||
),
|
||||
items: items,
|
||||
itemBuilder: (item, _) {
|
||||
return RepoItem(
|
||||
item,
|
||||
showOwner: item['owner']['login'] != widget.login,
|
||||
);
|
||||
return RepoItem(item);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/models/settings.dart';
|
||||
import 'package:git_touch/screens/users.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
@ -46,6 +47,9 @@ class RepoScreen extends StatelessWidget {
|
||||
isPrivate
|
||||
isFork
|
||||
description
|
||||
watchers {
|
||||
totalCount
|
||||
}
|
||||
stargazers {
|
||||
totalCount
|
||||
}
|
||||
@ -108,7 +112,7 @@ class RepoScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshScaffold(
|
||||
title: Text(owner + '/' + name),
|
||||
title: Text('Repository'),
|
||||
trailingBuilder: (data) {
|
||||
var payload = data[0];
|
||||
|
||||
@ -179,27 +183,25 @@ class RepoScreen extends StatelessWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
RepoItem(payload, isLink: false),
|
||||
RepoItem(payload, inRepoScreen: true),
|
||||
BorderView(),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
EntryItem(
|
||||
count: payload['issues']['totalCount'],
|
||||
text: 'Issues',
|
||||
count: payload['watchers']['totalCount'],
|
||||
text: 'Watchers',
|
||||
screenBuilder: (context) =>
|
||||
IssuesScreen(owner: owner, name: name),
|
||||
UsersScreen(login: 'pd4d10'), // FIXME:
|
||||
),
|
||||
EntryItem(
|
||||
count: payload['pullRequests']['totalCount'],
|
||||
text: 'Pull Requests',
|
||||
screenBuilder: (context) => IssuesScreen(
|
||||
owner: owner, name: name, isPullRequest: true),
|
||||
count: payload['stargazers']['totalCount'],
|
||||
text: 'Stars',
|
||||
screenBuilder: (context) => UsersScreen(login: 'pd4d10'),
|
||||
),
|
||||
EntryItem(
|
||||
count: payload['defaultBranchRef']['target']['history']
|
||||
['totalCount'],
|
||||
text: 'Commits',
|
||||
screenBuilder: (context) => CommitsScreen(owner, name),
|
||||
count: payload['forks']['totalCount'],
|
||||
text: 'Forks',
|
||||
screenBuilder: (context) => UsersScreen(login: 'pd4d10'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -64,7 +64,7 @@ class _ReposScreenState extends State<ReposScreen> {
|
||||
title: Text('$login\'s $title'),
|
||||
onRefresh: () => _queryRepos(),
|
||||
onLoadMore: (cursor) => _queryRepos(cursor),
|
||||
itemBuilder: (payload) => RepoItem(payload, showOwner: widget.star),
|
||||
itemBuilder: (payload) => RepoItem(payload),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -91,10 +91,7 @@ class _UserScreenState extends State<UserScreen> {
|
||||
),
|
||||
items: items,
|
||||
itemBuilder: (item, _) {
|
||||
return RepoItem(
|
||||
item,
|
||||
showOwner: item['owner']['login'] != widget.login,
|
||||
);
|
||||
return RepoItem(item);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -51,9 +51,7 @@ class _UsersScreenState extends State<UsersScreen> {
|
||||
name
|
||||
login
|
||||
avatarUrl
|
||||
bio
|
||||
company
|
||||
location
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -76,53 +74,23 @@ class _UsersScreenState extends State<UsersScreen> {
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar(url: payload['avatarUrl']),
|
||||
Avatar(url: payload['avatarUrl'], size: 20),
|
||||
SizedBox(width: 10),
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(color: PrimerColors.gray600, fontSize: 13),
|
||||
style: TextStyle(color: PrimerColors.gray900, 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)
|
||||
]),
|
||||
),
|
||||
]),
|
||||
children: join(SizedBox(height: 6), [
|
||||
Text(
|
||||
payload['name'] ?? payload['login'],
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: PrimerColors.blue500,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(payload['url'], style: TextStyle(fontSize: 14))
|
||||
]),
|
||||
),
|
||||
),
|
||||
|
@ -8,10 +8,9 @@ import 'link.dart';
|
||||
|
||||
class RepoItem extends StatelessWidget {
|
||||
final Map<String, dynamic> payload;
|
||||
final bool showOwner;
|
||||
final bool isLink;
|
||||
final bool inRepoScreen;
|
||||
|
||||
RepoItem(this.payload, {this.showOwner = true, this.isLink = true});
|
||||
RepoItem(this.payload, {this.inRepoScreen = false});
|
||||
|
||||
IconData _buildIconData() {
|
||||
if (payload['isPrivate']) {
|
||||
@ -23,6 +22,57 @@ class RepoItem extends StatelessWidget {
|
||||
return Octicons.repo;
|
||||
}
|
||||
|
||||
Widget _buildStatus() {
|
||||
return DefaultTextStyle(
|
||||
style: TextStyle(
|
||||
color: PrimerColors.gray800,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Row(children: <Widget>[
|
||||
Container(
|
||||
width: 10,
|
||||
height: 10,
|
||||
decoration: BoxDecoration(
|
||||
color: convertColor(payload['primaryLanguage'] == null
|
||||
? null
|
||||
: payload['primaryLanguage']['color']),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(payload['primaryLanguage'] == null
|
||||
? 'Unknown'
|
||||
: payload['primaryLanguage']['name']),
|
||||
]),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Icon(Octicons.star, size: 14, color: PrimerColors.gray600),
|
||||
Text(payload['stargazers']['totalCount'].toString()),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Icon(Octicons.repo_forked,
|
||||
size: 14, color: PrimerColors.gray600),
|
||||
Text(payload['forks']['totalCount'].toString())
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var widget = Padding(
|
||||
@ -36,14 +86,25 @@ class RepoItem extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: join(SizedBox(height: 8), <Widget>[
|
||||
Text(
|
||||
(showOwner ? (payload['owner']['login'] + ' / ') : '') +
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
payload['owner']['login'] + ' / ',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: PrimerColors.blue500,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
payload['name'],
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 16,
|
||||
color: PrimerColors.blue500,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: PrimerColors.blue500,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
payload['description'] == null ||
|
||||
(payload['description'] as String).isEmpty
|
||||
@ -51,62 +112,9 @@ class RepoItem extends StatelessWidget {
|
||||
: Text(
|
||||
payload['description'],
|
||||
style: TextStyle(
|
||||
color: PrimerColors.gray600, fontSize: 14),
|
||||
color: PrimerColors.gray700, fontSize: 14),
|
||||
),
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(
|
||||
color: PrimerColors.gray600,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: Row(children: <Widget>[
|
||||
Container(
|
||||
width: 10,
|
||||
height: 10,
|
||||
decoration: BoxDecoration(
|
||||
color: convertColor(
|
||||
payload['primaryLanguage'] == null
|
||||
? null
|
||||
: payload['primaryLanguage']['color']),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(payload['primaryLanguage'] == null
|
||||
? 'Unknown'
|
||||
: payload['primaryLanguage']['name']),
|
||||
]),
|
||||
),
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Icon(Octicons.star,
|
||||
size: 14, color: PrimerColors.gray600),
|
||||
Text(
|
||||
payload['stargazers']['totalCount'].toString()),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Icon(Octicons.repo_forked,
|
||||
size: 14, color: PrimerColors.gray600),
|
||||
Text(payload['forks']['totalCount'].toString())
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
...(inRepoScreen ? [] : [_buildStatus()])
|
||||
]),
|
||||
),
|
||||
),
|
||||
@ -115,7 +123,7 @@ class RepoItem extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
|
||||
if (isLink) {
|
||||
if (inRepoScreen) {
|
||||
// TODO: text style
|
||||
return Link(
|
||||
screenBuilder: (_) =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user