@@ -19,7 +19,8 @@ class ReposItem extends StatelessWidget {
1919 ReposItem (this .reposViewModel, {this .onPressed}) : super ();
2020
2121 ///仓库item的底部状态,比如star数量等
22- _getBottomItem (BuildContext context, IconData icon, String text, {int flex = 3 }) {
22+ _getBottomItem (BuildContext context, IconData icon, String text,
23+ {int flex = 3 }) {
2324 return new Expanded (
2425 flex: flex,
2526 child: new Center (
@@ -30,7 +31,9 @@ class ReposItem extends StatelessWidget {
3031 Color (GSYColors .subTextColor),
3132 15.0 ,
3233 padding: 5.0 ,
33- textWidth: 80 ,
34+ textWidth: flex == 4
35+ ? (MediaQuery .of (context).size.width - 100 ) / 3
36+ : (MediaQuery .of (context).size.width - 100 ) / 5 ,
3437 ),
3538 ),
3639 );
@@ -43,7 +46,8 @@ class ReposItem extends StatelessWidget {
4346 child: new FlatButton (
4447 onPressed: onPressed,
4548 child: new Padding (
46- padding: new EdgeInsets .only (left: 0.0 , top: 10.0 , right: 10.0 , bottom: 10.0 ),
49+ padding: new EdgeInsets .only (
50+ left: 0.0 , top: 10.0 , right: 10.0 , bottom: 10.0 ),
4751 child: new Column (
4852 mainAxisSize: MainAxisSize .min,
4953 children: < Widget > [
@@ -52,19 +56,22 @@ class ReposItem extends StatelessWidget {
5256 children: < Widget > [
5357 ///头像
5458 new GSYUserIconWidget (
55- padding: const EdgeInsets .only (top: 0.0 , right: 5.0 , left: 0.0 ),
59+ padding: const EdgeInsets .only (
60+ top: 0.0 , right: 5.0 , left: 0.0 ),
5661 width: 40.0 ,
5762 height: 40.0 ,
5863 image: reposViewModel.ownerPic,
5964 onPressed: () {
60- NavigatorUtils .goPerson (context, reposViewModel.ownerName);
65+ NavigatorUtils .goPerson (
66+ context, reposViewModel.ownerName);
6167 }),
6268 new Expanded (
6369 child: new Column (
6470 crossAxisAlignment: CrossAxisAlignment .start,
6571 children: < Widget > [
6672 ///仓库名
67- new Text (reposViewModel.repositoryName, style: GSYConstant .normalTextBold),
73+ new Text (reposViewModel.repositoryName ?? "" ,
74+ style: GSYConstant .normalTextBold),
6875
6976 ///用户名
7077 new GSYIConText (
@@ -80,7 +87,8 @@ class ReposItem extends StatelessWidget {
8087 ),
8188
8289 ///仓库语言
83- new Text (reposViewModel.repositoryType, style: GSYConstant .smallSubText),
90+ new Text (reposViewModel.repositoryType,
91+ style: GSYConstant .smallSubText),
8492 ],
8593 ),
8694 new Container (
@@ -100,9 +108,19 @@ class ReposItem extends StatelessWidget {
100108 new Row (
101109 crossAxisAlignment: CrossAxisAlignment .start,
102110 children: < Widget > [
103- _getBottomItem (context, GSYICons .REPOS_ITEM_STAR , reposViewModel.repositoryStar),
104- _getBottomItem (context, GSYICons .REPOS_ITEM_FORK , reposViewModel.repositoryFork),
105- _getBottomItem (context, GSYICons .REPOS_ITEM_ISSUE , reposViewModel.repositoryWatch, flex: 4 ),
111+ _getBottomItem (context, GSYICons .REPOS_ITEM_STAR ,
112+ reposViewModel.repositoryStar),
113+ new SizedBox (
114+ width: 5 ,
115+ ),
116+ _getBottomItem (context, GSYICons .REPOS_ITEM_FORK ,
117+ reposViewModel.repositoryFork),
118+ new SizedBox (
119+ width: 5 ,
120+ ),
121+ _getBottomItem (context, GSYICons .REPOS_ITEM_ISSUE ,
122+ reposViewModel.repositoryWatch,
123+ flex: 4 ),
106124 ],
107125 ),
108126 ],
@@ -138,7 +156,7 @@ class ReposViewModel {
138156
139157 ReposViewModel .fromTrendMap (model) {
140158 ownerName = model.name;
141- if (model.contributors.length > 0 ) {
159+ if (model.contributors.length > 0 ) {
142160 ownerPic = model.contributors[0 ];
143161 } else {
144162 ownerPic = "" ;
0 commit comments