mirror of
https://github.com/git-touch/git-touch
synced 2025-02-20 21:40:44 +01:00
improvement: style tweaks
This commit is contained in:
parent
cf0783688e
commit
864a995ac8
@ -108,7 +108,7 @@ class ThemeModel with ChangeNotifier {
|
||||
case Brightness.light:
|
||||
return Palette(
|
||||
primary: PrimerColors.blue500,
|
||||
text: PrimerColors.gray900,
|
||||
text: PrimerColors.black,
|
||||
secondaryText: PrimerColors.gray700,
|
||||
tertiaryText: PrimerColors.gray500,
|
||||
background: PrimerColors.white,
|
||||
|
@ -125,6 +125,7 @@ class RepositoryScreen extends StatelessWidget {
|
||||
1;
|
||||
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
final license = repo.licenseInfo?.spdxId ?? repo.licenseInfo?.name;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
@ -193,7 +194,8 @@ class RepositoryScreen extends StatelessWidget {
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.code,
|
||||
text: Text('Code'),
|
||||
rightWidget: Text(filesize(repo.diskUsage * 1000)),
|
||||
rightWidget: Text((license == null ? '' : license + ' / ') +
|
||||
filesize(repo.diskUsage * 1000)),
|
||||
url: '/$owner/$name/blob/${ref.name}',
|
||||
),
|
||||
if (repo.hasIssuesEnabled)
|
||||
@ -273,13 +275,6 @@ class RepositoryScreen extends StatelessWidget {
|
||||
rightWidget: Text(repo.releases.totalCount.toString()),
|
||||
url: repo.url + '/releases',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.law,
|
||||
text: Text('License'),
|
||||
rightWidget: Text(repo.licenseInfo == null
|
||||
? 'Unknown'
|
||||
: (repo.licenseInfo.spdxId ?? repo.licenseInfo.name)),
|
||||
),
|
||||
],
|
||||
),
|
||||
CommonStyle.verticalGap,
|
||||
|
@ -7,13 +7,9 @@ class Avatar extends StatelessWidget {
|
||||
final String url;
|
||||
final double size;
|
||||
|
||||
Avatar({
|
||||
@required this.url,
|
||||
@required this.size,
|
||||
});
|
||||
Avatar.extraSmall({
|
||||
@required this.url,
|
||||
}) : size = 16;
|
||||
}) : size = 20;
|
||||
Avatar.small({@required this.url}) : size = 24;
|
||||
Avatar.medium({
|
||||
@required this.url,
|
||||
|
@ -37,7 +37,7 @@ class EntryItem extends StatelessWidget {
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontSize: 14,
|
||||
color: theme.palette.secondaryText,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
|
@ -18,9 +18,7 @@ class EventItem extends StatelessWidget {
|
||||
TextSpan _buildLinkSpan(ThemeModel theme, String text) {
|
||||
return TextSpan(
|
||||
text: text,
|
||||
style: TextStyle(
|
||||
color: theme.palette.primary,
|
||||
),
|
||||
style: TextStyle(color: theme.palette.primary),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -7,26 +7,16 @@ class Loading extends StatelessWidget {
|
||||
final bool more;
|
||||
|
||||
Loading({this.more = false});
|
||||
|
||||
Widget _buildIndicator(BuildContext context) {
|
||||
switch (Provider.of<ThemeModel>(context).theme) {
|
||||
case AppThemeType.cupertino:
|
||||
return CupertinoActivityIndicator(radius: 12);
|
||||
default:
|
||||
return SizedBox(
|
||||
width: 24,
|
||||
height: 24,
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: more ? 20 : 100),
|
||||
child: _buildIndicator(context),
|
||||
child: SizedBox(
|
||||
width: 24,
|
||||
height: 24,
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import 'package:git_touch/graphql/github_user.dart';
|
||||
import 'package:git_touch/models/gitea.dart';
|
||||
import 'package:git_touch/models/gitlab.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/widgets/action_button.dart';
|
||||
import 'package:git_touch/widgets/avatar.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@ -144,131 +143,127 @@ class RepositoryItem extends StatelessWidget {
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
|
||||
// TODO: text style inRepoScreen
|
||||
return Link(
|
||||
url: '/$owner/$name',
|
||||
onLongPress: () async {
|
||||
await Provider.of<ThemeModel>(context).showActions(context, [
|
||||
ActionItem.user(owner),
|
||||
ActionItem.repository(owner, name),
|
||||
]);
|
||||
},
|
||||
child: Container(
|
||||
padding: CommonStyle.padding,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar.small(url: avatarUrl),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: join(SizedBox(height: 8), <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
owner + ' / ',
|
||||
style: TextStyle(
|
||||
fontSize: inRepoScreen ? 18 : 16,
|
||||
color: theme.palette.primary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
name,
|
||||
style: TextStyle(
|
||||
fontSize: inRepoScreen ? 18 : 16,
|
||||
color: theme.palette.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Expanded(child: Container()),
|
||||
Icon(iconData,
|
||||
size: 18, color: theme.palette.tertiaryText),
|
||||
],
|
||||
),
|
||||
if (description != null && description.isNotEmpty)
|
||||
final widget = Container(
|
||||
padding: CommonStyle.padding,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar.small(url: avatarUrl),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: join(SizedBox(height: 8), <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
description,
|
||||
owner + ' / ',
|
||||
style: TextStyle(
|
||||
color: theme.palette.secondaryText,
|
||||
fontSize: inRepoScreen ? 15 : 14),
|
||||
),
|
||||
if (inRepoScreen)
|
||||
// TODO: link
|
||||
Wrap(
|
||||
spacing: 4,
|
||||
runSpacing: 4,
|
||||
children: topics.map((node) {
|
||||
return Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 4, horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: PrimerColors.blue000,
|
||||
borderRadius: BorderRadius.all(Radius.circular(4)),
|
||||
),
|
||||
child: Text(
|
||||
node.topic.name,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.palette.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
)
|
||||
else
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(
|
||||
color: theme.palette.text,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 17,
|
||||
color: theme.palette.primary,
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Row(children: <Widget>[
|
||||
Container(
|
||||
width: 10,
|
||||
height: 10,
|
||||
decoration: BoxDecoration(
|
||||
color: convertColor(primaryLanguageColor),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
name,
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
color: theme.palette.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Expanded(child: Container()),
|
||||
Icon(iconData, size: 17, color: theme.palette.tertiaryText),
|
||||
],
|
||||
),
|
||||
if (description != null && description.isNotEmpty)
|
||||
Text(
|
||||
description,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: theme.palette.secondaryText,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
if (topics != null && topics.isNotEmpty)
|
||||
// TODO: link
|
||||
Wrap(
|
||||
spacing: 4,
|
||||
runSpacing: 4,
|
||||
children: topics.map((node) {
|
||||
return Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 4, horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: PrimerColors.blue000,
|
||||
borderRadius: BorderRadius.all(Radius.circular(4)),
|
||||
),
|
||||
child: Text(
|
||||
node.topic.name,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: theme.palette.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
if (!inRepoScreen)
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(color: theme.palette.text, fontSize: 13),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Row(children: <Widget>[
|
||||
Container(
|
||||
width: 10,
|
||||
height: 10,
|
||||
decoration: BoxDecoration(
|
||||
color: convertColor(primaryLanguageColor),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(primaryLanguageName ?? 'Unknown'),
|
||||
]),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Icon(Octicons.star,
|
||||
size: 14, color: theme.palette.text),
|
||||
Text(numberFormat.format(starCount)),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(primaryLanguageName ?? 'Unknown'),
|
||||
]),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Icon(Octicons.star,
|
||||
size: 14, color: theme.palette.text),
|
||||
Text(numberFormat.format(starCount)),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Icon(Octicons.repo_forked,
|
||||
size: 14, color: theme.palette.text),
|
||||
Text(numberFormat.format(forkCount)),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Icon(Octicons.repo_forked,
|
||||
size: 14, color: theme.palette.text),
|
||||
Text(numberFormat.format(forkCount)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (inRepoScreen) {
|
||||
// return Material(child: InkWell(child: widget));
|
||||
return widget;
|
||||
} else {
|
||||
return Link(
|
||||
url: '/$owner/$name',
|
||||
child: widget,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,28 +69,32 @@ class TableView extends StatelessWidget {
|
||||
|
||||
var leftWidget = item.leftWidget;
|
||||
if (leftWidget == null && hasIcon) {
|
||||
leftWidget = Icon(
|
||||
item.leftIconData,
|
||||
color: themeModel.palette.primary,
|
||||
size: 18,
|
||||
leftWidget = Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: PrimerColors.blue500,
|
||||
),
|
||||
child: Icon(
|
||||
item.leftIconData,
|
||||
color: themeModel.palette.background,
|
||||
size: 14,
|
||||
),
|
||||
);
|
||||
}
|
||||
// Container(
|
||||
// width: 24,
|
||||
// height: 24,
|
||||
// // decoration: BoxDecoration(
|
||||
// // borderRadius: BorderRadius.circular(4), color: PrimerColors.blue400),
|
||||
// child: Icon(iconData, size: 24, color: PrimerColors.gray600),
|
||||
// )
|
||||
|
||||
var widget = DefaultTextStyle(
|
||||
style: TextStyle(fontSize: 16, color: themeModel.palette.text),
|
||||
final widget = DefaultTextStyle(
|
||||
style: TextStyle(fontSize: 17, color: themeModel.palette.text),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
child: Container(
|
||||
height: 44,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: _leftPadding, child: leftWidget),
|
||||
SizedBox(
|
||||
width: _leftPadding,
|
||||
child: Center(child: leftWidget),
|
||||
),
|
||||
Expanded(child: item.text),
|
||||
if (item.rightWidget != null) ...[
|
||||
DefaultTextStyle(
|
||||
|
@ -39,53 +39,59 @@ class UserItem extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
|
||||
return Link(
|
||||
url: '/$login',
|
||||
child: Container(
|
||||
padding: CommonStyle.padding,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar.large(url: avatarUrl),
|
||||
SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
name ?? login,
|
||||
style: TextStyle(
|
||||
color: theme.palette.primary,
|
||||
fontSize: inUserScreen ? 18 : 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
login,
|
||||
style: TextStyle(
|
||||
color: theme.palette.secondaryText,
|
||||
fontSize: inUserScreen ? 16 : 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
if (bio != null && bio.isNotEmpty)
|
||||
TextContainsOrganization(
|
||||
bio,
|
||||
final widget = Container(
|
||||
padding: CommonStyle.padding,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Avatar.large(url: avatarUrl),
|
||||
SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
name ?? login,
|
||||
style: TextStyle(
|
||||
color: theme.palette.secondaryText,
|
||||
fontSize: inUserScreen ? 15 : 14),
|
||||
color: theme.palette.primary,
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
'($login)',
|
||||
style: TextStyle(
|
||||
color: theme.palette.secondaryText, fontSize: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
if (bio != null && bio.isNotEmpty)
|
||||
TextContainsOrganization(
|
||||
bio,
|
||||
style: TextStyle(
|
||||
color: theme.palette.secondaryText,
|
||||
fontSize: 15,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (inUserScreen) {
|
||||
return widget;
|
||||
} else {
|
||||
return Link(
|
||||
url: '/$login',
|
||||
child: widget,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user