Compare commits

...

2 Commits

Author SHA1 Message Date
Rongjian Zhang 29242aa45d chore: style tweaks 2022-10-08 21:19:07 +08:00
Rongjian Zhang ad44495236 fix: tag color with dark theme 2022-10-08 17:40:38 +08:00
5 changed files with 118 additions and 126 deletions

View File

@ -227,7 +227,7 @@ class GhRepoScreen extends StatelessWidget {
),
],
),
if (repo.languages!.edges!.isNotEmpty) ...[
if (repo.languages?.edges != null) ...[
CommonStyle.border,
LanguageBar([
for (var edge in repo.languages!.edges!)
@ -244,13 +244,18 @@ class GhRepoScreen extends StatelessWidget {
AntListItem(
prefix: const Icon(Octicons.code),
extra: Text(
(license == null ? '' : '$license') +
filesize(repo.diskUsage! * 1000),
[
repo.primaryLanguage?.name,
license,
repo.diskUsage == null
? null
: filesize(repo.diskUsage! * 1000)
].where((e) => e != null).join(''),
),
onClick: () {
context.push('/github/$owner/$name/blob/${ref.name}');
},
child: Text(repo.primaryLanguage?.name ?? 'Code'),
child: const Text('Code'),
),
if (repo.hasIssuesEnabled)
AntListItem(

View File

@ -149,8 +149,7 @@ class _User extends StatelessWidget {
child: TextWithAt(
text: p.company!,
linkFactory: (text) => '/github/${text.substring(1)}',
style: TextStyle(
fontSize: 17, color: AntTheme.of(context).colorText),
style: TextStyle(color: AntTheme.of(context).colorText),
oneLine: true,
),
),

View File

@ -1,5 +1,5 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/cupertino.dart';
import 'package:from_css_color/from_css_color.dart';
class HexColorTag extends StatelessWidget {
@ -14,7 +14,6 @@ class HexColorTag extends StatelessWidget {
@override
Widget build(BuildContext context) {
final c = fromCssColor('#$color');
final theme = AntTheme.of(context);
return AntTag(
round: true,
@ -23,8 +22,8 @@ class HexColorTag extends StatelessWidget {
name,
style: TextStyle(
color: c.computeLuminance() > 0.5
? theme.colorText
: theme.colorBackground,
? CupertinoColors.black
: CupertinoColors.white,
),
),
);

View File

@ -26,50 +26,41 @@ class RepoHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = AntTheme.of(context);
return Container(
padding: CommonStyle.padding,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Avatar(
url: avatarUrl,
size: AvatarSize.small,
linkUrl: avatarLink,
),
const SizedBox(width: 8),
Expanded(
child: Text(
'$owner / $name',
style: TextStyle(
fontSize: 20,
color: AntTheme.of(context).colorPrimary,
),
style: TextStyle(fontSize: 20, color: theme.colorPrimary),
overflow: TextOverflow.visible,
),
),
],
].withSeparator(const SizedBox(width: 8)),
),
if (actions != null) ...actions!,
if (description != null && description!.isNotEmpty)
Text(
description!,
style: TextStyle(
color: AntTheme.of(context).colorTextSecondary,
fontSize: 17,
),
style: TextStyle(color: theme.colorTextSecondary, fontSize: 16),
),
if (homepageUrl != null && homepageUrl!.isNotEmpty)
LinkWidget(
url: homepageUrl,
child: Text(
homepageUrl!,
style: TextStyle(
color: AntTheme.of(context).colorPrimary,
fontSize: 17,
),
style: TextStyle(color: theme.colorPrimary, fontSize: 16),
),
),
if (trailings != null) ...trailings!

View File

@ -140,116 +140,114 @@ class RepoItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = AntTheme.of(context);
return AntListItem(
arrow: null,
onClick: () {
context.pushUrl(url);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Avatar(
url: avatarUrl,
size: AvatarSize.small,
linkUrl: avatarLink,
),
const SizedBox(width: 8),
Expanded(
child: Text.rich(
TextSpan(children: [
TextSpan(
text: '$owner / ',
style: TextStyle(
fontSize: 18,
color: AntTheme.of(context).colorPrimary,
),
),
TextSpan(
text: name,
style: TextStyle(
fontSize: 18,
color: AntTheme.of(context).colorPrimary,
fontWeight: FontWeight.w600,
),
// overflow: TextOverflow.ellipsis,
),
]),
overflow: TextOverflow.ellipsis,
),
),
if (iconData != null) ...[
const SizedBox(width: 6),
DefaultTextStyle(
style:
TextStyle(color: AntTheme.of(context).colorTextSecondary),
child: Icon(iconData,
size: 18, color: AntTheme.of(context).colorTextSecondary),
),
]
],
),
const SizedBox(height: 8),
if (description != null && description!.isNotEmpty) ...[
Text(
description!,
style: TextStyle(
color: AntTheme.of(context).colorTextSecondary,
fontSize: 16,
),
),
const SizedBox(height: 10),
],
if (note != null) ...[
Text(
note!,
style: TextStyle(
fontSize: 14,
color: AntTheme.of(context).colorWeak,
),
),
const SizedBox(height: 10),
],
DefaultTextStyle(
style:
TextStyle(color: AntTheme.of(context).colorText, fontSize: 14),
child: Row(
child: DefaultTextStyle(
style: const TextStyle(height: null),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
if (primaryLanguageName != null) ...[
Container(
width: 12,
height: 12,
decoration: BoxDecoration(
color: fromCssColor(primaryLanguageColor ??
github.languageColors[primaryLanguageName!]!),
shape: BoxShape.circle,
),
),
const SizedBox(width: 4),
Text(
primaryLanguageName!,
Avatar(
url: avatarUrl,
size: AvatarSize.small,
linkUrl: avatarLink,
),
Expanded(
child: Text.rich(
TextSpan(children: [
TextSpan(
text: '$owner / ',
style: TextStyle(
height: 1, fontSize: 18, color: theme.colorPrimary),
),
TextSpan(
text: name,
style: TextStyle(
height: 1,
fontSize: 18,
color: theme.colorPrimary,
fontWeight: FontWeight.w600,
// overflow: TextOverflow.ellipsis,
),
),
]),
overflow: TextOverflow.ellipsis,
),
const SizedBox(width: 24),
],
if (starCount! > 0) ...[
Icon(Octicons.star,
size: 16, color: AntTheme.of(context).colorText),
const SizedBox(width: 2),
Text(numberFormat.format(starCount)),
const SizedBox(width: 24),
],
if (forkCount! > 0) ...[
Icon(Octicons.repo_forked,
size: 16, color: AntTheme.of(context).colorText),
const SizedBox(width: 2),
Text(numberFormat.format(forkCount)),
],
],
),
if (iconData != null)
DefaultTextStyle(
style: TextStyle(color: theme.colorTextSecondary),
child: Icon(iconData,
size: 18, color: theme.colorTextSecondary),
),
].withSeparator(const SizedBox(width: 8)),
),
),
],
if (description != null && description!.isNotEmpty)
Text(
description!,
style: TextStyle(
color: theme.colorTextSecondary,
fontSize: 16,
leadingDistribution: TextLeadingDistribution.even,
),
),
if (note != null)
Text(note!,
style: TextStyle(fontSize: 14, color: theme.colorWeak)),
DefaultTextStyle(
style: TextStyle(color: theme.colorText, fontSize: 14),
child: Row(
children: <Widget>[
if (primaryLanguageName != null) ...[
Row(
children: [
Container(
width: 12,
height: 12,
decoration: BoxDecoration(
color: fromCssColor(primaryLanguageColor ??
github.languageColors[primaryLanguageName!]!),
shape: BoxShape.circle,
),
),
const SizedBox(width: 4),
Text(
primaryLanguageName!,
overflow: TextOverflow.ellipsis,
),
],
),
],
if (starCount! > 0)
Row(
children: [
Icon(Octicons.star, size: 14, color: theme.colorText),
const SizedBox(width: 2),
Text(numberFormat.format(starCount)),
],
),
if (forkCount! > 0) ...[
Row(
children: [
Icon(Octicons.repo_forked,
size: 14, color: theme.colorText),
const SizedBox(width: 2),
Text(numberFormat.format(forkCount)),
],
),
],
].withSeparator(const SizedBox(width: 24)),
),
),
].withSeparator(const SizedBox(height: 10)),
),
),
);
}