Skip to content

Commit a4c8745

Browse files
committed
动态user header text size
1 parent 916897a commit a4c8745

8 files changed

Lines changed: 98 additions & 10 deletions

File tree

‎lib/common/style/GSYStyle.dart‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ class GSYConstant {
124124
fontSize: smallTextSize,
125125
);
126126

127+
static const minSmallText = TextStyle(
128+
color: Color(GSYColors.subTextColor),
129+
fontSize: minTextSize,
130+
);
131+
127132
static const middleText = TextStyle(
128133
color: Color(GSYColors.mainTextColor),
129134
fontSize: middleTextWhiteSize,

‎lib/widget/IssueHeaderItem.dart‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ class IssueHeaderItem extends StatelessWidget {
2323
@override
2424
Widget build(BuildContext context) {
2525
Color issueStateColor = issueHeaderViewModel.state == "open" ? Colors.green : Colors.red;
26+
///底部Issue状态
2627
Widget bottomContainer = new Row(
2728
children: <Widget>[
29+
///issue 关闭打开状态
2830
new GSYIConText(
2931
GSYICons.ISSUE_ITEM_ISSUE,
3032
issueHeaderViewModel.state,
@@ -37,8 +39,10 @@ class IssueHeaderItem extends StatelessWidget {
3739
padding: 2.0,
3840
),
3941
new Padding(padding: new EdgeInsets.all(2.0)),
42+
///issue issue编码
4043
new Text(issueHeaderViewModel.issueTag, style: GSYConstant.smallTextWhite),
4144
new Padding(padding: new EdgeInsets.all(2.0)),
45+
///issue 评论数
4246
new GSYIConText(
4347
GSYICons.ISSUE_ITEM_COMMENT,
4448
issueHeaderViewModel.commentCount,
@@ -61,6 +65,7 @@ class IssueHeaderItem extends StatelessWidget {
6165
new Row(
6266
crossAxisAlignment: CrossAxisAlignment.start,
6367
children: <Widget>[
68+
///头像
6469
new GSYUserIconWidget(
6570
padding: const EdgeInsets.only(top: 0.0, right: 10.0, left: 0.0),
6671
width: 50.0,
@@ -75,7 +80,9 @@ class IssueHeaderItem extends StatelessWidget {
7580
children: <Widget>[
7681
new Row(
7782
children: <Widget>[
83+
///名称
7884
new Expanded(child: new Text(issueHeaderViewModel.actionUser, style: GSYConstant.normalTextWhite)),
85+
///时间
7986
new Text(
8087
issueHeaderViewModel.actionTime,
8188
style: GSYConstant.subSmallText,
@@ -86,6 +93,7 @@ class IssueHeaderItem extends StatelessWidget {
8693
new Padding(padding: new EdgeInsets.all(2.0)),
8794
bottomContainer,
8895
new Container(
96+
///评论标题
8997
child: new Text(
9098
issueHeaderViewModel.issueComment,
9199
style: GSYConstant.smallTextWhite,
@@ -101,6 +109,7 @@ class IssueHeaderItem extends StatelessWidget {
101109
],
102110
),
103111
new Container(
112+
///评论内容
104113
child: new Text(
105114
issueHeaderViewModel.issueDesHtml,
106115
style: GSYConstant.smallTextWhite,

‎lib/widget/IssueItem.dart‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,30 @@ import 'package:gsy_github_app_flutter/widget/GSYUserIconWidget.dart';
1515
class IssueItem extends StatelessWidget {
1616
final IssueItemViewModel issueItemViewModel;
1717

18+
///点击
1819
final GestureTapCallback onPressed;
20+
21+
///长按
1922
final GestureTapCallback onLongPress;
2023

24+
///是否需要底部状态
2125
final bool hideBottom;
2226

27+
///是否需要限制内容行数
2328
final bool limitComment;
2429

2530
IssueItem(this.issueItemViewModel, {this.onPressed, this.onLongPress, this.hideBottom = false, this.limitComment = true});
2631

2732
@override
2833
Widget build(BuildContext context) {
2934
Color issueStateColor = issueItemViewModel.state == "open" ? Colors.green : Colors.red;
35+
36+
///issue 底部状态
3037
Widget bottomContainer = (hideBottom)
3138
? new Container()
3239
: new Row(
3340
children: <Widget>[
41+
///issue 关闭打开状态
3442
new GSYIConText(
3543
GSYICons.ISSUE_ITEM_ISSUE,
3644
issueItemViewModel.state,
@@ -43,9 +51,13 @@ class IssueItem extends StatelessWidget {
4351
padding: 2.0,
4452
),
4553
new Padding(padding: new EdgeInsets.all(2.0)),
54+
55+
///issue标号
4656
new Expanded(
4757
child: new Text(issueItemViewModel.issueTag, style: GSYConstant.subSmallText),
4858
),
59+
60+
///评论数
4961
new GSYIConText(
5062
GSYICons.ISSUE_ITEM_COMMENT,
5163
issueItemViewModel.commentCount,
@@ -63,6 +75,7 @@ class IssueItem extends StatelessWidget {
6375
child: new Padding(
6476
padding: new EdgeInsets.only(left: 5.0, top: 5.0, right: 10.0, bottom: 8.0),
6577
child: new Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
78+
///头像
6679
new GSYUserIconWidget(
6780
width: 30.0,
6881
height: 30.0,
@@ -76,6 +89,7 @@ class IssueItem extends StatelessWidget {
7689
children: <Widget>[
7790
new Row(
7891
children: <Widget>[
92+
///用户名
7993
new Expanded(child: new Text(issueItemViewModel.actionUser, style: GSYConstant.smallTextBold)),
8094
new Text(
8195
issueItemViewModel.actionTime,
@@ -86,6 +100,8 @@ class IssueItem extends StatelessWidget {
86100
],
87101
),
88102
new Container(
103+
104+
///评论内容
89105
child: new Text(
90106
issueItemViewModel.issueComment,
91107
style: GSYConstant.subSmallText,

‎lib/widget/PushCoedItem.dart‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
44
import 'package:gsy_github_app_flutter/widget/GSYCardItem.dart';
55

66
/**
7+
* 推送修改代码Item
78
* Created by guoshuyu
89
* Date: 2018-07-27
910
*/
@@ -18,13 +19,15 @@ class PushCodeItem extends StatelessWidget {
1819
Widget build(BuildContext context) {
1920
return new Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
2021
new Container(
22+
///修改文件路径
2123
margin: EdgeInsets.only(left: 10.0, top: 5.0, right: 10.0, bottom: 0.0),
2224
child: new Text(
2325
pushCodeItemViewModel.path,
2426
style: GSYConstant.subLightSmallText,
2527
),
2628
),
2729
new GSYCardItem(
30+
///修改文件名
2831
margin: EdgeInsets.only(left: 10.0, top: 5.0, right: 10.0, bottom: 5.0),
2932
child: new ListTile(
3033
title: new Text(pushCodeItemViewModel.name, style: GSYConstant.subSmallText),

‎lib/widget/PushHeader.dart‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:flutter/material.dart';
2-
import 'package:gsy_github_app_flutter/common/model/CommitFile.dart';
32
import 'package:gsy_github_app_flutter/common/model/PushCommit.dart';
43
import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
54
import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart';
@@ -18,6 +17,7 @@ class PushHeader extends StatelessWidget {
1817

1918
PushHeader(this.pushHeaderViewModel);
2019

20+
/// 头部变化数量图标
2121
_getIconItem(IconData icon, String text) {
2222
return new GSYIConText(
2323
icon,
@@ -43,6 +43,7 @@ class PushHeader extends StatelessWidget {
4343
new Row(
4444
crossAxisAlignment: CrossAxisAlignment.start,
4545
children: <Widget>[
46+
///用户头像
4647
new GSYUserIconWidget(
4748
padding: const EdgeInsets.only(top: 0.0, right: 5.0, left: 0.0),
4849
width: 40.0,
@@ -55,6 +56,7 @@ class PushHeader extends StatelessWidget {
5556
child: Column(
5657
mainAxisSize: MainAxisSize.min,
5758
children: <Widget>[
59+
///变化状态
5860
new Row(
5961
children: <Widget>[
6062
_getIconItem(GSYICons.PUSH_ITEM_EDIT, pushHeaderViewModel.editCount),
@@ -66,6 +68,8 @@ class PushHeader extends StatelessWidget {
6668
],
6769
),
6870
new Padding(padding: new EdgeInsets.all(2.0)),
71+
72+
///修改时间
6973
new Container(
7074
child: new Text(
7175
pushHeaderViewModel.pushTime,
@@ -74,6 +78,8 @@ class PushHeader extends StatelessWidget {
7478
),
7579
margin: new EdgeInsets.only(top: 6.0, bottom: 2.0),
7680
alignment: Alignment.topLeft),
81+
82+
///修改的commit内容
7783
new Container(
7884
child: new Text(
7985
pushHeaderViewModel.pushDes,

‎lib/widget/ReposHeaderItem.dart‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class ReposHeaderItem extends StatelessWidget {
1919

2020
ReposHeaderItem(this.reposHeaderViewModel, this.selectItemChanged) : super();
2121

22+
///底部仓库状态信息,比如star数量等
2223
_getBottomItem(IconData icon, String text, onPressed) {
2324
return new Expanded(
2425
child: new Center(
@@ -54,13 +55,15 @@ class ReposHeaderItem extends StatelessWidget {
5455
new GSYCardItem(
5556
color: new Color(GSYColors.primaryValue),
5657
child: new Container(
58+
///背景头像
5759
decoration: new BoxDecoration(
5860
image: new DecorationImage(
5961
fit: BoxFit.cover,
6062
image: new NetworkImage(reposHeaderViewModel.ownerPic),
6163
),
6264
),
6365
child: new Container(
66+
///透明黑色遮罩
6467
decoration: new BoxDecoration(
6568
color: Color(GSYColors.primaryDarkValue & 0xA0FFFFFF),
6669
),
@@ -71,6 +74,7 @@ class ReposHeaderItem extends StatelessWidget {
7174
children: <Widget>[
7275
new Row(
7376
children: <Widget>[
77+
///用户名
7478
new RawMaterialButton(
7579
constraints: new BoxConstraints(minWidth: 0.0, minHeight: 0.0),
7680
padding: new EdgeInsets.all(0.0),
@@ -80,25 +84,33 @@ class ReposHeaderItem extends StatelessWidget {
8084
child: new Text(reposHeaderViewModel.ownerName, style: GSYConstant.normalTextActionWhiteBold),
8185
),
8286
new Text(" /", style: GSYConstant.normalTextMitWhiteBold),
87+
88+
///仓库名
8389
new Text(" " + reposHeaderViewModel.repositoryName, style: GSYConstant.normalTextMitWhiteBold),
8490
],
8591
),
8692
new Row(
8793
children: <Widget>[
88-
new Text(reposHeaderViewModel.repositoryType ?? "--",
89-
style: GSYConstant.subLightSmallText),
94+
///仓库语言
95+
new Text(reposHeaderViewModel.repositoryType ?? "--", style: GSYConstant.subLightSmallText),
9096
new Container(width: 5.3, height: 1.0),
91-
new Text(reposHeaderViewModel.repositorySize ?? "--",
92-
style: GSYConstant.subLightSmallText),
97+
98+
///仓库大小
99+
new Text(reposHeaderViewModel.repositorySize ?? "--", style: GSYConstant.subLightSmallText),
93100
new Container(width: 5.3, height: 1.0),
101+
102+
///仓库协议
94103
new Text(reposHeaderViewModel.license ?? "--", style: GSYConstant.subLightSmallText),
95104
],
96105
),
106+
107+
///仓库描述
97108
new Container(
98-
child:
99-
new Text(reposHeaderViewModel.repositoryDes ?? "---", style: GSYConstant.subLightSmallText),
109+
child: new Text(reposHeaderViewModel.repositoryDes ?? "---", style: GSYConstant.subLightSmallText),
100110
margin: new EdgeInsets.only(top: 6.0, bottom: 2.0),
101111
alignment: Alignment.topLeft),
112+
113+
///创建状态
102114
new Container(
103115
child: new Text(infoText, style: GSYConstant.subLightSmallText),
104116
margin: new EdgeInsets.only(top: 6.0, bottom: 2.0, right: 5.0),
@@ -108,6 +120,8 @@ class ReposHeaderItem extends StatelessWidget {
108120
),
109121
new Padding(
110122
padding: new EdgeInsets.all(0.0),
123+
124+
///创建数值状态
111125
child: new Row(
112126
crossAxisAlignment: CrossAxisAlignment.center,
113127
mainAxisAlignment: MainAxisAlignment.center,
@@ -152,6 +166,7 @@ class ReposHeaderItem extends StatelessWidget {
152166
),
153167
),
154168
),
169+
///底部头
155170
new GSYSelectItemWidget([
156171
GSYStrings.repos_tab_activity,
157172
GSYStrings.repos_tab_commits,

‎lib/widget/ReposItem.dart‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class ReposItem extends StatelessWidget {
1818

1919
ReposItem(this.reposViewModel, {this.onPressed}) : super();
2020

21+
///仓库item的底部状态,比如star数量等
2122
_getBottomItem(IconData icon, String text, {int flex = 2}) {
2223
return new Expanded(
2324
flex: flex,
@@ -48,6 +49,7 @@ class ReposItem extends StatelessWidget {
4849
new Row(
4950
crossAxisAlignment: CrossAxisAlignment.start,
5051
children: <Widget>[
52+
///头像
5153
new GSYUserIconWidget(
5254
padding: const EdgeInsets.only(top: 0.0, right: 5.0, left: 0.0),
5355
width: 40.0,
@@ -60,7 +62,10 @@ class ReposItem extends StatelessWidget {
6062
child: new Column(
6163
crossAxisAlignment: CrossAxisAlignment.start,
6264
children: <Widget>[
65+
///仓库名
6366
new Text(reposViewModel.repositoryName, style: GSYConstant.normalTextBold),
67+
68+
///用户名
6469
new GSYIConText(
6570
GSYICons.REPOS_ITEM_USER,
6671
reposViewModel.ownerName,
@@ -72,10 +77,14 @@ class ReposItem extends StatelessWidget {
7277
],
7378
),
7479
),
80+
81+
///仓库语言
7582
new Text(reposViewModel.repositoryType, style: GSYConstant.subSmallText),
7683
],
7784
),
7885
new Container(
86+
87+
///仓库描述
7988
child: new Text(
8089
reposViewModel.repositoryDes,
8190
style: GSYConstant.subSmallText,
@@ -85,6 +94,8 @@ class ReposItem extends StatelessWidget {
8594
margin: new EdgeInsets.only(top: 6.0, bottom: 2.0),
8695
alignment: Alignment.topLeft),
8796
new Padding(padding: EdgeInsets.all(10.0)),
97+
98+
///仓库状态数值
8899
new Row(
89100
crossAxisAlignment: CrossAxisAlignment.start,
90101
children: <Widget>[
@@ -134,5 +145,4 @@ class ReposViewModel {
134145
repositoryType = model.language;
135146
repositoryDes = model.description;
136147
}
137-
138148
}

0 commit comments

Comments
 (0)