diff --git a/lib/models/theme.dart b/lib/models/theme.dart index a3a0ede..34718e2 100644 --- a/lib/models/theme.dart +++ b/lib/models/theme.dart @@ -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, diff --git a/lib/screens/repository.dart b/lib/screens/repository.dart index 5f19c93..5685d59 100644 --- a/lib/screens/repository.dart +++ b/lib/screens/repository.dart @@ -125,6 +125,7 @@ class RepositoryScreen extends StatelessWidget { 1; final theme = Provider.of(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, diff --git a/lib/widgets/avatar.dart b/lib/widgets/avatar.dart index 7e981e9..625f21f 100644 --- a/lib/widgets/avatar.dart +++ b/lib/widgets/avatar.dart @@ -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, diff --git a/lib/widgets/entry_item.dart b/lib/widgets/entry_item.dart index 2017b9b..207d82f 100644 --- a/lib/widgets/entry_item.dart +++ b/lib/widgets/entry_item.dart @@ -37,7 +37,7 @@ class EntryItem extends StatelessWidget { Text( text, style: TextStyle( - fontSize: 12, + fontSize: 14, color: theme.palette.secondaryText, fontWeight: FontWeight.w500, ), diff --git a/lib/widgets/event_item.dart b/lib/widgets/event_item.dart index e149bd6..598e209 100644 --- a/lib/widgets/event_item.dart +++ b/lib/widgets/event_item.dart @@ -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), ); } diff --git a/lib/widgets/loading.dart b/lib/widgets/loading.dart index ffa8bf2..47b6897 100644 --- a/lib/widgets/loading.dart +++ b/lib/widgets/loading.dart @@ -7,26 +7,16 @@ class Loading extends StatelessWidget { final bool more; Loading({this.more = false}); - - Widget _buildIndicator(BuildContext context) { - switch (Provider.of(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(), + ), ), ); } diff --git a/lib/widgets/repository_item.dart b/lib/widgets/repository_item.dart index c58f8de..ae6a83b 100644 --- a/lib/widgets/repository_item.dart +++ b/lib/widgets/repository_item.dart @@ -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(context); // TODO: text style inRepoScreen - return Link( - url: '/$owner/$name', - onLongPress: () async { - await Provider.of(context).showActions(context, [ - ActionItem.user(owner), - ActionItem.repository(owner, name), - ]); - }, - child: Container( - padding: CommonStyle.padding, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Avatar.small(url: avatarUrl), - SizedBox(width: 8), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: join(SizedBox(height: 8), [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - 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: [ + Avatar.small(url: avatarUrl), + SizedBox(width: 8), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: join(SizedBox(height: 8), [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ 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: [ - Expanded( - child: Row(children: [ - 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: [ + Expanded( + child: Row(children: [ + 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: [ - 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: [ + Icon(Octicons.star, + size: 14, color: theme.palette.text), + Text(numberFormat.format(starCount)), + ], ), - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Icon(Octicons.repo_forked, - size: 14, color: theme.palette.text), - Text(numberFormat.format(forkCount)), - ], - ), + ), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 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, + ); + } } } diff --git a/lib/widgets/table_view.dart b/lib/widgets/table_view.dart index a4704dc..5edfac5 100644 --- a/lib/widgets/table_view.dart +++ b/lib/widgets/table_view.dart @@ -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( diff --git a/lib/widgets/user_item.dart b/lib/widgets/user_item.dart index 27f448b..242fed7 100644 --- a/lib/widgets/user_item.dart +++ b/lib/widgets/user_item.dart @@ -39,53 +39,59 @@ class UserItem extends StatelessWidget { Widget build(BuildContext context) { final theme = Provider.of(context); - return Link( - url: '/$login', - child: Container( - padding: CommonStyle.padding, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Avatar.large(url: avatarUrl), - SizedBox(width: 10), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - 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: [ + Avatar.large(url: avatarUrl), + SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + 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, + ); + } } }