fix: entry item style

This commit is contained in:
Rongjian Zhang 2022-10-04 20:18:04 +08:00
parent 4c2a7177eb
commit 633b58d36f
11 changed files with 34 additions and 28 deletions

View File

@ -62,9 +62,7 @@ class MyApp extends StatelessWidget {
theme: CupertinoThemeData( theme: CupertinoThemeData(
brightness: theme.brightness, brightness: theme.brightness,
primaryColor: antTheme.colorPrimary, primaryColor: antTheme.colorPrimary,
scaffoldBackgroundColor: theme.brightness == Brightness.dark scaffoldBackgroundColor: antTheme.colorBox,
? const Color(0x00ff2629)
: const Color(0xfffafbfc),
textTheme: CupertinoTextThemeData( textTheme: CupertinoTextThemeData(
textStyle: TextStyle( textStyle: TextStyle(
fontSize: antTheme.fontSizeMain, fontSize: antTheme.fontSizeMain,

View File

@ -116,17 +116,17 @@ class GeRepoScreen extends StatelessWidget {
Row( Row(
children: <Widget>[ children: <Widget>[
EntryItem( EntryItem(
count: p.watchersCount, count: p.watchersCount!,
text: 'Watchers', text: 'Watchers',
url: '/gitee/$owner/$name/watchers', url: '/gitee/$owner/$name/watchers',
), ),
EntryItem( EntryItem(
count: p.stargazersCount, count: p.stargazersCount!,
text: 'Stars', text: 'Stars',
url: '/gitee/$owner/$name/stargazers', url: '/gitee/$owner/$name/stargazers',
), ),
EntryItem( EntryItem(
count: p.forksCount, count: p.forksCount!,
text: 'Forks', text: 'Forks',
url: '/gitee/$owner/$name/forks', url: '/gitee/$owner/$name/forks',
), ),

View File

@ -65,22 +65,22 @@ class GeUserScreen extends StatelessWidget {
CommonStyle.border, CommonStyle.border,
Row(children: [ Row(children: [
EntryItem( EntryItem(
count: user.publicRepos, count: user.publicRepos!,
text: 'Repositories', text: 'Repositories',
url: '/gitee/$login?tab=repositories', url: '/gitee/$login?tab=repositories',
), ),
EntryItem( EntryItem(
count: user.stared, count: user.stared!,
text: 'Stars', text: 'Stars',
url: '/gitee/$login?tab=stars', url: '/gitee/$login?tab=stars',
), ),
EntryItem( EntryItem(
count: user.followers, count: user.followers!,
text: 'Followers', text: 'Followers',
url: '/gitee/$login?tab=followers', url: '/gitee/$login?tab=followers',
), ),
EntryItem( EntryItem(
count: user.following, count: user.following!,
text: 'Following', text: 'Following',
url: '/gitee/$login?tab=following', url: '/gitee/$login?tab=following',
), ),

View File

@ -103,7 +103,6 @@ class _User extends StatelessWidget {
] ]
], ],
), ),
CommonStyle.border,
AntList( AntList(
children: [ children: [
if (p.company != null) if (p.company != null)

View File

@ -121,19 +121,19 @@ class GlProjectScreen extends StatelessWidget {
future: memberCountFuture, future: memberCountFuture,
builder: (context, snapshot) { builder: (context, snapshot) {
return EntryItem( return EntryItem(
count: snapshot.data, count: snapshot.data!,
text: AppLocalizations.of(context)!.members, text: AppLocalizations.of(context)!.members,
url: '/gitlab/projects/$id/members', url: '/gitlab/projects/$id/members',
); );
}, },
), ),
EntryItem( EntryItem(
count: p.starCount, count: p.starCount!,
text: AppLocalizations.of(context)!.stars, text: AppLocalizations.of(context)!.stars,
url: '/gitlab/projects/$id/starrers', url: '/gitlab/projects/$id/starrers',
), ),
EntryItem( EntryItem(
count: p.forksCount, count: p.forksCount!,
text: AppLocalizations.of(context)!.forks, // TODO: text: AppLocalizations.of(context)!.forks, // TODO:
), ),
], ],

View File

@ -76,15 +76,15 @@ class GoRepoScreen extends StatelessWidget {
children: <Widget>[ children: <Widget>[
// TODO: when API is available // TODO: when API is available
EntryItem( EntryItem(
count: p.watchersCount, count: p.watchersCount!,
text: 'Watchers', text: 'Watchers',
), ),
EntryItem( EntryItem(
count: p.starsCount, count: p.starsCount!,
text: 'Stars', text: 'Stars',
), ),
EntryItem( EntryItem(
count: p.forksCount, count: p.forksCount!,
text: 'Forks', text: 'Forks',
), ),
], ],

View File

@ -65,16 +65,17 @@ class GtRepoScreen extends StatelessWidget {
Row( Row(
children: <Widget>[ children: <Widget>[
EntryItem( EntryItem(
count: 0, // TODO:
text: 'Watchers', text: 'Watchers',
url: '/gitea/$owner/$name/watchers', url: '/gitea/$owner/$name/watchers',
), ),
EntryItem( EntryItem(
count: p.starsCount, count: p.starsCount!,
text: 'Stars', text: 'Stars',
url: '/gitea/$owner/$name/stargazers', url: '/gitea/$owner/$name/stargazers',
), ),
EntryItem( EntryItem(
count: p.forksCount, count: p.forksCount!,
text: 'Forks', text: 'Forks',
url: '/gitea/$owner/$name/forks', url: '/gitea/$owner/$name/forks',
), ),

View File

@ -111,7 +111,7 @@ class GtUserScreen extends StatelessWidget {
CommonStyle.border, CommonStyle.border,
Row(children: [ Row(children: [
EntryItem( EntryItem(
count: p.userRepoCount, count: p.userRepoCount!,
text: 'Repositories', text: 'Repositories',
url: '/gitea/$login?tab=repositories', url: '/gitea/$login?tab=repositories',
), ),

View File

@ -39,6 +39,7 @@ class StorageKeys {
} }
class CommonStyle { class CommonStyle {
CommonStyle._();
static const padding = EdgeInsets.all(12); static const padding = EdgeInsets.all(12);
static const border = BorderView(); static const border = BorderView();
static const verticalGap = SizedBox(height: 18); static const verticalGap = SizedBox(height: 18);

View File

@ -17,7 +17,7 @@ class BorderView extends StatelessWidget {
margin: EdgeInsets.only(left: leftPadding), margin: EdgeInsets.only(left: leftPadding),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
top: BorderSide(color: AntTheme.of(context).colorBorder, width: 0), top: BorderSide(color: AntTheme.of(context).colorBorder, width: 1),
), ),
), ),
); );

View File

@ -1,7 +1,6 @@
import 'package:antd_mobile/antd_mobile.dart'; import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/link.dart';
class EntryItem extends StatelessWidget { class EntryItem extends StatelessWidget {
const EntryItem({ const EntryItem({
@ -15,11 +14,19 @@ class EntryItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = AntTheme.of(context);
return Expanded( return Expanded(
child: LinkWidget( child: Container(
url: url, color: theme.colorBackground,
child: Container( child: AntButton(
padding: const EdgeInsets.symmetric(vertical: 14), block: true,
size: AntButtonSize.large,
fill: AntButtonFill.none,
color: theme.colorPrimary,
onClick: () {
if (url != null) context.pushUrl(url!);
},
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Text( Text(
@ -27,14 +34,14 @@ class EntryItem extends StatelessWidget {
style: TextStyle( style: TextStyle(
fontSize: 17, fontSize: 17,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: AntTheme.of(context).colorText, color: theme.colorText,
), ),
), ),
Text( Text(
text, text,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: AntTheme.of(context).colorTextSecondary, color: theme.colorTextSecondary,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
) )